Guitarix
gx_internal_plugins.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * --------------------------------------------------------------------------
19 */
20
21/* ------- This is the guitarix Engine namespace ------- */
22
23#pragma once
24
25
26namespace gx_jack { class GxJack; }
27
28namespace gx_engine {
29
30/****************************************************************
31 ** MonoMute, StereoMute, MaxLevel
32 */
33
34class MonoMute: public PluginDef {
35private:
36 static void process(int count, float *input, float *output, PluginDef*);
37public:
39};
40
41class StereoMute: public PluginDef {
42private:
43 static void process(int count, float *input0, float *input1,
44 float *output0, float *output1, PluginDef*);
45public:
47};
48
49class MaxLevel: public PluginDef {
50public:
51 static const unsigned int channelcount = 2;
52private:
53 static float maxlevel[channelcount];
54 static void process(int count, float *input0, float *input1,
55 float *output0, float *output1, PluginDef*);
56 static int activate(bool start, PluginDef *plugin);
57 static int regparam(const ParamReg& reg);
58public:
59 static float get(unsigned int channel) {
60 assert(channel < channelcount);
61 float v = maxlevel[channel];
62 maxlevel[channel] = 0;
63 return v;
64 }
66};
67
68
69/****************************************************************
70 ** class TunerAdapter
71 */
72
73#include "faust/low_high_cut.h"
74
75class TunerAdapter: public ModuleSelector, private PluginDef, public sigc::trackable {
76private:
77 static void feed_tuner(int count, float *input, float *output, PluginDef*);
78 static int regparam(const ParamReg& reg);
79 static int activate(bool start, PluginDef *plugin);
80 static void init(unsigned int samplingFreq, PluginDef *plugin);
81 low_high_cut::Dsp lhc;
83 int state;
85 enum { tuner_use = 0x01, switcher_use = 0x02, midi_use = 0x04 };
86 void set_and_check(int use, bool on);
88public:
93 bool used_for_display() { return state & tuner_use; }
94 void used_by_midi(bool on) { set_and_check(midi_use, on); }
95 void set_dep_module(Plugin* dep) { dep_plugin = dep; }
96 void set_module();
97 Glib::Dispatcher& signal_freq_changed() { return pitch_tracker.new_freq; }
100};
101
102
103/****************************************************************
104 ** class NoiseGate
105 */
106
108private:
110 static float fnglevel;
111 static float ngate;
112 static bool off;
113 static int noisegate_register(const ParamReg& reg);
114 static void inputlevel_compute(int count, float *input0, float *output0, PluginDef*);
115 static void outputgate_compute(int count, float *input, float *output, PluginDef*);
116 static int outputgate_activate(bool start, PluginDef *pdef);
117public:
121};
122
123
124/****************************************************************
125 ** class OscilloscopeAdapter
126 */
127
129private:
131 sigc::signal<void(unsigned int, float*)> size_change;
132 float *buffer;
133 unsigned int buffer_size;
135public:
136 int load;
138 bool is_rt;
139 jack_nframes_t bsize;
140
141 public:
143 jack(nullptr), size_change(), buffer(nullptr), buffer_size(0),
144 load(0), frames(0), is_rt(false), bsize(0) {}
147 void update();
148 float *get_buffer() const { return buffer; }
149 unsigned int get_buffer_size() const { return buffer_size; }
150 sigc::signal<void(unsigned int, float*)> signal_size_change() { return size_change; }
151};
152
153template<>
155private:
158 sigc::signal<void, const OscilloscopeInfo&> changed;
159 void trigger_changed() override;
160public:
161 ParameterV(const string& id, OscilloscopeInfo *v);
164 virtual void serializeJSON(gx_system::JsonWriter& jw) override;
165 sigc::signal<void, const OscilloscopeInfo&>& signal_changed() { return changed; }
167 ParamMap &pmap, const string& id, OscilloscopeInfo *v);
168 OscilloscopeInfo& get_value() const { return *value; }
169 virtual void stdJSON_value() override;
170 virtual bool on_off_value() override;
171 virtual void writeJSON(gx_system::JsonWriter& jw) const override;
172 virtual bool compareJSON_value() override;
173 virtual void setJSON_value() override;
174 virtual void readJSON_value(gx_system::JsonParser& jp) override;
175};
176
178
180public:
182private:
184 static void fill_buffer(int count, float *input0, float *output0, PluginDef*);
185 static int osc_register(const ParamReg& reg);
186 static int osc_load_ui(const UiBuilder& builder, int format);
187 void change_buffersize(unsigned int);
189public:
192 unsigned int get_size() const { return info.buffer_size; }
193 inline float *get_buffer() const { return info.buffer; }
194 int get_mul_buffer() { return mul_buffer; }
195 void set_mul_buffer(int a, unsigned int b) { mul_buffer = a; change_buffersize(b); }
197 void set_jack(gx_jack::GxJack& jack) { info.jack = &jack; }
198};
199
200
201/****************************************************************
202 ** class GxSeqSettings
203 */
204
206 private:
207
208 std::vector<int> seqline;
210 friend class SequencerAdapter;
211 friend class ParameterV<GxSeqSettings>;
212 public:
215 bool operator==(const GxSeqSettings& seqset) const;
216 // getters and setters
217 inline const std::vector<int>& getseqline() const { return seqline; }
218
219 inline void setseqline(const std::vector<int>& seq) { seqline = seq; }
220
221 public:
224};
225
226template<>
228private:
233 sigc::signal<void, const GxSeqSettings*> changed;
234public:
235 ParameterV(const string& id, GxSeqSettings *v);
239 sigc::signal<void, const GxSeqSettings*>& signal_changed() { return changed; }
241 ParamMap &pmap, const string& id, GxSeqSettings *v);
242 bool set(const GxSeqSettings& val) const;
243 const GxSeqSettings& get_value() const { return *value; }
244 virtual void stdJSON_value();
245 virtual bool on_off_value();
246 virtual void writeJSON(gx_system::JsonWriter& jw) const;
247 virtual bool compareJSON_value();
248 virtual void setJSON_value();
250};
251
253
254/****************************************************************
255 ** class GxJConvSettings
256 */
257
259 private:
260 // main jconv setting
261 std::string fIRFile;
262 std::string fIRDir;
263
264 float fGain; // jconv gain
265 guint fOffset; // offset in IR where to start comvolution
266 guint fLength; // length of the IR to use for convolution
267 guint fDelay; // delay when to apply reverb
268 Gainline gainline;
271 inline void setIRDir(string name) { fIRDir = name; }
272 friend class ConvolverAdapter;
273 friend class ParameterV<GxJConvSettings>;
274 public:
277 bool operator==(const GxJConvSettings& jcset) const;
278 // getters and setters
279 inline const std::string& getIRFile() const { return fIRFile; }
280 std::string getFullIRPath() const;
281 inline float getGain() const { return fGain; }
282 inline guint getOffset() const { return fOffset; }
283 inline guint getLength() const { return fLength; }
284 inline guint getDelay() const { return fDelay; }
285 inline bool getGainCor() const { return fGainCor; }
286 inline const Gainline& getGainline() const { return gainline; }
287 const std::string& getIRDir() const { return fIRDir; }
288 void setFullIRPath(string name);
289 inline void setIRFile(string name) { fIRFile = name; }
290 inline void setGain(float gain) { fGain = gain; }
291 inline void setGainCor(bool gain) { fGainCor = gain; }
292 inline void setOffset(guint offs) { fOffset = offs; }
293 inline void setLength(guint leng) { fLength = leng; }
294 inline void setDelay(guint del) { fDelay = del; }
295 inline void setGainline(const Gainline& gain) { gainline = gain; }
296
297 public:
300};
301
302class ConvolverAdapter;
303
304template<>
306private:
311 sigc::signal<void, const GxJConvSettings*> changed;
312public:
313 ParameterV(const string& id, ConvolverAdapter &conv, GxJConvSettings *v);
317 sigc::signal<void, const GxJConvSettings*>& signal_changed() { return changed; }
319 ParamMap &pmap, const string& id, ConvolverAdapter &conv, GxJConvSettings *v);
320 bool set(const GxJConvSettings& val) const;
321 const GxJConvSettings& get_value() const { return *value; }
322 virtual void stdJSON_value();
323 virtual bool on_off_value();
324 virtual void writeJSON(gx_system::JsonWriter& jw) const;
325 virtual bool compareJSON_value();
326 virtual void setJSON_value();
328};
329
331
332
333/****************************************************************
334 ** class ConvolverAdapter
335 */
336
337class ConvolverAdapter: protected PluginDef, public sigc::trackable {
338protected:
340 boost::mutex activate_mutex;
342 sigc::slot<void> sync;
344 // wrapper for the rack order function pointers
345 void change_buffersize(unsigned int size);
348public:
350public:
353 void restart();
355 inline const std::string& getIRFile() const { return jcset.getIRFile(); }
356 inline void set_sync(bool val) { conv.set_sync(val); }
357 inline std::string getFullIRPath() const { return jcset.getFullIRPath(); }
358 inline const std::string& getIRDir() const { return jcset.getIRDir(); }
359 bool set(const GxJConvSettings& jcset) const { return jcp->set(jcset); }
360 const GxJConvSettings& get_jcset() const { return jcset; }
362};
363
364
365/****************************************************************
366 ** class ConvolverStereoAdapter
367 */
368
369#include "faust/jconv_post.h"
370#include "faust/jconv_post_mono.h"
371
373private:
374 jconv_post::Dsp jc_post;
375 // wrapper for the rack order function pointers
376 static void convolver_init(unsigned int samplingFreq, PluginDef *pdef);
377 static int activate(bool start, PluginDef *pdef);
378 static void convolver(int count, float *input0, float *input1,
379 float *output0, float *output1, PluginDef*);
380 static int convolver_register(const ParamReg& reg);
381 static int jconv_load_ui(const UiBuilder& builder, int format);
382public:
385};
386
387
388/****************************************************************
389 ** class ConvolverMonoAdapter
390 */
391
393private:
394 jconv_post_mono::Dsp jc_post_mono;
395 // wrapper for the rack order function pointers
396 static void convolver_init(unsigned int samplingFreq, PluginDef *pdef);
397 static int activate(bool start, PluginDef *pdef);
398 static void convolver(int count, float *input, float *output, PluginDef*);
399 static int convolver_register(const ParamReg& reg);
400 static int jconv_load_ui(const UiBuilder& builder, int format);
401public:
404};
405
406
407/****************************************************************
408 ** class BaseConvolver
409 */
410
411
412class BaseConvolver: protected PluginDef {
413protected:
415 boost::mutex activate_mutex;
417 sigc::slot<void> sync;
419 sigc::connection update_conn;
420 static void init(unsigned int samplingFreq, PluginDef *p);
421 static int activate(bool start, PluginDef *pdef);
422 void change_buffersize(unsigned int);
425 virtual void check_update() = 0;
426 virtual bool start(bool force = false) = 0;
427public:
429public:
431 virtual ~BaseConvolver();
432 inline void set_sync(bool val) { conv.set_sync(val); }
433};
434
435/****************************************************************
436 ** class FixedBaseConvolver
437 */
438
439
441protected:
443 boost::mutex activate_mutex;
445 sigc::slot<void> sync;
447 unsigned int SamplingFreq;
448 unsigned int buffersize;
449 unsigned int bz;
450 sigc::connection update_conn;
451 static void init(unsigned int samplingFreq, PluginDef *p);
452 unsigned int getSamplingFreq() { return SamplingFreq;};
453 static int activate(bool start, PluginDef *pdef);
454 void change_buffersize(unsigned int);
457 virtual void check_update() = 0;
458 virtual bool start(bool force = false) = 0;
459public:
461public:
464 inline void set_sync(bool val) { conv.set_sync(val); }
465};
466
467/****************************************************************
468 ** class CabinetConvolver
469 */
470
471#include "faust/cabinet_impulse_former.h"
472
474private:
476 float level;
478 float bass;
479 float treble;
480 float sum;
482 cabinet_impulse_former::Dsp impf;
484 static void run_cab_conf(int count, float *input, float *output, PluginDef*);
485 static int register_cab(const ParamReg& reg);
486 bool do_update();
487 virtual void check_update();
488 virtual bool start(bool force = false);
489 bool cabinet_changed() { return current_cab != cabinet; }
491 bool sum_changed() { return std::abs(sum - (level + bass + treble)) > 0.01; }
492 void update_sum() { sum = level + bass + treble; }
493public:
497};
498
499#include "faust/cabinet_impulse_former_st.h"
500
502private:
504 float level;
506 float bass;
507 float treble;
508 float sum;
510 cabinet_impulse_former_st::Dsp impf;
513 static void run_cab_conf(int count, float *input, float *input1, float *output, float *output1, PluginDef*);
514 static int register_cab(const ParamReg& reg);
515 bool do_update();
516 virtual void check_update();
517 virtual bool start(bool force = false);
518 bool cabinet_changed() { return current_cab != cabinet; }
520 bool sum_changed() { return fabs(sum - (level + bass + treble)) > 0.01; }
521 void update_sum() { sum = level + bass + treble; }
522public:
526};
527
528
529/****************************************************************
530 ** class PreampConvolver
531 */
532
533#include "faust/preamp_impulse_former.h"
534
536private:
538 float level;
540 float bass;
541 float treble;
542 float sum;
544 preamp_impulse_former::Dsp impf;
546 static void run_pre_conf(int count, float *input, float *output, PluginDef*);
547 static int register_pre(const ParamReg& reg);
548 bool do_update();
549 virtual void check_update();
550 virtual bool start(bool force = false);
551 bool preamp_changed() { return current_pre != preamp; }
553 bool sum_changed() { return std::abs(sum - (level + bass + treble)) > 0.01; }
554 void update_sum() { sum = level + bass + treble; }
555public:
559};
560
561#include "faust/preamp_impulse_former_st.h"
562
564private:
566 float level;
568 float bass;
569 float treble;
570 float sum;
572 preamp_impulse_former_st::Dsp impf;
575 static void run_pre_conf(int count, float *input, float *input1, float *output, float *output1, PluginDef*);
576 static int register_pre(const ParamReg& reg);
577 bool do_update();
578 virtual void check_update();
579 virtual bool start(bool force = false);
580 bool preamp_changed() { return current_pre != preamp; }
582 bool sum_changed() { return fabs(sum - (level + bass + treble)) > 0.01; }
583 void update_sum() { sum = level + bass + treble; }
584public:
588};
589
590/****************************************************************
591 ** class ContrastConvolver
592 */
593
594#include "faust/presence_level.h"
595
597private:
598 float level;
599 float sum;
600 presence_level::Dsp presl;
602 static void run_contrast(int count, float *input, float *output, PluginDef*);
603 static int register_con(const ParamReg& reg);
604 inline void update_sum() { sum = level; }
605 virtual void check_update();
606 bool do_update();
607 inline bool sum_changed() { return std::abs(sum - level) > 0.01; }
608 virtual bool start(bool force = false);
609public:
613};
614
615/****************************************************************
616 ** class LV2Features
617 */
618
620private:
621
622 static LV2_Options_Option gx_options[2];
623 static LV2_Feature gx_options_feature;
624
625 static LV2_URID lv2_urid_map(LV2_URID_Map_Handle, const char* const uri_);
626 static LV2_Feature gx_urid_map_feature;
627
628#pragma GCC diagnostic push
629#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
630 static uint32_t lv2_uri_to_id(LV2_URI_Map_Callback_Data handle, const char*, const char* uri);
631 static LV2_URI_Map_Feature gx_uri_map;
632 static LV2_Feature gx_uri_map_feature;
633#pragma GCC diagnostic pop
634
635 static const char* lv2_urid_unmap(LV2_URID_Unmap_Handle, const LV2_URID urid);
636 static LV2_Feature gx_urid_unmap_feature;
638
639public:
641 {
642 static LV2Features instance;
643 return instance;
644 }
645 static LV2_Feature* gx_features[];
646 static LV2_URID_Map gx_urid_map;
647 static LV2_URID_Unmap gx_urid_unmap;
648
649 LV2Features(LV2Features const&) = delete;
650 void operator=(LV2Features const&) = delete;
651
652};
653
654/****************************************************************
655 ** class LadspaLoader
656 */
657
659
660struct paradesc: boost::noncopyable {
661 int index;
662 std::string name;
663 float dflt;
664 float low;
665 float up;
666 float step;
668 bool newrow;
671 paradesc(): index(), name(), dflt(), low(), up(), step(), tp(), newrow(), has_caption(true), values() {}
673 void set_valuelist(const std::vector<std::string>& v);
676};
677
679
680class plugdesc {
681public:
682 std::string path;
683 unsigned int index;
684 unsigned long UniqueID;
685 Glib::ustring Label;
686 Glib::ustring shortname;
687 Glib::ustring category;
688 int quirks; // quirkflag bits
692 Glib::ustring master_label;
693 std::vector<paradesc*> names;
694 std::string id_str;
695private:
698 friend class LadspaLoader;
699public:
702};
703
705public:
706 typedef std::vector<plugdesc*> pluginarray;
707private:
710 LilvWorld* world;
712 const LilvPlugins* lv2_plugins;
713 LilvNode* lv2_AudioPort;
715 LilvNode* lv2_InputPort;
716 LilvNode* lv2_OutputPort;
717 LilvNode* lv2_AtomPort;
718private:
719 void read_module_config(const std::string& filename, plugdesc *p);
721public:
725 unsigned int size() { return plugins.size(); }
726 PluginDef *create(unsigned int idx) { return create(plugins[idx]); }
728 pluginarray::iterator begin() { return plugins.begin(); }
729 pluginarray::iterator end() { return plugins.end(); }
730 pluginarray::iterator find(plugdesc* desc);
732 void set_plugins(pluginarray& new_plugins);
733 void update_instance(PluginDef *pdef, plugdesc *pdesc);
734 static std::string get_ladspa_filename(unsigned long uid)
735 { return "ladspa"+gx_system::to_string(uid)+".js"; }
736 static std::string get_ladspa_filename(std::string uid_key)
737 { return "ladspa"+uid_key.substr(9)+".js"; }
738 ParamMap& get_parameter_map() const { return param; }
739 friend class Lv2Dsp;
740};
741
742
743/****************************************************************
744 ** class Directout
745 */
746
747class Directout: public PluginDef {
748public:
749 float* outdata;
750private:
752 int bsize;
753 bool fdfill;
755 sigc::slot<void> sync;
756 void mem_alloc();
757 void mem_free();
758 void init(unsigned int samplingFreq);
759 void compute(int count, float *input0, float *input1, float *output0, float *output1);
760 void change_buffersize(unsigned int size);
761
762 static void init_static(unsigned int samplingFreq, PluginDef*);
763 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
764public:
766 float* get_buffer() {return outdata;};
767 void set_data(bool dfill);
770 Directout( EngineControl& engine, sigc::slot<void> sync);
772};
773
774
775/****************************************************************
776 ** class LiveLooper
777 */
778
779class LiveLooper: public PluginDef {
780
781
783private:
784 Resampler r_file;
786public:
787 int setup(int _inputRate, int _outputRate);
788 int run(int count, float *input, float *output);
789 int max_out_count(int in_count) {
790 return static_cast<int>(ceil((in_count*static_cast<double>(outputRate))/inputRate)); }
791};
792
793private:
795 float gain;
796 float fRec0[2];
797 float gain_out;
798 float fclip1;
799 float fclip2;
800 float fclip3;
801 float fclip4;
802 float fclips1;
803 float fclips2;
804 float fclips3;
805 float fclips4;
806 float fspeed1;
807 float fspeed2;
808 float fspeed3;
809 float fspeed4;
810 float rplay1;
811 float rplay2;
812 float rplay3;
813 float rplay4;
814 float od1;
815 float od2;
816 float od3;
817 float od4;
818 float fod1;
819 float fod2;
820 float fod3;
821 float fod4;
822 float record1;
823 int iVec0[2];
824 int IOTA1;
825 int IOTA2;
826 int IOTA3;
827 int IOTA4;
828 float IOTAR1;
829 float IOTAR2;
830 float IOTAR3;
831 float IOTAR4;
832 float *tape1;
834 float fConst0;
835 float fConst1;
836 float fConst2;
837 float reset1;
838 int RecSize1[2];
839 float rectime0;
840 float fRec1[2];
841 float fRec2[2];
842 int iRec3[2];
843 int iRec4[2];
844 float play1;
845 float playh1;
846 float gain1;
847 float record2;
848 int iVec2[2];
849 float *tape2;
851 float reset2;
852 int RecSize2[2];
853 float rectime1;
854 float fRec6[2];
855 float fRec7[2];
856 int iRec8[2];
857 int iRec9[2];
858 float play2;
859 float playh2;
860 float gain2;
861 float record3;
862 int iVec4[2];
863 float *tape3;
865 float reset3;
866 int RecSize3[2];
867 float rectime2;
868 float fRec11[2];
869 float fRec12[2];
870 int iRec13[2];
871 int iRec14[2];
872 float play3;
873 float playh3;
874 float gain3;
875 float record4;
876 int iVec6[2];
877 float *tape4;
879 float reset4;
880 int RecSize4[2];
881 float rectime3;
882 float fRec16[2];
883 float fRec17[2];
884 int iRec18[2];
885 int iRec19[2];
886 float play4;
887 float playh4;
888 float gain4;
889 float play_all;
890 float dout;
891 float* outbuffer;
892 bool save1;
893 bool save2;
894 bool save3;
895 bool save4;
896 bool first1;
897 bool first2;
898 bool first3;
899 bool first4;
900 bool RP1;
901 bool RP2;
902 bool RP3;
903 bool RP4;
904 Glib::ustring preset_name;
905 Glib::ustring load_file1;
906 Glib::ustring load_file2;
907 Glib::ustring load_file3;
908 Glib::ustring load_file4;
909 Glib::ustring cur_name;
910 Glib::ustring loop_dir;
911 bool save_p;
914 sigc::slot<void> sync;
915 volatile int ready;
918
919 int do_resample(int inrate, int insize, float *input, int maxsize);
920 int do_mono(int c, int f, float *oIn, float *tape, int n);
922 void mem_alloc();
923 void mem_free();
925 int activate(bool start);
926 int load_ui_f(const UiBuilder& b, int form);
927 void init(unsigned int samplingFreq);
928 void compute(int count, float *input0, float *output0);
929 int register_par(const ParamReg& reg);
930 void save_array(std::string name);
931 void load_array(std::string name);
932 void save_to_wave(std::string fname, float *tape, float fSize, int tape_size);
933 int load_from_wave(std::string fname, float **tape, int tape_size);
939
941 static int activate_static(bool start, PluginDef*);
942 static int load_ui_f_static(const UiBuilder& b, int form);
943 static void init_static(unsigned int samplingFreq, PluginDef*);
944 static void compute_static(int count, float *input0, float *output0, PluginDef*);
945 static int register_params_static(const ParamReg& reg);
946 static void del_instance(PluginDef *p);
947public:
949 LiveLooper(ParamMap& param_, sigc::slot<void> sync, const string& loop_dir_);
951};
952
953
954/****************************************************************
955 ** class SCapture
956 */
957
958
959class SCapture: public PluginDef {
960private:
961 SNDFILE * recfile;
967 float fslider0;
969 float fRecC0[2];
970 float fformat;
971 int IOTA;
972 int iA;
975 float *fRec0;
976 float *fRec1;
977 float *tape;
978 sem_t m_trig;
979 pthread_t m_pthr;
980 volatile bool keep_stream;
982 bool is_wav;
983 bool err;
984 float fConst0;
985 float fRecb0[2];
986 int iRecb1[2];
987 float fRecb2[2];
988 void mem_alloc();
989 void mem_free();
991 int activate(bool start);
992 int load_ui_f(const UiBuilder& b, int form);
993 void init(unsigned int samplingFreq);
994 void compute(int count, float *input0, float *output0);
995 void compute_st(int count, float *input0, float *input1, float *output0, float *output1);
996 int register_par(const ParamReg& reg);
997 void save_to_wave(SNDFILE * sf, float *tape, int lSize);
998 SNDFILE *open_stream(std::string fname);
999 void close_stream(SNDFILE **sf);
1003 inline std::string get_ffilename();
1004
1005 static void *run_thread(void* p);
1007 static int activate_static(bool start, PluginDef*);
1008 static const char *glade_def;
1009 static const char *glade_def_st;
1010 static int load_ui_f_static(const UiBuilder& b, int form);
1011 static void init_static(unsigned int samplingFreq, PluginDef*);
1012 static void compute_static(int count, float *input0, float *output0, PluginDef*);
1013 static void compute_static_st(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
1014 static int register_params_static(const ParamReg& reg);
1015 static void del_instance(PluginDef *p);
1016public:
1020};
1021
1022/****************************************************************
1023 ** class DrumSequencer
1024 */
1025
1026#include "faust/drumseq.h"
1027
1028class Drumout {
1029private:
1030 static float* set;
1031 static bool mb;
1032 static float* data;
1034 static void outputdrum_compute(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
1035public:
1036 static void set_plugin(Plugin p);
1037 static void set_data(float* mode, bool ready, float* buf);
1041};
1042
1043
1045private:
1052 drumseq::Dsp drums;
1053
1069 std::vector<int> Vectom;
1070 std::vector<int> Vectom1;
1071 std::vector<int> Vectom2;
1072 std::vector<int> Veckick;
1073 std::vector<int> Vecsnare;
1074 std::vector<int> Vechat;
1075
1078 sigc::slot<void> sync;
1079 volatile bool ready;
1080 float *outdata;
1093
1095 void mem_free();
1096 void init(unsigned int samplingFreq);
1097 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1098 void change_buffersize(unsigned int size);
1099 int register_par(const ParamReg& reg);
1100
1108
1109 static void init_static(unsigned int samplingFreq, PluginDef*);
1110 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
1111 static int register_params_static(const ParamReg& reg);
1112 static void del_instance(PluginDef *p);
1113 static int drum_load_ui(const UiBuilder& builder, int format);
1114public:
1118};
1119
1120/****************************************************************************
1121*
1122* NAME: smbPitchShift.cpp
1123* VERSION: 1.2
1124* HOME URL: http://www.dspdimension.com
1125* KNOWN BUGS: none
1126*
1127*
1128* COPYRIGHT 1999-2009 Stephan M. Bernsee <smb [AT] dspdimension [DOT] com>
1129*
1130* Modified for guitarix by Hermann Meyer 2014
1131*
1132* The Wide Open License (WOL)
1133*
1134* Permission to use, copy, modify, distribute and sell this software and its
1135* documentation for any purpose is hereby granted without fee, provided that
1136* the above copyright notice and this license appear in all source copies.
1137* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF
1138* ANY KIND. See http://www.dspguru.com/wol.htm for more information.
1139*
1140*****************************************************************************/
1141
1142
1143#define M_PI 3.14159265358979323846
1144#define MAX_FRAME_LENGTH 8096
1145
1146class smbPitchShift : public PluginDef {
1147private:
1151 sigc::slot<void> sync;
1152 volatile bool ready;
1155 float *fpb;
1156 float *expect;
1157 float *hanning;
1158 float *hanningd;
1159 float *resampin;
1162 float *indata2;
1171 float a,b,c,d,l;
1172 float wet;
1173 float dry;
1174 float mpi, mpi1;
1175 float tone;
1178 int ai;
1179 int aio;
1180 int ii;
1181 long gRover ;
1182 double magn, phase, tmp, real, imag;
1188
1191
1192 inline int load_ui_f(const UiBuilder& b, int form);
1193 int register_par(const ParamReg& reg);
1195
1197 void mem_free();
1199 int activate(bool start);
1201 void PitchShift(int count, float *indata, float *outdata);
1202 void change_buffersize(unsigned int size);
1203 static int activate_static(bool start, PluginDef*);
1204 static void del_instance(PluginDef *p);
1205 static int registerparam(const ParamReg& reg);
1206 static int load_ui_f_static(const UiBuilder& b, int form);
1207 static void init(unsigned int sampleRate, PluginDef *plugin);
1208 static void compute_static(int count, float *input0, float *output0, PluginDef *p);
1209
1210public:
1214};
1215
1216
1217} // namespace gx_engine
virtual bool start(bool force=false)=0
static int activate(bool start, PluginDef *pdef)
BaseConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
virtual void check_update()=0
void change_buffersize(unsigned int)
static void init(unsigned int samplingFreq, PluginDef *p)
cabinet_impulse_former::Dsp impf
gx_resample::FixedRateResampler smp
virtual bool start(bool force=false)
static void run_cab_conf(int count, float *input, float *output, PluginDef *)
CabinetConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
static int register_cab(const ParamReg &reg)
CabinetStereoConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
gx_resample::FixedRateResampler smps
static void run_cab_conf(int count, float *input, float *input1, float *output, float *output1, PluginDef *)
virtual bool start(bool force=false)
gx_resample::FixedRateResampler smp
cabinet_impulse_former_st::Dsp impf
static int register_cab(const ParamReg &reg)
static int register_con(const ParamReg &reg)
gx_resample::FixedRateResampler smp
virtual bool start(bool force=false)
static void run_contrast(int count, float *input, float *output, PluginDef *)
ContrastConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
const std::string & getIRFile() const
void change_buffersize(unsigned int size)
const std::string & getIRDir() const
ParamMap & get_parameter_map() const
const GxJConvSettings & get_jcset() const
std::string getFullIRPath() const
bool set(const GxJConvSettings &jcset) const
ConvolverAdapter(EngineControl &engine, sigc::slot< void > sync)
static int convolver_register(const ParamReg &reg)
static void convolver(int count, float *input, float *output, PluginDef *)
ConvolverMonoAdapter(EngineControl &engine, sigc::slot< void > sync)
static void convolver_init(unsigned int samplingFreq, PluginDef *pdef)
static int activate(bool start, PluginDef *pdef)
static int jconv_load_ui(const UiBuilder &builder, int format)
static void convolver(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
static void convolver_init(unsigned int samplingFreq, PluginDef *pdef)
ConvolverStereoAdapter(EngineControl &engine, sigc::slot< void > sync)
static int activate(bool start, PluginDef *pdef)
static int convolver_register(const ParamReg &reg)
static int jconv_load_ui(const UiBuilder &builder, int format)
static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
void set_data(bool dfill)
static void init_static(unsigned int samplingFreq, PluginDef *)
Directout(EngineControl &engine, sigc::slot< void > sync)
void change_buffersize(unsigned int size)
sigc::slot< void > sync
void compute(int count, float *input0, float *input1, float *output0, float *output1)
void init(unsigned int samplingFreq)
void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
DrumSequencer(EngineControl &engine, sigc::slot< void > sync)
static void init_static(unsigned int samplingFreq, PluginDef *)
void change_buffersize(unsigned int size)
void init(unsigned int samplingFreq)
static int drum_load_ui(const UiBuilder &builder, int format)
static void del_instance(PluginDef *p)
static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *)
int register_par(const ParamReg &reg)
static int register_params_static(const ParamReg &reg)
static void set_plugin(Plugin p)
static void set_data(float *mode, bool ready, float *buf)
static void outputdrum_compute(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
static PluginDef outputdrum
virtual void check_update()=0
FixedBaseConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
static int activate(bool start, PluginDef *pdef)
static void init(unsigned int samplingFreq, PluginDef *p)
virtual bool start(bool force=false)=0
void change_buffersize(unsigned int)
void read_gainline(gx_system::JsonParser &jp)
void writeJSON(gx_system::JsonWriter &w) const
void readJSON(gx_system::JsonParser &jp)
const Gainline & getGainline() const
std::string getFullIRPath() const
bool operator==(const GxJConvSettings &jcset) const
void setFullIRPath(string name)
const std::string & getIRFile() const
GxJConvSettings & operator=(GxJConvSettings const &jcset)
const std::string & getIRDir() const
void setGainline(const Gainline &gain)
void writeJSON(gx_system::JsonWriter &w) const
bool operator==(const GxSeqSettings &seqset) const
GxSeqSettings & operator=(GxSeqSettings const &seqset)
const std::vector< int > & getseqline() const
void read_seqline(gx_system::JsonParser &jp)
void readJSON(gx_system::JsonParser &jp)
void setseqline(const std::vector< int > &seq)
LV2Features(LV2Features const &)=delete
static LV2_Options_Option gx_options[2]
static LV2Features & getInstance()
static const char * lv2_urid_unmap(LV2_URID_Unmap_Handle, const LV2_URID urid)
void operator=(LV2Features const &)=delete
static uint32_t lv2_uri_to_id(LV2_URI_Map_Callback_Data handle, const char *, const char *uri)
static LV2_Feature gx_options_feature
static LV2_Feature gx_urid_map_feature
static LV2_URID_Map gx_urid_map
static LV2_Feature gx_uri_map_feature
static LV2_Feature gx_urid_unmap_feature
static LV2_URID_Unmap gx_urid_unmap
static LV2_URID lv2_urid_map(LV2_URID_Map_Handle, const char *const uri_)
static LV2_Feature * gx_features[]
static LV2_URI_Map_Feature gx_uri_map
void update_instance(PluginDef *pdef, plugdesc *pdesc)
pluginarray::iterator begin()
static std::string get_ladspa_filename(unsigned long uid)
pluginarray::iterator end()
void read_module_list(pluginarray &p)
const LilvPlugins * lv2_plugins
void set_plugins(pluginarray &new_plugins)
bool load(pluginarray &p)
static std::string get_ladspa_filename(std::string uid_key)
LadspaLoader(const gx_system::CmdlineOptions &options, ParamMap &param)
ParamMap & get_parameter_map() const
const gx_system::CmdlineOptions & options
std::vector< plugdesc * > pluginarray
PluginDef * create(const plugdesc *p)
void read_module_config(const std::string &filename, plugdesc *p)
PluginDef * create(unsigned int idx)
pluginarray::iterator find(plugdesc *desc)
int setup(int _inputRate, int _outputRate)
int run(int count, float *input, float *output)
void save_to_wave(std::string fname, float *tape, float fSize, int tape_size)
static void del_instance(PluginDef *p)
int do_mono(int c, int f, float *oIn, float *tape, int n)
sigc::slot< void > sync
int register_par(const ParamReg &reg)
void init(unsigned int samplingFreq)
int load_from_wave(std::string fname, float **tape, int tape_size)
static int activate_static(bool start, PluginDef *)
int do_resample(int inrate, int insize, float *input, int maxsize)
static void compute_static(int count, float *input0, float *output0, PluginDef *)
void save_array(std::string name)
static void init_static(unsigned int samplingFreq, PluginDef *)
static void clear_state_f_static(PluginDef *)
int load_ui_f(const UiBuilder &b, int form)
void load_array(std::string name)
void compute(int count, float *input0, float *output0)
static int register_params_static(const ParamReg &reg)
LiveLooper(ParamMap &param_, sigc::slot< void > sync, const string &loop_dir_)
int activate(bool start)
static int load_ui_f_static(const UiBuilder &b, int form)
static const unsigned int channelcount
static float get(unsigned int channel)
static void process(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
static int regparam(const ParamReg &reg)
static int activate(bool start, PluginDef *plugin)
static float maxlevel[channelcount]
static void process(int count, float *input, float *output, PluginDef *)
static PluginDef outputgate
static void inputlevel_compute(int count, float *input0, float *output0, PluginDef *)
static int noisegate_register(const ParamReg &reg)
static PluginDef inputdef
static void outputgate_compute(int count, float *input, float *output, PluginDef *)
static int outputgate_activate(bool start, PluginDef *pdef)
void set_jack(gx_jack::GxJack &jack)
static int osc_register(const ParamReg &reg)
OscilloscopeAdapter(ModuleSequencer &engine)
void set_mul_buffer(int a, unsigned int b)
static int osc_load_ui(const UiBuilder &builder, int format)
void change_buffersize(unsigned int)
static void fill_buffer(int count, float *input0, float *output0, PluginDef *)
sigc::signal< void(unsigned int, float *)> signal_size_change()
void writeJSON(gx_system::JsonWriter &w) const
unsigned int get_buffer_size() const
sigc::signal< void(unsigned int, float *)> size_change
void readJSON(gx_system::JsonParser &jp)
virtual void serializeJSON(gx_system::JsonWriter &jw)
ParameterV(const string &id, ConvolverAdapter &conv, GxJConvSettings *v)
bool set(const GxJConvSettings &val) const
virtual void readJSON_value(gx_system::JsonParser &jp)
const GxJConvSettings & get_value() const
static ParameterV< GxJConvSettings > * insert_param(ParamMap &pmap, const string &id, ConvolverAdapter &conv, GxJConvSettings *v)
sigc::signal< void, const GxJConvSettings * > changed
virtual void writeJSON(gx_system::JsonWriter &jw) const
sigc::signal< void, const GxJConvSettings * > & signal_changed()
ParameterV(gx_system::JsonParser &jp)
bool set(const GxSeqSettings &val) const
virtual void writeJSON(gx_system::JsonWriter &jw) const
sigc::signal< void, const GxSeqSettings * > & signal_changed()
virtual void readJSON_value(gx_system::JsonParser &jp)
const GxSeqSettings & get_value() const
virtual void serializeJSON(gx_system::JsonWriter &jw)
sigc::signal< void, const GxSeqSettings * > changed
ParameterV(gx_system::JsonParser &jp)
static ParameterV< GxSeqSettings > * insert_param(ParamMap &pmap, const string &id, GxSeqSettings *v)
ParameterV(const string &id, GxSeqSettings *v)
ParameterV(const string &id, OscilloscopeInfo *v)
ParameterV(gx_system::JsonParser &jp)
sigc::signal< void, const OscilloscopeInfo & > & signal_changed()
virtual bool compareJSON_value() override
virtual void serializeJSON(gx_system::JsonWriter &jw) override
virtual void writeJSON(gx_system::JsonWriter &jw) const override
static ParameterV< OscilloscopeInfo > * insert_param(ParamMap &pmap, const string &id, OscilloscopeInfo *v)
sigc::signal< void, const OscilloscopeInfo & > changed
virtual void readJSON_value(gx_system::JsonParser &jp) override
Glib::Dispatcher new_freq
virtual void check_update()
gx_resample::FixedRateResampler smp
virtual bool start(bool force=false)
static int register_pre(const ParamReg &reg)
static void run_pre_conf(int count, float *input, float *output, PluginDef *)
preamp_impulse_former::Dsp impf
PreampConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
gx_resample::FixedRateResampler smps
static int register_pre(const ParamReg &reg)
virtual bool start(bool force=false)
preamp_impulse_former_st::Dsp impf
PreampStereoConvolver(EngineControl &engine, sigc::slot< void > sync, gx_resample::BufferResampler &resamp)
static void run_pre_conf(int count, float *input, float *input1, float *output, float *output1, PluginDef *)
gx_resample::FixedRateResampler smp
static int activate_static(bool start, PluginDef *)
void close_stream(SNDFILE **sf)
void save_to_wave(SNDFILE *sf, float *tape, int lSize)
static void compute_static_st(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
int activate(bool start)
std::string get_ffilename()
void compute(int count, float *input0, float *output0)
SNDFILE * open_stream(std::string fname)
static void init_static(unsigned int samplingFreq, PluginDef *)
static void * run_thread(void *p)
void init(unsigned int samplingFreq)
static void clear_state_f_static(PluginDef *)
int load_ui_f(const UiBuilder &b, int form)
SCapture(EngineControl &engine, int channel_)
static const char * glade_def
static void compute_static(int count, float *input0, float *output0, PluginDef *)
static int load_ui_f_static(const UiBuilder &b, int form)
void compute_st(int count, float *input0, float *input1, float *output0, float *output1)
int register_par(const ParamReg &reg)
static void del_instance(PluginDef *p)
static int register_params_static(const ParamReg &reg)
static const char * glade_def_st
static void process(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *)
static int regparam(const ParamReg &reg)
static void feed_tuner(int count, float *input, float *output, PluginDef *)
void set_and_check(int use, bool on)
static int activate(bool start, PluginDef *plugin)
TunerAdapter(ModuleSequencer &engine)
void set_dep_module(Plugin *dep)
static void init(unsigned int samplingFreq, PluginDef *plugin)
Glib::Dispatcher & signal_freq_changed()
void readJSON(gx_system::JsonParser &jp)
std::vector< paradesc * > names
void writeJSON(gx_system::JsonWriter &jw)
float gSynMagn[MAX_FRAME_LENGTH]
void PitchShift(int count, float *indata, float *outdata)
float gInFIFO[MAX_FRAME_LENGTH]
gx_resample::SimpleResampler resamp
float gAnaMagn[MAX_FRAME_LENGTH]
float gLastPhase[MAX_FRAME_LENGTH/2+1]
int activate(bool start)
float gSynFreq[MAX_FRAME_LENGTH]
int load_ui_f(const UiBuilder &b, int form)
fftwf_complex fftw_out[MAX_FRAME_LENGTH]
float gAnaFreq[MAX_FRAME_LENGTH]
static void compute_static(int count, float *input0, float *output0, PluginDef *p)
static int activate_static(bool start, PluginDef *)
smbPitchShift(EngineControl &engine, sigc::slot< void > sync)
float gOutputAccum[2 *MAX_FRAME_LENGTH]
static void init(unsigned int sampleRate, PluginDef *plugin)
static int registerparam(const ParamReg &reg)
static int load_ui_f_static(const UiBuilder &b, int form)
fftwf_complex fftw_in[MAX_FRAME_LENGTH]
static void del_instance(PluginDef *p)
float gSumPhase[MAX_FRAME_LENGTH/2+1]
int register_par(const ParamReg &reg)
void change_buffersize(unsigned int size)
bool setParameters(int sampleRate)
float gOutFIFO[MAX_FRAME_LENGTH]
#define FAUSTFLOAT
#define MAX_FRAME_LENGTH
ParameterV< OscilloscopeInfo > OscParameter
ParameterV< GxSeqSettings > SeqParameter
ParameterV< GxJConvSettings > JConvParameter
std::string to_string(const T &t)
Definition: gx_system.h:561
Parameter registration function pointers.
Definition: gx_plugin.h:141
const char * name
Definition: gx_plugin.h:200
void writeJSON(gx_system::JsonWriter &jw)
void readJSON(gx_system::JsonParser &jp)
void set_valuelist(const std::vector< std::string > &v)