26 #include <lilv/lilv.h> 27 #include "lv2/lv2plug.in/ns/ext/presets/presets.h" 28 #include "lv2/lv2plug.in/ns/ext/state/state.h" 29 #include "lv2/lv2plug.in/ns/ext/urid/urid.h" 31 namespace gx_jack {
class GxJack; }
41 static void process(
int count,
float *input,
float *output,
PluginDef*);
48 static void process(
int count,
float *input0,
float *input1,
49 float *output0,
float *output1,
PluginDef*);
56 static const unsigned int channelcount = 2;
58 static float maxlevel[channelcount];
59 static void process(
int count,
float *input0,
float *input1,
60 float *output0,
float *output1,
PluginDef*);
63 static float get(
unsigned int channel) {
64 assert(channel < channelcount);
65 float v = maxlevel[channel];
66 maxlevel[channel] = 0;
79 static void feed_tuner(
int count,
float *input,
float *output,
PluginDef*);
80 static int regparam(
const ParamReg& reg);
82 static void init(
unsigned int samplingFreq,
PluginDef *plugin);
86 enum { tuner_use = 0x01, switcher_use = 0x02, midi_use = 0x04 };
87 void set_and_check(
int use,
bool on);
169 unsigned char* midi_send;
170 unsigned char* midi_send1;
171 unsigned char* midi_send2;
174 void register_parameter(
const ParamReg& reg);
175 void init(
int samplingFreq);
176 void process_midi(
int len,
float *audiodata,
void *midi_port_buf,
float jcpu_load,
177 float fConsta4,
float fConsta1t);
184 enum Load { load_off = -1, load_low = 0, load_high = 1, load_over = 2 };
190 Glib::Dispatcher overload_change;
191 static void fill_buffer(
int count,
float *input0,
float *output0,
PluginDef*);
192 static int regparam(
const ParamReg& reg);
193 static void init(
unsigned int samplingFreq,
PluginDef *plugin);
212 static float fnglevel;
215 static int noisegate_register(
const ParamReg& reg);
216 static void inputlevel_compute(
int count,
float *input0,
float *output0,
PluginDef*);
217 static void outputgate_compute(
int count,
float *input,
float *output,
PluginDef*);
232 static float* buffer;
233 static unsigned int size;
234 static void fill_buffer(
int count,
float *input0,
float *output0,
PluginDef*);
235 static int osc_register(
const ParamReg& reg);
237 void change_buffersize(
unsigned int);
247 void set_mul_buffer(
int a,
unsigned int b) { mul_buffer = a; change_buffersize(b); }
269 inline void setIRDir(
string name) { fIRDir = name; }
277 inline const std::string&
getIRFile()
const {
return fIRFile; }
278 std::string getFullIRPath()
const;
279 inline float getGain()
const {
return fGain; }
285 const std::string&
getIRDir()
const {
return fIRDir; }
286 void setFullIRPath(
string name);
288 inline void setGain(
float gain) { fGain = gain; }
293 inline void setGainline(
const Gainline& gain) { gainline = gain; }
311 sigc::signal<void, const GxJConvSettings*> changed;
322 virtual void stdJSON_value();
323 virtual bool on_off_value();
325 virtual bool compareJSON_value();
326 virtual void setJSON_value();
346 void change_buffersize(
unsigned int size);
370 #include "faust/jconv_post.h" 371 #include "faust/jconv_post_mono.h" 375 jconv_post::Dsp jc_post;
377 static void convolver_init(
unsigned int samplingFreq,
PluginDef *pdef);
379 static void convolver(
int count,
float *input0,
float *input1,
380 float *output0,
float *output1,
PluginDef*);
381 static int convolver_register(
const ParamReg& reg);
394 jconv_post_mono::Dsp jc_post_mono;
396 static void convolver_init(
unsigned int samplingFreq,
PluginDef *pdef);
398 static void convolver(
int count,
float *input,
float *output,
PluginDef*);
399 static int convolver_register(
const ParamReg& reg);
421 void change_buffersize(
unsigned int);
423 bool check_update_timeout();
424 virtual void check_update() = 0;
425 virtual bool start(
bool force =
false) = 0;
438 #include "faust/cabinet_impulse_former.h" 449 cabinet_impulse_former::Dsp impf;
450 static void run_cab_conf(
int count,
float *input,
float *output,
PluginDef*);
451 static int register_cab(
const ParamReg& reg);
453 virtual void check_update();
454 virtual bool start(
bool force =
false);
455 bool cabinet_changed() {
return current_cab != cabinet; }
456 void update_cabinet() { current_cab = cabinet; }
457 bool sum_changed() {
return abs(sum - (level + bass + treble)) > 0.01; }
458 void update_sum() { sum = level + bass + treble; }
469 #include "faust/preamp_impulse_former.h" 480 preamp_impulse_former::Dsp impf;
481 static void run_pre_conf(
int count,
float *input,
float *output,
PluginDef*);
482 static int register_pre(
const ParamReg& reg);
484 virtual void check_update();
485 virtual bool start(
bool force =
false);
486 bool preamp_changed() {
return current_pre != preamp; }
487 void update_preamp() { current_pre = preamp; }
488 bool sum_changed() {
return abs(sum - (level + bass + treble)) > 0.01; }
489 void update_sum() { sum = level + bass + treble; }
499 #include "faust/presence_level.h" 505 presence_level::Dsp presl;
506 static void run_contrast(
int count,
float *input,
float *output,
PluginDef*);
507 static int register_con(
const ParamReg& reg);
508 inline void update_sum() { sum = level; }
509 virtual void check_update();
511 inline bool sum_changed() {
return abs(sum - level) > 0.01; }
512 virtual bool start(
bool force =
false);
536 paradesc(): index(), name(), dflt(), low(), up(), step(), tp(), newrow(), has_caption(true), values() {}
538 void set_valuelist(
const std::vector<std::string>& v);
575 const LilvPlugins* lv2_plugins;
576 LilvNode* lv2_AudioPort;
577 LilvNode* lv2_ControlPort;
578 LilvNode* lv2_InputPort;
579 LilvNode* lv2_OutputPort;
581 void read_module_config(
const std::string& filename,
plugdesc *p);
582 void read_module_list(pluginarray& p);
586 bool load(pluginarray& p);
587 unsigned int size() {
return plugins.size(); }
590 pluginarray::iterator
begin() {
return plugins.begin(); }
591 pluginarray::iterator
end() {
return plugins.end(); }
592 pluginarray::iterator find(
plugdesc* desc);
593 void set_plugins(pluginarray& new_plugins);
594 void change_plugins(pluginarray& new_plugins);
599 {
return "ladspa"+uid_key.substr(9)+
".js"; }
612 class FileResampler {
615 int inputRate, outputRate;
618 int setup(
int _inputRate,
int _outputRate);
619 int run(
int count,
float *input,
float *output);
620 int max_out_count(
int in_count) {
621 return static_cast<int>(ceil((in_count*static_cast<double>(outputRate))/inputRate)); }
725 Glib::ustring preset_name;
726 Glib::ustring load_file1;
727 Glib::ustring load_file2;
728 Glib::ustring load_file3;
729 Glib::ustring load_file4;
730 Glib::ustring cur_name;
731 Glib::ustring loop_dir;
735 sigc::slot<void> sync;
739 int do_resample(
int inrate,
int insize,
float *input,
int maxsize);
740 int do_mono(
int c,
int f,
float *oIn,
float *tape,
int n);
741 void play_all_tapes();
744 void clear_state_f();
745 int activate(
bool start);
746 int load_ui_f(
const UiBuilder& b,
int form);
747 void init(
unsigned int samplingFreq);
748 void compute(
int count,
float *input0,
float *output0);
749 int register_par(
const ParamReg& reg);
750 void save_array(std::string name);
751 void load_array(std::string name);
752 void save_to_wave(std::string fname,
float *tape,
float fSize,
int tape_size);
753 int load_from_wave(std::string fname,
float **tape,
int tape_size);
760 static void clear_state_f_static(
PluginDef*);
761 static int activate_static(
bool start,
PluginDef*);
762 static int load_ui_f_static(
const UiBuilder& b,
int form);
763 static void init_static(
unsigned int samplingFreq,
PluginDef*);
764 static void compute_static(
int count,
float *input0,
float *output0,
PluginDef*);
765 static int register_params_static(
const ParamReg& reg);
800 volatile bool keep_stream;
810 void clear_state_f();
811 int activate(
bool start);
812 int load_ui_f(
const UiBuilder& b,
int form);
813 void init(
unsigned int samplingFreq);
814 void compute(
int count,
float *input0,
float *output0);
815 void compute_st(
int count,
float *input0,
float *input1,
float *output0,
float *output1);
816 int register_par(
const ParamReg& reg);
817 void save_to_wave(SNDFILE * sf,
float *tape,
int lSize);
818 SNDFILE *open_stream(std::string fname);
819 void close_stream(SNDFILE **sf);
823 inline std::string get_ffilename();
825 static void *run_thread(
void* p);
826 static void clear_state_f_static(
PluginDef*);
827 static int activate_static(
bool start,
PluginDef*);
828 static const char *glade_def;
829 static const char *glade_def_st;
830 static int load_ui_f_static(
const UiBuilder& b,
int form);
831 static void init_static(
unsigned int samplingFreq,
PluginDef*);
832 static void compute_static(
int count,
float *input0,
float *output0,
PluginDef*);
833 static void compute_static_st(
int count,
float *input0,
float *input1,
float *output0,
float *output1,
PluginDef*);
834 static int register_params_static(
const ParamReg& reg);
866 #define M_PI 3.14159265358979323846 867 #define MAX_FRAME_LENGTH 8096 874 sigc::slot<void> sync;
900 int octave, osamp, numSampsToResamp, numSampsToProcess, fftFrameSize, sampleRate ;
905 long gRover , gInit ;
906 double magn, phase, tmp, window, real, imag;
907 double freqPerBin, freqPerBin1, freqPerBin2, expct;
908 double fftFrameSize3;
909 double fftFrameSize4;
910 double osamp1,osamp2;
911 long i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2;
914 fftwf_plan ftPlanForward, ftPlanInverse;
916 inline int load_ui_f(
const UiBuilder& b,
int form);
917 int register_par(
const ParamReg& reg);
918 void change_latency();
923 int activate(
bool start);
924 bool setParameters(
int sampleRate);
925 void PitchShift(
int count,
float *indata,
float *outdata);
926 void change_buffersize(
unsigned int size);
927 static int activate_static(
bool start,
PluginDef*);
929 static int registerparam(
const ParamReg& reg);
930 static int load_ui_f_static(
const UiBuilder& b,
int form);
931 static void init(
unsigned int sampleRate,
PluginDef *plugin);
932 static void compute_static(
int count,
float *input0,
float *output0,
PluginDef *p);
void used_by_midi(bool on)
CmdConnection::msg_type start
std::string getFullIRPath() const
Glib::Dispatcher & signal_jack_load_change()
pluginarray::iterator end()
bool set(const GxJConvSettings &val) const
ParameterV< GxJConvSettings > JConvParameter
ParamMap & get_parameter_map() const
void set_jack(gx_jack::GxJack *jack_)
static std::string get_ladspa_filename(std::string uid_key)
std::vector< plugdesc * > pluginarray
void used_for_display(bool on)
const std::string & getIRFile() const
sigc::signal< void, const GxJConvSettings * > & signal_changed()
boost::mutex activate_mutex
sigc::signal< int, bool > activation
std::string getFullIRPath() const
PluginDef * create(unsigned int idx)
const std::string & getIRFile() const
static PluginDef outputgate
void used_for_switching(bool on)
void setGainCor(bool gain)
sigc::connection update_conn
boost::mutex activate_mutex
Glib::ustring master_label
std::string to_string(const T &t)
const Gainline & getGainline() const
sigc::signal< void, unsigned int > size_change
std::vector< paradesc * > names
const GxJConvSettings & get_value() const
void setOffset(guint offs)
const std::string & getIRDir() const
pluginarray::iterator begin()
void setGainline(const Gainline &gain)
const std::string & getIRDir() const
float get_estimated_note()
void set_dep_module(Plugin *dep)
Glib::Dispatcher & signal_freq_changed()
void setIRFile(string name)
static std::string get_ladspa_filename(unsigned long uid)
float get_estimated_freq()
void setLength(guint leng)
std::string fformat(float value, float step)
const GxJConvSettings & get_jcset() const
Glib::Dispatcher new_freq
void set_mul_buffer(int a, unsigned int b)