JackTrip
limiterdsp.h
Go to the documentation of this file.
1/* ------------------------------------------------------------
2name: "limiterdsp"
3Code generated with Faust 2.28.6 (https://faust.grame.fr)
4Compilation options: -lang cpp -inpl -scal -ftz 0
5------------------------------------------------------------ */
6
7#ifndef __limiterdsp_H__
8#define __limiterdsp_H__
9
10// NOTE: ANY INCLUDE-GUARD HERE MUST BE DERIVED FROM THE CLASS NAME
11//
12// faust2header.cpp - FAUST Architecture File
13// This is a simple variation of matlabplot.cpp in the Faust distribution
14// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
15// See the Makefile for how to use it.
16
17/************************** BEGIN dsp.h **************************/
18/************************************************************************
19 FAUST Architecture File
20 Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
21 ---------------------------------------------------------------------
22 This Architecture section is free software; you can redistribute it
23 and/or modify it under the terms of the GNU General Public License
24 as published by the Free Software Foundation; either version 3 of
25 the License, or (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public License
33 along with this program; If not, see <http://www.gnu.org/licenses/>.
34
35 EXCEPTION : As a special exception, you may create a larger work
36 that contains this FAUST architecture section and distribute
37 that work under terms of your choice, so long as this FAUST
38 architecture section is not modified.
39 ************************************************************************/
40
41#ifndef __dsp__
42#define __dsp__
43
44#include <string>
45#include <vector>
46
47#ifndef FAUSTFLOAT
48#define FAUSTFLOAT float
49#endif
50
51struct UI;
52struct Meta;
53
58struct dsp_memory_manager {
59
61
62 virtual void* allocate(size_t size) = 0;
63 virtual void destroy(void* ptr) = 0;
64
65};
66
71class dsp {
72
73 public:
74
75 dsp() {}
76 virtual ~dsp() {}
77
78 /* Return instance number of audio inputs */
79 virtual int getNumInputs() = 0;
80
81 /* Return instance number of audio outputs */
82 virtual int getNumOutputs() = 0;
83
90 virtual void buildUserInterface(UI* ui_interface) = 0;
91
92 /* Returns the sample rate currently used by the instance */
93 virtual int getSampleRate() = 0;
94
102 virtual void init(int sample_rate) = 0;
103
109 virtual void instanceInit(int sample_rate) = 0;
110
116 virtual void instanceConstants(int sample_rate) = 0;
117
118 /* Init default control parameters values */
119 virtual void instanceResetUserInterface() = 0;
120
121 /* Init instance state (delay lines...) */
122 virtual void instanceClear() = 0;
123
129 virtual dsp* clone() = 0;
130
136 virtual void metadata(Meta* m) = 0;
137
146 virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) = 0;
147
157 virtual void compute(double /*date_usec*/, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
158
159};
160
165class decorator_dsp : public dsp {
166
167 protected:
168
169 dsp* fDSP;
170
171 public:
172
173 decorator_dsp(dsp* dsp = nullptr):fDSP(dsp) {}
174 virtual ~decorator_dsp() { delete fDSP; }
175
176 virtual int getNumInputs() { return fDSP->getNumInputs(); }
177 virtual int getNumOutputs() { return fDSP->getNumOutputs(); }
178 virtual void buildUserInterface(UI* ui_interface) { fDSP->buildUserInterface(ui_interface); }
179 virtual int getSampleRate() { return fDSP->getSampleRate(); }
180 virtual void init(int sample_rate) { fDSP->init(sample_rate); }
181 virtual void instanceInit(int sample_rate) { fDSP->instanceInit(sample_rate); }
182 virtual void instanceConstants(int sample_rate) { fDSP->instanceConstants(sample_rate); }
184 virtual void instanceClear() { fDSP->instanceClear(); }
185 virtual decorator_dsp* clone() { return new decorator_dsp(fDSP->clone()); }
186 virtual void metadata(Meta* m) { fDSP->metadata(m); }
187 // Beware: subclasses usually have to overload the two 'compute' methods
188 virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(count, inputs, outputs); }
189 virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(date_usec, count, inputs, outputs); }
190
191};
192
197class dsp_factory {
198
199 protected:
200
201 // So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
202 virtual ~dsp_factory() {}
203
204 public:
205
206 virtual std::string getName() = 0;
207 virtual std::string getSHAKey() = 0;
208 virtual std::string getDSPCode() = 0;
209 virtual std::string getCompileOptions() = 0;
210 virtual std::vector<std::string> getLibraryList() = 0;
211 virtual std::vector<std::string> getIncludePathnames() = 0;
212
213 virtual dsp* createDSPInstance() = 0;
214
215 virtual void setMemoryManager(dsp_memory_manager* manager) = 0;
217
218};
219
225#ifdef __SSE__
226 #include <xmmintrin.h>
227 #ifdef __SSE2__
228 #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
229 #else
230 #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
231 #endif
232#else
233 #define AVOIDDENORMALS
234#endif
235
236#endif
237/************************** END dsp.h **************************/
238
239/************************** BEGIN APIUI.h **************************/
240/************************************************************************
241 FAUST Architecture File
242 Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
243 ---------------------------------------------------------------------
244 This Architecture section is free software; you can redistribute it
245 and/or modify it under the terms of the GNU General Public License
246 as published by the Free Software Foundation; either version 3 of
247 the License, or (at your option) any later version.
248
249 This program is distributed in the hope that it will be useful,
250 but WITHOUT ANY WARRANTY; without even the implied warranty of
251 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252 GNU General Public License for more details.
253
254 You should have received a copy of the GNU General Public License
255 along with this program; If not, see <http://www.gnu.org/licenses/>.
256
257 EXCEPTION : As a special exception, you may create a larger work
258 that contains this FAUST architecture section and distribute
259 that work under terms of your choice, so long as this FAUST
260 architecture section is not modified.
261 ************************************************************************/
262
263#ifndef API_UI_H
264#define API_UI_H
265
266#include <sstream>
267#include <string>
268#include <vector>
269#include <iostream>
270#include <map>
271
272/************************** BEGIN meta.h **************************/
273/************************************************************************
274 FAUST Architecture File
275 Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
276 ---------------------------------------------------------------------
277 This Architecture section is free software; you can redistribute it
278 and/or modify it under the terms of the GNU General Public License
279 as published by the Free Software Foundation; either version 3 of
280 the License, or (at your option) any later version.
281
282 This program is distributed in the hope that it will be useful,
283 but WITHOUT ANY WARRANTY; without even the implied warranty of
284 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
285 GNU General Public License for more details.
286
287 You should have received a copy of the GNU General Public License
288 along with this program; If not, see <http://www.gnu.org/licenses/>.
289
290 EXCEPTION : As a special exception, you may create a larger work
291 that contains this FAUST architecture section and distribute
292 that work under terms of your choice, so long as this FAUST
293 architecture section is not modified.
294 ************************************************************************/
295
296#ifndef __meta__
297#define __meta__
298
299struct Meta
300{
301 virtual ~Meta() {};
302 virtual void declare(const char* key, const char* value) = 0;
303
304};
305
306#endif
307/************************** END meta.h **************************/
308/************************** BEGIN UI.h **************************/
309/************************************************************************
310 FAUST Architecture File
311 Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
312 ---------------------------------------------------------------------
313 This Architecture section is free software; you can redistribute it
314 and/or modify it under the terms of the GNU General Public License
315 as published by the Free Software Foundation; either version 3 of
316 the License, or (at your option) any later version.
317
318 This program is distributed in the hope that it will be useful,
319 but WITHOUT ANY WARRANTY; without even the implied warranty of
320 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
321 GNU General Public License for more details.
322
323 You should have received a copy of the GNU General Public License
324 along with this program; If not, see <http://www.gnu.org/licenses/>.
325
326 EXCEPTION : As a special exception, you may create a larger work
327 that contains this FAUST architecture section and distribute
328 that work under terms of your choice, so long as this FAUST
329 architecture section is not modified.
330 ************************************************************************/
331
332#ifndef __UI_H__
333#define __UI_H__
334
335#ifndef FAUSTFLOAT
336#define FAUSTFLOAT float
337#endif
338
339/*******************************************************************************
340 * UI : Faust DSP User Interface
341 * User Interface as expected by the buildUserInterface() method of a DSP.
342 * This abstract class contains only the method that the Faust compiler can
343 * generate to describe a DSP user interface.
344 ******************************************************************************/
345
346struct Soundfile;
347
348template <typename REAL>
349struct UIReal
350{
352 virtual ~UIReal() {}
353
354 // -- widget's layouts
355
356 virtual void openTabBox(const char* label) = 0;
357 virtual void openHorizontalBox(const char* label) = 0;
358 virtual void openVerticalBox(const char* label) = 0;
359 virtual void closeBox() = 0;
360
361 // -- active widgets
362
363 virtual void addButton(const char* label, REAL* zone) = 0;
364 virtual void addCheckButton(const char* label, REAL* zone) = 0;
365 virtual void addVerticalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
366 virtual void addHorizontalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
367 virtual void addNumEntry(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
368
369 // -- passive widgets
370
371 virtual void addHorizontalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
372 virtual void addVerticalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
373
374 // -- soundfiles
375
376 virtual void addSoundfile(const char* label, const char* filename, Soundfile** sf_zone) = 0;
377
378 // -- metadata declarations
379
380 virtual void declare(REAL* zone, const char* key, const char* val) {}
381};
382
383struct UI : public UIReal<FAUSTFLOAT>
384{
385 UI() {}
386 virtual ~UI() {}
387};
388
389#endif
390/************************** END UI.h **************************/
391/************************** BEGIN PathBuilder.h **************************/
392/************************************************************************
393 FAUST Architecture File
394 Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
395 ---------------------------------------------------------------------
396 This Architecture section is free software; you can redistribute it
397 and/or modify it under the terms of the GNU General Public License
398 as published by the Free Software Foundation; either version 3 of
399 the License, or (at your option) any later version.
400
401 This program is distributed in the hope that it will be useful,
402 but WITHOUT ANY WARRANTY; without even the implied warranty of
403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
404 GNU General Public License for more details.
405
406 You should have received a copy of the GNU General Public License
407 along with this program; If not, see <http://www.gnu.org/licenses/>.
408
409 EXCEPTION : As a special exception, you may create a larger work
410 that contains this FAUST architecture section and distribute
411 that work under terms of your choice, so long as this FAUST
412 architecture section is not modified.
413 ************************************************************************/
414
415#ifndef FAUST_PATHBUILDER_H
416#define FAUST_PATHBUILDER_H
417
418#include <vector>
419#include <string>
420#include <algorithm>
421
422/*******************************************************************************
423 * PathBuilder : Faust User Interface
424 * Helper class to build complete hierarchical path for UI items.
425 ******************************************************************************/
426
427class PathBuilder
428{
429
430 protected:
431
432 std::vector<std::string> fControlsLevel;
433
434 public:
435
437 virtual ~PathBuilder() {}
438
439 std::string buildPath(const std::string& label)
440 {
441 std::string res = "/";
442 for (size_t i = 0; i < fControlsLevel.size(); i++) {
443 res += fControlsLevel[i];
444 res += "/";
445 }
446 res += label;
447 std::replace(res.begin(), res.end(), ' ', '_');
448 return res;
449 }
450
451 std::string buildLabel(std::string label)
452 {
453 std::replace(label.begin(), label.end(), ' ', '_');
454 return label;
455 }
456
457 void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
458 void popLabel() { fControlsLevel.pop_back(); }
459
460};
461
462#endif // FAUST_PATHBUILDER_H
463/************************** END PathBuilder.h **************************/
464/************************** BEGIN ValueConverter.h **************************/
465/************************************************************************
466 FAUST Architecture File
467 Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
468 ---------------------------------------------------------------------
469 This Architecture section is free software; you can redistribute it
470 and/or modify it under the terms of the GNU General Public License
471 as published by the Free Software Foundation; either version 3 of
472 the License, or (at your option) any later version.
473
474 This program is distributed in the hope that it will be useful,
475 but WITHOUT ANY WARRANTY; without even the implied warranty of
476 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
477 GNU General Public License for more details.
478
479 You should have received a copy of the GNU General Public License
480 along with this program; If not, see <http://www.gnu.org/licenses/>.
481
482 EXCEPTION : As a special exception, you may create a larger work
483 that contains this FAUST architecture section and distribute
484 that work under terms of your choice, so long as this FAUST
485 architecture section is not modified.
486 ************************************************************************/
487
488#ifndef __ValueConverter__
489#define __ValueConverter__
490
491/***************************************************************************************
492 ValueConverter.h
493 (GRAME, Copyright 2015-2019)
494
495Set of conversion objects used to map user interface values (for example a gui slider
496delivering values between 0 and 1) to faust values (for example a vslider between
49720 and 20000) using a log scale.
498
499-- Utilities
500
501Range(lo,hi) : clip a value x between lo and hi
502Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and v2
503Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1 vm v2
504
505-- Value Converters
506
507ValueConverter::ui2faust(x)
508ValueConverter::faust2ui(x)
509
510-- ValueConverters used for sliders depending of the scale
511
512LinearValueConverter(umin, umax, fmin, fmax)
513LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
514LogValueConverter(umin, umax, fmin, fmax)
515ExpValueConverter(umin, umax, fmin, fmax)
516
517-- ValueConverters used for accelerometers based on 3 points
518
519AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
520AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
521AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
522AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
523
524-- lists of ZoneControl are used to implement accelerometers metadata for each axes
525
526ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
527
528-- ZoneReader are used to implement screencolor metadata
529
530ZoneReader(zone, valueConverter) : a zone with a data converter
531
532****************************************************************************************/
533
534#include <float.h>
535#include <algorithm> // std::max
536#include <cmath>
537#include <vector>
538#include <assert.h>
539
540//--------------------------------------------------------------------------------------
541// Interpolator(lo,hi,v1,v2)
542// Maps a value x between lo and hi to a value y between v1 and v2
543// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
544// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
545// y = v1 + x*coef - lo*coef
546// y = v1 - lo*coef + x*coef
547// y = offset + x*coef with offset = v1 - lo*coef
548//--------------------------------------------------------------------------------------
549class Interpolator
550{
551 private:
552
553 //--------------------------------------------------------------------------------------
554 // Range(lo,hi) clip a value between lo and hi
555 //--------------------------------------------------------------------------------------
556 struct Range
557 {
558 double fLo;
559 double fHi;
560
561 Range(double x, double y) : fLo(std::min<double>(x,y)), fHi(std::max<double>(x,y)) {}
562 double operator()(double x) { return (x<fLo) ? fLo : (x>fHi) ? fHi : x; }
563 };
564
565
566 Range fRange;
567 double fCoef;
568 double fOffset;
569
570 public:
571
572 Interpolator(double lo, double hi, double v1, double v2) : fRange(lo,hi)
573 {
574 if (hi != lo) {
575 // regular case
576 fCoef = (v2-v1)/(hi-lo);
577 fOffset = v1 - lo*fCoef;
578 } else {
579 // degenerate case, avoids division by zero
580 fCoef = 0;
581 fOffset = (v1+v2)/2;
582 }
583 }
584 double operator()(double v)
585 {
586 double x = fRange(v);
587 return fOffset + x*fCoef;
588 }
589
590 void getLowHigh(double& amin, double& amax)
591 {
592 amin = fRange.fLo;
593 amax = fRange.fHi;
594 }
595};
596
597//--------------------------------------------------------------------------------------
598// Interpolator3pt(lo,mi,hi,v1,vm,v2)
599// Map values between lo mid hi to values between v1 vm v2
600//--------------------------------------------------------------------------------------
601class Interpolator3pt
602{
603
604 private:
605
606 Interpolator fSegment1;
607 Interpolator fSegment2;
608 double fMid;
609
610 public:
611
612 Interpolator3pt(double lo, double mi, double hi, double v1, double vm, double v2) :
613 fSegment1(lo, mi, v1, vm),
614 fSegment2(mi, hi, vm, v2),
615 fMid(mi) {}
616 double operator()(double x) { return (x < fMid) ? fSegment1(x) : fSegment2(x); }
617
618 void getMappingValues(double& amin, double& amid, double& amax)
619 {
620 fSegment1.getLowHigh(amin, amid);
621 fSegment2.getLowHigh(amid, amax);
622 }
623};
624
625//--------------------------------------------------------------------------------------
626// Abstract ValueConverter class. Converts values between UI and Faust representations
627//--------------------------------------------------------------------------------------
628class ValueConverter
629{
630
631 public:
632
633 virtual ~ValueConverter() {}
634 virtual double ui2faust(double x) = 0;
635 virtual double faust2ui(double x) = 0;
636};
637
638//--------------------------------------------------------------------------------------
639// A converter than can be updated
640//--------------------------------------------------------------------------------------
641
643
644 protected:
645
646 bool fActive;
647
648 public:
649
651 {}
653 {}
654
655 virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max) = 0;
656 virtual void getMappingValues(double& amin, double& amid, double& amax) = 0;
657
658 void setActive(bool on_off) { fActive = on_off; }
659 bool getActive() { return fActive; }
660
661};
662
663
664//--------------------------------------------------------------------------------------
665// Linear conversion between ui and Faust values
666//--------------------------------------------------------------------------------------
668{
669
670 private:
671
672 Interpolator fUI2F;
673 Interpolator fF2UI;
674
675 public:
676
677 LinearValueConverter(double umin, double umax, double fmin, double fmax) :
678 fUI2F(umin,umax,fmin,fmax), fF2UI(fmin,fmax,umin,umax)
679 {}
680
681 LinearValueConverter() : fUI2F(0.,0.,0.,0.), fF2UI(0.,0.,0.,0.)
682 {}
683 virtual double ui2faust(double x) { return fUI2F(x); }
684 virtual double faust2ui(double x) { return fF2UI(x); }
685
686};
687
688//--------------------------------------------------------------------------------------
689// Two segments linear conversion between ui and Faust values
690//--------------------------------------------------------------------------------------
692{
693
694 private:
695
696 Interpolator3pt fUI2F;
697 Interpolator3pt fF2UI;
698
699 public:
700
701 LinearValueConverter2(double amin, double amid, double amax, double min, double init, double max) :
702 fUI2F(amin, amid, amax, min, init, max), fF2UI(min, init, max, amin, amid, amax)
703 {}
704
705 LinearValueConverter2() : fUI2F(0.,0.,0.,0.,0.,0.), fF2UI(0.,0.,0.,0.,0.,0.)
706 {}
707
708 virtual double ui2faust(double x) { return fUI2F(x); }
709 virtual double faust2ui(double x) { return fF2UI(x); }
710
711 virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max)
712 {
713 fUI2F = Interpolator3pt(amin, amid, amax, min, init, max);
714 fF2UI = Interpolator3pt(min, init, max, amin, amid, amax);
715 }
716
717 virtual void getMappingValues(double& amin, double& amid, double& amax)
718 {
719 fUI2F.getMappingValues(amin, amid, amax);
720 }
721
722};
723
724//--------------------------------------------------------------------------------------
725// Logarithmic conversion between ui and Faust values
726//--------------------------------------------------------------------------------------
728{
729
730 public:
731
732 LogValueConverter(double umin, double umax, double fmin, double fmax) :
733 LinearValueConverter(umin, umax, std::log(std::max<double>(DBL_MIN, fmin)), std::log(std::max<double>(DBL_MIN, fmax)))
734 {}
735
736 virtual double ui2faust(double x) { return std::exp(LinearValueConverter::ui2faust(x)); }
737 virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::log(std::max<double>(x, DBL_MIN))); }
738
739};
740
741//--------------------------------------------------------------------------------------
742// Exponential conversion between ui and Faust values
743//--------------------------------------------------------------------------------------
745{
746
747 public:
748
749 ExpValueConverter(double umin, double umax, double fmin, double fmax) :
750 LinearValueConverter(umin, umax, std::min<double>(DBL_MAX, std::exp(fmin)), std::min<double>(DBL_MAX, std::exp(fmax)))
751 {}
752
753 virtual double ui2faust(double x) { return std::log(LinearValueConverter::ui2faust(x)); }
754 virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::min<double>(DBL_MAX, std::exp(x))); }
755
756};
757
758//--------------------------------------------------------------------------------------
759// Convert accelerometer or gyroscope values to Faust values
760// Using an Up curve (curve 0)
761//--------------------------------------------------------------------------------------
763{
764
765 private:
766
767 Interpolator3pt fA2F;
768 Interpolator3pt fF2A;
769
770 public:
771
772 AccUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
773 fA2F(amin,amid,amax,fmin,fmid,fmax),
774 fF2A(fmin,fmid,fmax,amin,amid,amax)
775 {}
776
777 virtual double ui2faust(double x) { return fA2F(x); }
778 virtual double faust2ui(double x) { return fF2A(x); }
779
780 virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
781 {
782 //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
783 fA2F = Interpolator3pt(amin, amid, amax, fmin, fmid, fmax);
784 fF2A = Interpolator3pt(fmin, fmid, fmax, amin, amid, amax);
785 }
786
787 virtual void getMappingValues(double& amin, double& amid, double& amax)
788 {
789 fA2F.getMappingValues(amin, amid, amax);
790 }
791
792};
793
794//--------------------------------------------------------------------------------------
795// Convert accelerometer or gyroscope values to Faust values
796// Using a Down curve (curve 1)
797//--------------------------------------------------------------------------------------
799{
800
801 private:
802
803 Interpolator3pt fA2F;
804 Interpolator3pt fF2A;
805
806 public:
807
808 AccDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
809 fA2F(amin,amid,amax,fmax,fmid,fmin),
810 fF2A(fmin,fmid,fmax,amax,amid,amin)
811 {}
812
813 virtual double ui2faust(double x) { return fA2F(x); }
814 virtual double faust2ui(double x) { return fF2A(x); }
815
816 virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
817 {
818 //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
819 fA2F = Interpolator3pt(amin, amid, amax, fmax, fmid, fmin);
820 fF2A = Interpolator3pt(fmin, fmid, fmax, amax, amid, amin);
821 }
822
823 virtual void getMappingValues(double& amin, double& amid, double& amax)
824 {
825 fA2F.getMappingValues(amin, amid, amax);
826 }
827};
828
829//--------------------------------------------------------------------------------------
830// Convert accelerometer or gyroscope values to Faust values
831// Using an Up-Down curve (curve 2)
832//--------------------------------------------------------------------------------------
834{
835
836 private:
837
838 Interpolator3pt fA2F;
839 Interpolator fF2A;
840
841 public:
842
843 AccUpDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
844 fA2F(amin,amid,amax,fmin,fmax,fmin),
845 fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
846 {}
847
848 virtual double ui2faust(double x) { return fA2F(x); }
849 virtual double faust2ui(double x) { return fF2A(x); }
850
851 virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
852 {
853 //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
854 fA2F = Interpolator3pt(amin, amid, amax, fmin, fmax, fmin);
855 fF2A = Interpolator(fmin, fmax, amin, amax);
856 }
857
858 virtual void getMappingValues(double& amin, double& amid, double& amax)
859 {
860 fA2F.getMappingValues(amin, amid, amax);
861 }
862};
863
864//--------------------------------------------------------------------------------------
865// Convert accelerometer or gyroscope values to Faust values
866// Using a Down-Up curve (curve 3)
867//--------------------------------------------------------------------------------------
869{
870
871 private:
872
873 Interpolator3pt fA2F;
874 Interpolator fF2A;
875
876 public:
877
878 AccDownUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
879 fA2F(amin,amid,amax,fmax,fmin,fmax),
880 fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
881 {}
882
883 virtual double ui2faust(double x) { return fA2F(x); }
884 virtual double faust2ui(double x) { return fF2A(x); }
885
886 virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
887 {
888 //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
889 fA2F = Interpolator3pt(amin, amid, amax, fmax, fmin, fmax);
890 fF2A = Interpolator(fmin, fmax, amin, amax);
891 }
892
893 virtual void getMappingValues(double& amin, double& amid, double& amax)
894 {
895 fA2F.getMappingValues(amin, amid, amax);
896 }
897};
898
899//--------------------------------------------------------------------------------------
900// Base class for ZoneControl
901//--------------------------------------------------------------------------------------
902class ZoneControl
903{
904
905 protected:
906
908
909 public:
910
911 ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
912 virtual ~ZoneControl() {}
913
914 virtual void update(double v) const {}
915
916 virtual void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max) {}
917 virtual void getMappingValues(double& amin, double& amid, double& amax) {}
918
919 FAUSTFLOAT* getZone() { return fZone; }
920
921 virtual void setActive(bool on_off) {}
922 virtual bool getActive() { return false; }
923
924 virtual int getCurve() { return -1; }
925
926};
927
928//--------------------------------------------------------------------------------------
929// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
930//--------------------------------------------------------------------------------------
932{
933
934 protected:
935
937
938 public:
939
941 virtual ~ConverterZoneControl() { delete fValueConverter; } // Assuming fValueConverter is not kept elsewhere...
942
943 virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
944
946
947};
948
949//--------------------------------------------------------------------------------------
950// Association of a zone and a four value converter, each one for each possible curve.
951// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
952//--------------------------------------------------------------------------------------
953class CurveZoneControl : public ZoneControl
954{
955
956 private:
957
958 std::vector<UpdatableValueConverter*> fValueConverters;
959 int fCurve;
960
961 public:
962
963 CurveZoneControl(FAUSTFLOAT* zone, int curve, double amin, double amid, double amax, double min, double init, double max) : ZoneControl(zone), fCurve(0)
964 {
965 assert(curve >= 0 && curve <= 3);
966 fValueConverters.push_back(new AccUpConverter(amin, amid, amax, min, init, max));
967 fValueConverters.push_back(new AccDownConverter(amin, amid, amax, min, init, max));
968 fValueConverters.push_back(new AccUpDownConverter(amin, amid, amax, min, init, max));
969 fValueConverters.push_back(new AccDownUpConverter(amin, amid, amax, min, init, max));
970 fCurve = curve;
971 }
973 {
974 std::vector<UpdatableValueConverter*>::iterator it;
975 for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
976 delete(*it);
977 }
978 }
979 void update(double v) const { if (fValueConverters[fCurve]->getActive()) *fZone = fValueConverters[fCurve]->ui2faust(v); }
980
981 void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max)
982 {
983 fValueConverters[curve]->setMappingValues(amin, amid, amax, min, init, max);
984 fCurve = curve;
985 }
986
987 void getMappingValues(double& amin, double& amid, double& amax)
988 {
989 fValueConverters[fCurve]->getMappingValues(amin, amid, amax);
990 }
991
992 void setActive(bool on_off)
993 {
994 std::vector<UpdatableValueConverter*>::iterator it;
995 for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
996 (*it)->setActive(on_off);
997 }
998 }
999
1000 int getCurve() { return fCurve; }
1001};
1002
1003class ZoneReader
1004{
1005
1006 private:
1007
1008 FAUSTFLOAT* fZone;
1009 Interpolator fInterpolator;
1010
1011 public:
1012
1013 ZoneReader(FAUSTFLOAT* zone, double lo, double hi) : fZone(zone), fInterpolator(lo, hi, 0, 255) {}
1014
1015 virtual ~ZoneReader() {}
1016
1018 {
1019 return (fZone != nullptr) ? int(fInterpolator(*fZone)) : 127;
1020 }
1021
1022};
1023
1024#endif
1025/************************** END ValueConverter.h **************************/
1026
1027class APIUI : public PathBuilder, public Meta, public UI
1028{
1029 public:
1030
1032
1033 protected:
1034
1035 enum { kLin = 0, kLog = 1, kExp = 2 };
1036
1037 int fNumParameters;
1038 std::vector<std::string> fPaths;
1039 std::vector<std::string> fLabels;
1040 std::map<std::string, int> fPathMap;
1041 std::map<std::string, int> fLabelMap;
1042 std::vector<ValueConverter*> fConversion;
1043 std::vector<FAUSTFLOAT*> fZone;
1044 std::vector<FAUSTFLOAT> fInit;
1045 std::vector<FAUSTFLOAT> fMin;
1046 std::vector<FAUSTFLOAT> fMax;
1047 std::vector<FAUSTFLOAT> fStep;
1048 std::vector<ItemType> fItemType;
1049 std::vector<std::map<std::string, std::string> > fMetaData;
1050 std::vector<ZoneControl*> fAcc[3];
1051 std::vector<ZoneControl*> fGyr[3];
1052
1053 // Screen color control
1054 // "...[screencolor:red]..." etc.
1055 bool fHasScreenControl; // true if control screen color metadata
1059
1060 // Current values controlled by metadata
1061 std::string fCurrentUnit;
1062 int fCurrentScale;
1063 std::string fCurrentAcc;
1064 std::string fCurrentGyr;
1065 std::string fCurrentColor;
1066 std::string fCurrentTooltip;
1067 std::map<std::string, std::string> fCurrentMetadata;
1068
1069 // Add a generic parameter
1070 virtual void addParameter(const char* label,
1071 FAUSTFLOAT* zone,
1072 FAUSTFLOAT init,
1073 FAUSTFLOAT min,
1074 FAUSTFLOAT max,
1075 FAUSTFLOAT step,
1076 ItemType type)
1077 {
1078 std::string path = buildPath(label);
1079 fPathMap[path] = fLabelMap[label] = fNumParameters++;
1080 fPaths.push_back(path);
1081 fLabels.push_back(label);
1082 fZone.push_back(zone);
1083 fInit.push_back(init);
1084 fMin.push_back(min);
1085 fMax.push_back(max);
1086 fStep.push_back(step);
1087 fItemType.push_back(type);
1088
1089 // handle scale metadata
1090 switch (fCurrentScale) {
1091 case kLin:
1092 fConversion.push_back(new LinearValueConverter(0, 1, min, max));
1093 break;
1094 case kLog:
1095 fConversion.push_back(new LogValueConverter(0, 1, min, max));
1096 break;
1097 case kExp: fConversion.push_back(new ExpValueConverter(0, 1, min, max));
1098 break;
1099 }
1101
1102 if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
1103 std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label << " parameter !!\n";
1104 }
1105
1106 // handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
1107 if (fCurrentAcc.size() > 0) {
1108 std::istringstream iss(fCurrentAcc);
1109 int axe, curve;
1110 double amin, amid, amax;
1111 iss >> axe >> curve >> amin >> amid >> amax;
1112
1113 if ((0 <= axe) && (axe < 3) &&
1114 (0 <= curve) && (curve < 4) &&
1115 (amin < amax) && (amin <= amid) && (amid <= amax))
1116 {
1117 fAcc[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
1118 } else {
1119 std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
1120 }
1121 fCurrentAcc = "";
1122 }
1123
1124 // handle gyr metadata "...[gyr : <axe> <curve> <amin> <amid> <amax>]..."
1125 if (fCurrentGyr.size() > 0) {
1126 std::istringstream iss(fCurrentGyr);
1127 int axe, curve;
1128 double amin, amid, amax;
1129 iss >> axe >> curve >> amin >> amid >> amax;
1130
1131 if ((0 <= axe) && (axe < 3) &&
1132 (0 <= curve) && (curve < 4) &&
1133 (amin < amax) && (amin <= amid) && (amid <= amax))
1134 {
1135 fGyr[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
1136 } else {
1137 std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
1138 }
1139 fCurrentGyr = "";
1140 }
1141
1142 // handle screencolor metadata "...[screencolor:red|green|blue|white]..."
1143 if (fCurrentColor.size() > 0) {
1144 if ((fCurrentColor == "red") && (fRedReader == 0)) {
1145 fRedReader = new ZoneReader(zone, min, max);
1146 fHasScreenControl = true;
1147 } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
1148 fGreenReader = new ZoneReader(zone, min, max);
1149 fHasScreenControl = true;
1150 } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
1151 fBlueReader = new ZoneReader(zone, min, max);
1152 fHasScreenControl = true;
1153 } else if ((fCurrentColor == "white") && (fRedReader == 0) && (fGreenReader == 0) && (fBlueReader == 0)) {
1154 fRedReader = new ZoneReader(zone, min, max);
1155 fGreenReader = new ZoneReader(zone, min, max);
1156 fBlueReader = new ZoneReader(zone, min, max);
1157 fHasScreenControl = true;
1158 } else {
1159 std::cerr << "incorrect screencolor metadata : " << fCurrentColor << std::endl;
1160 }
1161 }
1162 fCurrentColor = "";
1163
1164 fMetaData.push_back(fCurrentMetadata);
1165 fCurrentMetadata.clear();
1166 }
1167
1168 int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
1169 {
1170 FAUSTFLOAT* zone = fZone[p];
1171 for (size_t i = 0; i < table[val].size(); i++) {
1172 if (zone == table[val][i]->getZone()) return int(i);
1173 }
1174 return -1;
1175 }
1176
1177 void setConverter(std::vector<ZoneControl*>* table, int p, int val, int curve, double amin, double amid, double amax)
1178 {
1179 int id1 = getZoneIndex(table, p, 0);
1180 int id2 = getZoneIndex(table, p, 1);
1181 int id3 = getZoneIndex(table, p, 2);
1182
1183 // Deactivates everywhere..
1184 if (id1 != -1) table[0][id1]->setActive(false);
1185 if (id2 != -1) table[1][id2]->setActive(false);
1186 if (id3 != -1) table[2][id3]->setActive(false);
1187
1188 if (val == -1) { // Means: no more mapping...
1189 // So stay all deactivated...
1190 } else {
1191 int id4 = getZoneIndex(table, p, val);
1192 if (id4 != -1) {
1193 // Reactivate the one we edit...
1194 table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p], fInit[p], fMax[p]);
1195 table[val][id4]->setActive(true);
1196 } else {
1197 // Allocate a new CurveZoneControl which is 'active' by default
1198 FAUSTFLOAT* zone = fZone[p];
1199 table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, fMin[p], fInit[p], fMax[p]));
1200 }
1201 }
1202 }
1203
1204 void getConverter(std::vector<ZoneControl*>* table, int p, int& val, int& curve, double& amin, double& amid, double& amax)
1205 {
1206 int id1 = getZoneIndex(table, p, 0);
1207 int id2 = getZoneIndex(table, p, 1);
1208 int id3 = getZoneIndex(table, p, 2);
1209
1210 if (id1 != -1) {
1211 val = 0;
1212 curve = table[val][id1]->getCurve();
1213 table[val][id1]->getMappingValues(amin, amid, amax);
1214 } else if (id2 != -1) {
1215 val = 1;
1216 curve = table[val][id2]->getCurve();
1217 table[val][id2]->getMappingValues(amin, amid, amax);
1218 } else if (id3 != -1) {
1219 val = 2;
1220 curve = table[val][id3]->getCurve();
1221 table[val][id3]->getMappingValues(amin, amid, amax);
1222 } else {
1223 val = -1; // No mapping
1224 curve = 0;
1225 amin = -100.;
1226 amid = 0.;
1227 amax = 100.;
1228 }
1229 }
1230
1231 public:
1232
1233 enum Type { kAcc = 0, kGyr = 1, kNoType };
1234
1236 {}
1237
1238 virtual ~APIUI()
1239 {
1240 for (auto& it : fConversion) delete it;
1241 for (int i = 0; i < 3; i++) {
1242 for (auto& it : fAcc[i]) delete it;
1243 for (auto& it : fGyr[i]) delete it;
1244 }
1245 delete fRedReader;
1246 delete fGreenReader;
1247 delete fBlueReader;
1248 }
1249
1250 // -- widget's layouts
1251
1252 virtual void openTabBox(const char* label) { pushLabel(label); }
1253 virtual void openHorizontalBox(const char* label) { pushLabel(label); }
1254 virtual void openVerticalBox(const char* label) { pushLabel(label); }
1255 virtual void closeBox() { popLabel(); }
1256
1257 // -- active widgets
1258
1259 virtual void addButton(const char* label, FAUSTFLOAT* zone)
1260 {
1261 addParameter(label, zone, 0, 0, 1, 1, kButton);
1262 }
1263
1264 virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
1265 {
1266 addParameter(label, zone, 0, 0, 1, 1, kCheckButton);
1267 }
1268
1269 virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
1270 {
1271 addParameter(label, zone, init, min, max, step, kVSlider);
1272 }
1273
1274 virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
1275 {
1276 addParameter(label, zone, init, min, max, step, kHSlider);
1277 }
1278
1279 virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
1280 {
1281 addParameter(label, zone, init, min, max, step, kNumEntry);
1282 }
1283
1284 // -- passive widgets
1285
1286 virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
1287 {
1288 addParameter(label, zone, min, min, max, (max-min)/1000.0, kHBargraph);
1289 }
1290
1291 virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
1292 {
1293 addParameter(label, zone, min, min, max, (max-min)/1000.0, kVBargraph);
1294 }
1295
1296 // -- soundfiles
1297
1298 virtual void addSoundfile(const char* label, const char* filename, Soundfile** sf_zone) {}
1299
1300 // -- metadata declarations
1301
1302 virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val)
1303 {
1304 // Keep metadata
1305 fCurrentMetadata[key] = val;
1306
1307 if (strcmp(key, "scale") == 0) {
1308 if (strcmp(val, "log") == 0) {
1310 } else if (strcmp(val, "exp") == 0) {
1312 } else {
1314 }
1315 } else if (strcmp(key, "unit") == 0) {
1316 fCurrentUnit = val;
1317 } else if (strcmp(key, "acc") == 0) {
1318 fCurrentAcc = val;
1319 } else if (strcmp(key, "gyr") == 0) {
1320 fCurrentGyr = val;
1321 } else if (strcmp(key, "screencolor") == 0) {
1322 fCurrentColor = val; // val = "red", "green", "blue" or "white"
1323 } else if (strcmp(key, "tooltip") == 0) {
1324 fCurrentTooltip = val;
1325 }
1326 }
1327
1328 virtual void declare(const char* key, const char* val)
1329 {}
1330
1331 //-------------------------------------------------------------------------------
1332 // Simple API part
1333 //-------------------------------------------------------------------------------
1335 int getParamIndex(const char* path)
1336 {
1337 if (fPathMap.find(path) != fPathMap.end()) {
1338 return fPathMap[path];
1339 } else if (fLabelMap.find(path) != fLabelMap.end()) {
1340 return fLabelMap[path];
1341 } else {
1342 return -1;
1343 }
1344 }
1345 const char* getParamAddress(int p) { return fPaths[p].c_str(); }
1346 const char* getParamLabel(int p) { return fLabels[p].c_str(); }
1347 std::map<const char*, const char*> getMetadata(int p)
1348 {
1349 std::map<const char*, const char*> res;
1350 std::map<std::string, std::string> metadata = fMetaData[p];
1351 for (auto it : metadata) {
1352 res[it.first.c_str()] = it.second.c_str();
1353 }
1354 return res;
1355 }
1356
1357 const char* getMetadata(int p, const char* key)
1358 {
1359 return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str() : "";
1360 }
1361 FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
1362 FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
1363 FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
1364 FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
1365
1366 FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
1367 FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
1368 void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
1369
1370 double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
1371 void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
1372
1373 double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
1374 double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
1375
1384 {
1385 if (p >= 0) {
1386 if (getZoneIndex(fAcc, p, 0) != -1
1387 || getZoneIndex(fAcc, p, 1) != -1
1388 || getZoneIndex(fAcc, p, 2) != -1) {
1389 return kAcc;
1390 } else if (getZoneIndex(fGyr, p, 0) != -1
1391 || getZoneIndex(fGyr, p, 1) != -1
1392 || getZoneIndex(fGyr, p, 2) != -1) {
1393 return kGyr;
1394 }
1395 }
1396 return kNoType;
1397 }
1398
1407 {
1408 return fItemType[p];
1409 }
1410
1418 void propagateAcc(int acc, double value)
1419 {
1420 for (size_t i = 0; i < fAcc[acc].size(); i++) {
1421 fAcc[acc][i]->update(value);
1422 }
1423 }
1424
1436 void setAccConverter(int p, int acc, int curve, double amin, double amid, double amax)
1437 {
1438 setConverter(fAcc, p, acc, curve, amin, amid, amax);
1439 }
1440
1452 void setGyrConverter(int p, int gyr, int curve, double amin, double amid, double amax)
1453 {
1454 setConverter(fGyr, p, gyr, curve, amin, amid, amax);
1455 }
1456
1468 void getAccConverter(int p, int& acc, int& curve, double& amin, double& amid, double& amax)
1469 {
1470 getConverter(fAcc, p, acc, curve, amin, amid, amax);
1471 }
1472
1484 void getGyrConverter(int p, int& gyr, int& curve, double& amin, double& amid, double& amax)
1485 {
1486 getConverter(fGyr, p, gyr, curve, amin, amid, amax);
1487 }
1488
1496 void propagateGyr(int gyr, double value)
1497 {
1498 for (size_t i = 0; i < fGyr[gyr].size(); i++) {
1499 fGyr[gyr][i]->update(value);
1500 }
1501 }
1502
1510 int getAccCount(int acc)
1511 {
1512 return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0;
1513 }
1514
1522 int getGyrCount(int gyr)
1523 {
1524 return (gyr >= 0 && gyr < 3) ? int(fGyr[gyr].size()) : 0;
1525 }
1526
1527 // getScreenColor() : -1 means no screen color control (no screencolor metadata found)
1528 // otherwise return 0x00RRGGBB a ready to use color
1530 {
1531 if (fHasScreenControl) {
1532 int r = (fRedReader) ? fRedReader->getValue() : 0;
1533 int g = (fGreenReader) ? fGreenReader->getValue() : 0;
1534 int b = (fBlueReader) ? fBlueReader->getValue() : 0;
1535 return (r<<16) | (g<<8) | b;
1536 } else {
1537 return -1;
1538 }
1539 }
1540
1541};
1542
1543#endif
1544/************************** END APIUI.h **************************/
1545
1546// NOTE: "faust -scn name" changes the last line above to
1547// #include <faust/name/name.h>
1548
1549//----------------------------------------------------------------------------
1550// FAUST Generated Code
1551//----------------------------------------------------------------------------
1552
1553
1554#ifndef FAUSTFLOAT
1555#define FAUSTFLOAT float
1556#endif
1557
1558#include <algorithm>
1559#include <cmath>
1560#include <math.h>
1561
1562
1563#ifndef FAUSTCLASS
1564#define FAUSTCLASS limiterdsp
1565#endif
1566
1567#ifdef __APPLE__
1568#define exp10f __exp10f
1569#define exp10 __exp10
1570#endif
1571
1572class limiterdsp : public dsp {
1573
1574 private:
1575
1576 int fSampleRate;
1577 float fConst0;
1578 float fConst1;
1579 float fConst2;
1580 float fConst3;
1581 int iRec5[2];
1582 FAUSTFLOAT fHslider0;
1583 int IOTA;
1584 float fVec0[32];
1585 float fRec4[2];
1586 int iRec2[2];
1587 float fRec1[2];
1588 float fConst4;
1589 float fConst5;
1590 float fRec0[2];
1591 int iConst6;
1592
1593 public:
1594
1595 void metadata(Meta* m) {
1596 m->declare("analyzers.lib/name", "Faust Analyzer Library");
1597 m->declare("analyzers.lib/version", "0.1");
1598 m->declare("basics.lib/name", "Faust Basic Element Library");
1599 m->declare("basics.lib/version", "0.1");
1600 m->declare("compressors.lib/limiter_lad_N:author", "Dario Sanfilippo");
1601 m->declare("compressors.lib/limiter_lad_N:copyright", "Copyright (C) 2020 Dario Sanfilippo <sanfilippo.dario@gmail.com>");
1602 m->declare("compressors.lib/limiter_lad_N:license", "GPLv3 license");
1603 m->declare("compressors.lib/limiter_lad_mono:author", "Dario Sanfilippo");
1604 m->declare("compressors.lib/limiter_lad_mono:copyright", "Copyright (C) 2020 Dario Sanfilippo <sanfilippo.dario@gmail.com>");
1605 m->declare("compressors.lib/limiter_lad_mono:license", "GPLv3 license");
1606 m->declare("compressors.lib/name", "Faust Compressor Effect Library");
1607 m->declare("compressors.lib/version", "0.0");
1608 m->declare("filename", "limiterdsp.dsp");
1609 m->declare("maths.lib/author", "GRAME");
1610 m->declare("maths.lib/copyright", "GRAME");
1611 m->declare("maths.lib/license", "LGPL with exception");
1612 m->declare("maths.lib/name", "Faust Math Library");
1613 m->declare("maths.lib/version", "2.3");
1614 m->declare("name", "limiterdsp");
1615 m->declare("platform.lib/name", "Generic Platform Library");
1616 m->declare("platform.lib/version", "0.1");
1617 m->declare("routes.lib/name", "Faust Signal Routing Library");
1618 m->declare("routes.lib/version", "0.2");
1619 m->declare("signals.lib/name", "Faust Signal Routing Library");
1620 m->declare("signals.lib/version", "0.0");
1621 }
1622
1623 virtual int getNumInputs() {
1624 return 1;
1625 }
1626 virtual int getNumOutputs() {
1627 return 1;
1628 }
1629 virtual int getInputRate(int channel) {
1630 int rate;
1631 switch ((channel)) {
1632 case 0: {
1633 rate = 1;
1634 break;
1635 }
1636 default: {
1637 rate = -1;
1638 break;
1639 }
1640 }
1641 return rate;
1642 }
1643 virtual int getOutputRate(int channel) {
1644 int rate;
1645 switch ((channel)) {
1646 case 0: {
1647 rate = 1;
1648 break;
1649 }
1650 default: {
1651 rate = -1;
1652 break;
1653 }
1654 }
1655 return rate;
1656 }
1657
1658 static void classInit(int sample_rate) {
1659 }
1660
1661 virtual void instanceConstants(int sample_rate) {
1662 fSampleRate = sample_rate;
1663 fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
1664 fConst1 = std::exp((0.0f - (100000.0f / fConst0)));
1665 fConst2 = (1.0f - fConst1);
1666 fConst3 = (0.100000001f * fConst0);
1667 fConst4 = std::exp((0.0f - (4.0f / fConst0)));
1668 fConst5 = (1.0f - fConst4);
1669 iConst6 = int((9.99999975e-05f * fConst0));
1670 }
1671
1673 fHslider0 = FAUSTFLOAT(2.0f);
1674 }
1675
1676 virtual void instanceClear() {
1677 for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
1678 iRec5[l0] = 0;
1679 }
1680 IOTA = 0;
1681 for (int l1 = 0; (l1 < 32); l1 = (l1 + 1)) {
1682 fVec0[l1] = 0.0f;
1683 }
1684 for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
1685 fRec4[l2] = 0.0f;
1686 }
1687 for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
1688 iRec2[l3] = 0;
1689 }
1690 for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
1691 fRec1[l4] = 0.0f;
1692 }
1693 for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
1694 fRec0[l5] = 0.0f;
1695 }
1696 }
1697
1698 virtual void init(int sample_rate) {
1699 classInit(sample_rate);
1700 instanceInit(sample_rate);
1701 }
1702 virtual void instanceInit(int sample_rate) {
1703 instanceConstants(sample_rate);
1705 instanceClear();
1706 }
1707
1708 virtual limiterdsp* clone() {
1709 return new limiterdsp();
1710 }
1711
1712 virtual int getSampleRate() {
1713 return fSampleRate;
1714 }
1715
1716 virtual void buildUserInterface(UI* ui_interface) {
1717 ui_interface->openVerticalBox("limiterdsp");
1718 ui_interface->declare(&fHslider0, "0", "");
1719 ui_interface->addHorizontalSlider("NumClientsAssumed", &fHslider0, 2.0f, 1.0f, 64.0f, 1.0f);
1720 ui_interface->closeBox();
1721 }
1722
1723 virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
1724 FAUSTFLOAT* input0 = inputs[0];
1725 FAUSTFLOAT* output0 = outputs[0];
1726 float fSlow0 = (1.0f / std::sqrt(float(fHslider0)));
1727 for (int i = 0; (i < count); i = (i + 1)) {
1728 float fTemp0 = float(input0[i]);
1729 iRec5[0] = ((iRec5[1] + 1) % int(std::max<float>(1.0f, (fConst3 * float(iRec2[1])))));
1730 float fTemp1 = (fSlow0 * fTemp0);
1731 fVec0[(IOTA & 31)] = fTemp1;
1732 float fTemp2 = std::fabs(fTemp1);
1733 fRec4[0] = std::max<float>((float((iRec5[0] > 0)) * fRec4[1]), fTemp2);
1734 iRec2[0] = (fRec4[0] >= fTemp2);
1735 float fRec3 = fRec4[0];
1736 fRec1[0] = ((fConst1 * fRec1[1]) + (fConst2 * fRec3));
1737 float fTemp3 = std::fabs(fRec1[0]);
1738 fRec0[0] = std::max<float>(fTemp3, ((fConst4 * fRec0[1]) + (fConst5 * fTemp3)));
1739 output0[i] = FAUSTFLOAT((std::min<float>(1.0f, (0.5f / std::max<float>(fRec0[0], 1.1920929e-07f))) * fVec0[((IOTA - iConst6) & 31)]));
1740 iRec5[1] = iRec5[0];
1741 IOTA = (IOTA + 1);
1742 fRec4[1] = fRec4[0];
1743 iRec2[1] = iRec2[0];
1744 fRec1[1] = fRec1[0];
1745 fRec0[1] = fRec0[0];
1746 }
1747 }
1748
1749};
1750
1751#endif
Definition: compressordsp.h:1031
std::string fCurrentAcc
Definition: compressordsp.h:1066
std::vector< FAUSTFLOAT > fMax
Definition: compressordsp.h:1049
void getGyrConverter(int p, int &gyr, int &curve, double &amin, double &amid, double &amax)
Definition: limiterdsp.h:1484
@ kExp
Definition: compressordsp.h:1038
@ kLin
Definition: compressordsp.h:1038
@ kLog
Definition: compressordsp.h:1038
void propagateAcc(int acc, double value)
Definition: limiterdsp.h:1418
int getGyrCount(int gyr)
Definition: limiterdsp.h:1522
int getParamsCount()
Definition: limiterdsp.h:1334
virtual void addButton(const char *label, FAUSTFLOAT *zone)
Definition: limiterdsp.h:1259
virtual void closeBox()
Definition: limiterdsp.h:1255
void setParamRatio(int p, double r)
Definition: limiterdsp.h:1371
FAUSTFLOAT getParamInit(int p)
Definition: limiterdsp.h:1364
std::map< std::string, int > fPathMap
Definition: compressordsp.h:1043
int getZoneIndex(std::vector< ZoneControl * > *table, int p, int val)
Definition: limiterdsp.h:1168
double getParamRatio(int p)
Definition: limiterdsp.h:1370
FAUSTFLOAT * getParamZone(int p)
Definition: limiterdsp.h:1366
ItemType getParamItemType(int p)
Definition: limiterdsp.h:1406
void getAccConverter(int p, int &acc, int &curve, double &amin, double &amid, double &amax)
Definition: limiterdsp.h:1468
int getParamIndex(const char *path)
Definition: limiterdsp.h:1335
std::vector< FAUSTFLOAT > fMin
Definition: compressordsp.h:1048
double value2ratio(int p, double r)
Definition: limiterdsp.h:1373
virtual void declare(const char *key, const char *val)
Definition: limiterdsp.h:1328
virtual void addParameter(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step, ItemType type)
Definition: limiterdsp.h:1070
virtual void addHorizontalSlider(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
Definition: limiterdsp.h:1274
ItemType
Definition: compressordsp.h:1034
@ kHBargraph
Definition: compressordsp.h:1034
@ kButton
Definition: compressordsp.h:1034
@ kVBargraph
Definition: compressordsp.h:1034
@ kCheckButton
Definition: compressordsp.h:1034
@ kHSlider
Definition: compressordsp.h:1034
@ kNumEntry
Definition: compressordsp.h:1034
@ kVSlider
Definition: compressordsp.h:1034
std::vector< ZoneControl * > fGyr[3]
Definition: compressordsp.h:1054
virtual void declare(FAUSTFLOAT *zone, const char *key, const char *val)
Definition: limiterdsp.h:1302
virtual void addCheckButton(const char *label, FAUSTFLOAT *zone)
Definition: limiterdsp.h:1264
std::vector< std::string > fPaths
Definition: compressordsp.h:1041
std::vector< FAUSTFLOAT > fInit
Definition: compressordsp.h:1047
virtual void addVerticalSlider(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
Definition: limiterdsp.h:1269
void getConverter(std::vector< ZoneControl * > *table, int p, int &val, int &curve, double &amin, double &amid, double &amax)
Definition: limiterdsp.h:1204
virtual void addHorizontalBargraph(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT min, FAUSTFLOAT max)
Definition: limiterdsp.h:1286
virtual void addNumEntry(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
Definition: limiterdsp.h:1279
std::vector< std::map< std::string, std::string > > fMetaData
Definition: compressordsp.h:1052
int fCurrentScale
Definition: compressordsp.h:1065
virtual ~APIUI()
Definition: limiterdsp.h:1238
std::vector< std::string > fLabels
Definition: compressordsp.h:1042
int fNumParameters
Definition: compressordsp.h:1040
std::map< const char *, const char * > getMetadata(int p)
Definition: limiterdsp.h:1347
std::vector< ItemType > fItemType
Definition: compressordsp.h:1051
Type
Definition: compressordsp.h:1236
@ kAcc
Definition: compressordsp.h:1236
@ kNoType
Definition: compressordsp.h:1236
@ kGyr
Definition: compressordsp.h:1236
std::string fCurrentColor
Definition: compressordsp.h:1068
ZoneReader * fGreenReader
Definition: compressordsp.h:1060
std::string fCurrentTooltip
Definition: compressordsp.h:1069
ZoneReader * fRedReader
Definition: compressordsp.h:1059
void setConverter(std::vector< ZoneControl * > *table, int p, int val, int curve, double amin, double amid, double amax)
Definition: limiterdsp.h:1177
int getAccCount(int acc)
Definition: limiterdsp.h:1510
void propagateGyr(int gyr, double value)
Definition: limiterdsp.h:1496
virtual void openVerticalBox(const char *label)
Definition: limiterdsp.h:1254
std::string fCurrentGyr
Definition: compressordsp.h:1067
void setParamValue(int p, FAUSTFLOAT v)
Definition: limiterdsp.h:1368
ZoneReader * fBlueReader
Definition: compressordsp.h:1061
FAUSTFLOAT getParamValue(int p)
Definition: limiterdsp.h:1367
virtual void openHorizontalBox(const char *label)
Definition: limiterdsp.h:1253
std::map< std::string, std::string > fCurrentMetadata
Definition: compressordsp.h:1070
void setGyrConverter(int p, int gyr, int curve, double amin, double amid, double amax)
Definition: limiterdsp.h:1452
std::string fCurrentUnit
Definition: compressordsp.h:1064
std::vector< ValueConverter * > fConversion
Definition: compressordsp.h:1045
APIUI()
Definition: limiterdsp.h:1235
std::vector< ZoneControl * > fAcc[3]
Definition: compressordsp.h:1053
FAUSTFLOAT getParamStep(int p)
Definition: limiterdsp.h:1363
virtual void addVerticalBargraph(const char *label, FAUSTFLOAT *zone, FAUSTFLOAT min, FAUSTFLOAT max)
Definition: limiterdsp.h:1291
std::map< std::string, int > fLabelMap
Definition: compressordsp.h:1044
virtual void openTabBox(const char *label)
Definition: limiterdsp.h:1252
double ratio2value(int p, double r)
Definition: limiterdsp.h:1374
const char * getParamLabel(int p)
Definition: limiterdsp.h:1346
FAUSTFLOAT getParamMin(int p)
Definition: limiterdsp.h:1361
const char * getParamAddress(int p)
Definition: limiterdsp.h:1345
std::vector< FAUSTFLOAT > fStep
Definition: compressordsp.h:1050
bool fHasScreenControl
Definition: compressordsp.h:1058
std::vector< FAUSTFLOAT * > fZone
Definition: compressordsp.h:1046
int getScreenColor()
Definition: limiterdsp.h:1529
FAUSTFLOAT getParamMax(int p)
Definition: limiterdsp.h:1362
Type getParamType(int p)
Definition: limiterdsp.h:1383
virtual void addSoundfile(const char *label, const char *filename, Soundfile **sf_zone)
Definition: limiterdsp.h:1298
void setAccConverter(int p, int acc, int curve, double amin, double amid, double amax)
Definition: limiterdsp.h:1436
const char * getMetadata(int p, const char *key)
Definition: limiterdsp.h:1357
Definition: compressordsp.h:802
AccDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:808
virtual double faust2ui(double x)
Definition: limiterdsp.h:814
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:823
virtual double ui2faust(double x)
Definition: limiterdsp.h:813
virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:816
Definition: compressordsp.h:872
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:893
virtual double faust2ui(double x)
Definition: limiterdsp.h:884
virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:886
virtual double ui2faust(double x)
Definition: limiterdsp.h:883
AccDownUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:878
Definition: compressordsp.h:766
virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:780
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:787
virtual double faust2ui(double x)
Definition: limiterdsp.h:778
AccUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:772
virtual double ui2faust(double x)
Definition: limiterdsp.h:777
Definition: compressordsp.h:837
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:858
AccUpDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:843
virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
Definition: limiterdsp.h:851
virtual double faust2ui(double x)
Definition: limiterdsp.h:849
virtual double ui2faust(double x)
Definition: limiterdsp.h:848
Definition: compressordsp.h:935
ValueConverter * getConverter()
Definition: limiterdsp.h:945
ConverterZoneControl(FAUSTFLOAT *zone, ValueConverter *converter)
Definition: limiterdsp.h:940
ValueConverter * fValueConverter
Definition: compressordsp.h:939
virtual void update(double v) const
Definition: limiterdsp.h:943
virtual ~ConverterZoneControl()
Definition: limiterdsp.h:941
Definition: compressordsp.h:957
void setActive(bool on_off)
Definition: limiterdsp.h:992
void update(double v) const
Definition: limiterdsp.h:979
void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max)
Definition: limiterdsp.h:981
void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:987
virtual ~CurveZoneControl()
Definition: limiterdsp.h:972
CurveZoneControl(FAUSTFLOAT *zone, int curve, double amin, double amid, double amax, double min, double init, double max)
Definition: limiterdsp.h:963
int getCurve()
Definition: limiterdsp.h:1000
Definition: compressordsp.h:748
ExpValueConverter(double umin, double umax, double fmin, double fmax)
Definition: limiterdsp.h:749
virtual double ui2faust(double x)
Definition: limiterdsp.h:753
virtual double faust2ui(double x)
Definition: limiterdsp.h:754
Definition: compressordsp.h:605
double operator()(double x)
Definition: limiterdsp.h:616
Interpolator3pt(double lo, double mi, double hi, double v1, double vm, double v2)
Definition: limiterdsp.h:612
void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:618
Definition: compressordsp.h:553
void getLowHigh(double &amin, double &amax)
Definition: limiterdsp.h:590
Interpolator(double lo, double hi, double v1, double v2)
Definition: limiterdsp.h:572
double operator()(double v)
Definition: limiterdsp.h:584
Definition: compressordsp.h:695
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:717
LinearValueConverter2(double amin, double amid, double amax, double min, double init, double max)
Definition: limiterdsp.h:701
virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max)
Definition: limiterdsp.h:711
virtual double faust2ui(double x)
Definition: limiterdsp.h:709
LinearValueConverter2()
Definition: limiterdsp.h:705
virtual double ui2faust(double x)
Definition: limiterdsp.h:708
Definition: compressordsp.h:671
virtual double faust2ui(double x)
Definition: limiterdsp.h:684
LinearValueConverter()
Definition: limiterdsp.h:681
virtual double ui2faust(double x)
Definition: limiterdsp.h:683
LinearValueConverter(double umin, double umax, double fmin, double fmax)
Definition: limiterdsp.h:677
Definition: compressordsp.h:731
virtual double ui2faust(double x)
Definition: limiterdsp.h:736
LogValueConverter(double umin, double umax, double fmin, double fmax)
Definition: limiterdsp.h:732
virtual double faust2ui(double x)
Definition: limiterdsp.h:737
Definition: compressordsp.h:431
PathBuilder()
Definition: limiterdsp.h:436
std::vector< std::string > fControlsLevel
Definition: compressordsp.h:435
void pushLabel(const std::string &label)
Definition: limiterdsp.h:457
std::string buildLabel(std::string label)
Definition: limiterdsp.h:451
void popLabel()
Definition: limiterdsp.h:458
virtual ~PathBuilder()
Definition: limiterdsp.h:437
std::string buildPath(const std::string &label)
Definition: limiterdsp.h:439
Definition: compressordsp.h:645
bool getActive()
Definition: limiterdsp.h:659
virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max)=0
virtual ~UpdatableValueConverter()
Definition: limiterdsp.h:652
UpdatableValueConverter()
Definition: limiterdsp.h:650
virtual void getMappingValues(double &amin, double &amid, double &amax)=0
void setActive(bool on_off)
Definition: limiterdsp.h:658
bool fActive
Definition: compressordsp.h:649
Definition: compressordsp.h:632
virtual ~ValueConverter()
Definition: limiterdsp.h:633
virtual double ui2faust(double x)=0
virtual double faust2ui(double x)=0
Definition: compressordsp.h:906
virtual int getCurve()
Definition: limiterdsp.h:924
ZoneControl(FAUSTFLOAT *zone)
Definition: limiterdsp.h:911
virtual void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max)
Definition: limiterdsp.h:916
virtual bool getActive()
Definition: limiterdsp.h:922
FAUSTFLOAT * fZone
Definition: compressordsp.h:910
virtual void getMappingValues(double &amin, double &amid, double &amax)
Definition: limiterdsp.h:917
virtual ~ZoneControl()
Definition: limiterdsp.h:912
virtual void update(double v) const
Definition: limiterdsp.h:914
virtual void setActive(bool on_off)
Definition: limiterdsp.h:921
FAUSTFLOAT * getZone()
Definition: limiterdsp.h:919
Definition: compressordsp.h:1007
int getValue()
Definition: limiterdsp.h:1017
ZoneReader(FAUSTFLOAT *zone, double lo, double hi)
Definition: limiterdsp.h:1013
virtual ~ZoneReader()
Definition: limiterdsp.h:1015
Definition: compressordsp.h:168
virtual decorator_dsp * clone()
Definition: limiterdsp.h:185
virtual void init(int sample_rate)
Definition: limiterdsp.h:180
virtual void buildUserInterface(UI *ui_interface)
Definition: limiterdsp.h:178
virtual void instanceConstants(int sample_rate)
Definition: limiterdsp.h:182
virtual void compute(int count, FAUSTFLOAT **inputs, FAUSTFLOAT **outputs)
Definition: limiterdsp.h:188
decorator_dsp(dsp *dsp=nullptr)
Definition: limiterdsp.h:173
virtual void instanceResetUserInterface()
Definition: limiterdsp.h:183
virtual int getNumOutputs()
Definition: limiterdsp.h:177
virtual void compute(double date_usec, int count, FAUSTFLOAT **inputs, FAUSTFLOAT **outputs)
Definition: limiterdsp.h:189
virtual void instanceInit(int sample_rate)
Definition: limiterdsp.h:181
virtual int getSampleRate()
Definition: limiterdsp.h:179
dsp * fDSP
Definition: compressordsp.h:172
virtual void instanceClear()
Definition: limiterdsp.h:184
virtual ~decorator_dsp()
Definition: limiterdsp.h:174
virtual int getNumInputs()
Definition: limiterdsp.h:176
virtual void metadata(Meta *m)
Definition: limiterdsp.h:186
Definition: compressordsp.h:200
virtual std::vector< std::string > getIncludePathnames()=0
virtual ~dsp_factory()
Definition: limiterdsp.h:202
virtual std::string getName()=0
virtual std::string getSHAKey()=0
virtual void setMemoryManager(dsp_memory_manager *manager)=0
virtual std::vector< std::string > getLibraryList()=0
virtual dsp * createDSPInstance()=0
virtual std::string getCompileOptions()=0
virtual std::string getDSPCode()=0
virtual dsp_memory_manager * getMemoryManager()=0
Definition: compressordsp.h:74
virtual int getNumOutputs()=0
virtual void init(int sample_rate)=0
virtual int getNumInputs()=0
virtual void instanceClear()=0
virtual void instanceConstants(int sample_rate)=0
virtual void instanceResetUserInterface()=0
virtual void compute(int count, FAUSTFLOAT **inputs, FAUSTFLOAT **outputs)=0
virtual dsp * clone()=0
virtual void compute(double, int count, FAUSTFLOAT **inputs, FAUSTFLOAT **outputs)
Definition: limiterdsp.h:157
virtual void instanceInit(int sample_rate)=0
virtual ~dsp()
Definition: limiterdsp.h:76
dsp()
Definition: limiterdsp.h:75
virtual void buildUserInterface(UI *ui_interface)=0
virtual int getSampleRate()=0
virtual void metadata(Meta *m)=0
Definition: limiterdsp.h:1572
virtual limiterdsp * clone()
Definition: limiterdsp.h:1708
virtual void instanceResetUserInterface()
Definition: limiterdsp.h:1672
virtual void instanceConstants(int sample_rate)
Definition: limiterdsp.h:1661
void metadata(Meta *m)
Definition: limiterdsp.h:1595
virtual void instanceInit(int sample_rate)
Definition: limiterdsp.h:1702
virtual int getOutputRate(int channel)
Definition: limiterdsp.h:1643
virtual int getNumInputs()
Definition: limiterdsp.h:1623
virtual void compute(int count, FAUSTFLOAT **inputs, FAUSTFLOAT **outputs)
Definition: limiterdsp.h:1723
virtual void buildUserInterface(UI *ui_interface)
Definition: limiterdsp.h:1716
virtual int getSampleRate()
Definition: limiterdsp.h:1712
virtual int getNumOutputs()
Definition: limiterdsp.h:1626
virtual int getInputRate(int channel)
Definition: limiterdsp.h:1629
virtual void init(int sample_rate)
Definition: limiterdsp.h:1698
virtual void instanceClear()
Definition: limiterdsp.h:1676
static void classInit(int sample_rate)
Definition: limiterdsp.h:1658
#define FAUSTFLOAT
Definition: limiterdsp.h:48
Definition: compressordsp.h:303
virtual void declare(const char *key, const char *value)=0
virtual ~Meta()
Definition: limiterdsp.h:301
Definition: compressordsp.h:387
virtual ~UI()
Definition: limiterdsp.h:386
UI()
Definition: limiterdsp.h:385
Definition: compressordsp.h:353
virtual void openVerticalBox(const char *label)=0
virtual void addNumEntry(const char *label, REAL *zone, REAL init, REAL min, REAL max, REAL step)=0
virtual void addSoundfile(const char *label, const char *filename, Soundfile **sf_zone)=0
virtual void addHorizontalBargraph(const char *label, REAL *zone, REAL min, REAL max)=0
virtual void addHorizontalSlider(const char *label, REAL *zone, REAL init, REAL min, REAL max, REAL step)=0
virtual void addCheckButton(const char *label, REAL *zone)=0
virtual void addVerticalBargraph(const char *label, REAL *zone, REAL min, REAL max)=0
UIReal()
Definition: limiterdsp.h:351
virtual void declare(REAL *zone, const char *key, const char *val)
Definition: limiterdsp.h:380
virtual void addButton(const char *label, REAL *zone)=0
virtual void openTabBox(const char *label)=0
virtual void closeBox()=0
virtual ~UIReal()
Definition: limiterdsp.h:352
virtual void openHorizontalBox(const char *label)=0
virtual void addVerticalSlider(const char *label, REAL *zone, REAL init, REAL min, REAL max, REAL step)=0
Definition: compressordsp.h:61
virtual ~dsp_memory_manager()
Definition: limiterdsp.h:60
virtual void destroy(void *ptr)=0
virtual void * allocate(size_t size)=0
#define FAUSTFLOAT
Definition: zitarevmonodsp.h:48