forked from supercollider/sc3-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHOABeamHCardioid2Hoa3.cpp
More file actions
1404 lines (1222 loc) · 63.6 KB
/
HOABeamHCardioid2Hoa3.cpp
File metadata and controls
1404 lines (1222 loc) · 63.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//----------------------------------------------------------
// name: "HOABeamHCardioid2Hoa3"
// version: "1.0"
// author: "Pierre Lecomte"
// license: "GPL"
// copyright: "(c) Pierre Lecomte 2016"
//
// Code generated with Faust 0.9.95 (http://faust.grame.fr)
//----------------------------------------------------------
/* link with */
#ifndef FAUSTPOWER
#define FAUSTPOWER
#include <cmath>
template <int N> inline int faustpower(int x) { return faustpower<N/2>(x) * faustpower<N-N/2>(x); }
template <> inline int faustpower<0>(int x) { return 1; }
template <> inline int faustpower<1>(int x) { return x; }
template <> inline int faustpower<2>(int x) { return x*x; }
template <int N> inline double faustpower(double x) { return faustpower<N/2>(x) * faustpower<N-N/2>(x); }
template <> inline double faustpower<0>(double x) { return 1; }
template <> inline double faustpower<1>(double x) { return x; }
template <> inline double faustpower<2>(double x) { return x*x; }
#endif
// If other than 'faust2sc --prefix Faust' is used, sed this as well:
#if !defined(SC_FAUST_PREFIX)
# define SC_FAUST_PREFIX "Faust"
#endif
//-------------------------------------------------------------------
// FAUST architecture file for SuperCollider.
// Copyright (C) 2005-2012 Stefan Kersten.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
// 02111-1307 USA
//-------------------------------------------------------------------
#include <map>
#include <string>
#include <string.h>
#include <SC_PlugIn.h>
/************************************************************************
IMPORTANT NOTE : this file contains two clearly delimited sections :
the ARCHITECTURE section (in two parts) and the USER section. Each section
is governed by its own copyright and license. Please check individually
each section for license and copyright information.
*************************************************************************/
/*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/
/************************************************************************
FAUST Architecture File
Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
************************************************************************
************************************************************************/
/******************************************************************************
*******************************************************************************
FAUST DSP
*******************************************************************************
*******************************************************************************/
#ifndef __dsp__
#define __dsp__
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
class UI;
struct Meta;
/**
* Signal processor definition.
*/
class dsp {
public:
dsp() {}
virtual ~dsp() {}
/* Return instance number of audio inputs */
virtual int getNumInputs() = 0;
/* Return instance number of audio outputs */
virtual int getNumOutputs() = 0;
/**
* Trigger the UI* parameter with instance specific calls
* to 'addBtton', 'addVerticalSlider'... in order to build the UI.
*
* @param ui_interface - the UI* user interface builder
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
/* Returns the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/** Global init, calls the following methods :
* - static class 'classInit' : static table initialisation
* - 'instanceInit' : constants and instance table initialisation
*
* @param samplingRate - the sampling rate in Herz
*/
virtual void init(int samplingRate) = 0;
/** Init instance state
*
* @param samplingRate - the sampling rate in Herz
*/
virtual void instanceInit(int samplingRate) = 0;
/** Init instance constant state
*
* @param samplingRate - the sampling rate in Herz
*/
virtual void instanceConstants(int samplingRate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
/* Init instance state (delay lines...) */
virtual void instanceClear() = 0;
/**
* Return a clone of the instance.
*
* @return a copy of the instance on success, otherwise a null pointer.
*/
virtual dsp* clone() = 0;
/**
* Trigger the Meta* parameter with instance specific calls to 'declare' (key, value metadata).
*
* @param m - the Meta* meta user
*/
virtual void metadata(Meta* m) = 0;
/**
* DSP instance computation, to be called with sucessive in/out audio buffers.
*
* @param count - the nomber of frames to compute
* @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, doucbe or quad)
* @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, doucbe or quad)
*
*/
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) = 0;
/**
* DSP instance computation : alternative method to be used by subclasses.
*
* @param date_usec - the timestamp in microsec given by audio driver.
* @param count - the nomber of frames to compute
* @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, doucbe or quad)
* @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, doucbe or quad)
*
*/
virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
};
/**
* Generic DSP decorator.
*/
class decorator_dsp : public dsp {
protected:
dsp* fDSP;
public:
decorator_dsp(dsp* dsp = 0):fDSP(dsp) {}
virtual ~decorator_dsp() { delete fDSP; }
virtual int getNumInputs() { return fDSP->getNumInputs(); }
virtual int getNumOutputs() { return fDSP->getNumOutputs(); }
virtual void buildUserInterface(UI* ui_interface) { fDSP->buildUserInterface(ui_interface); }
virtual int getSampleRate() { return fDSP->getSampleRate(); }
virtual void init(int samplingRate) { fDSP->init(samplingRate); }
virtual void instanceInit(int samplingRate) { fDSP->instanceInit(samplingRate); }
virtual void instanceConstants(int samplingRate) { fDSP->instanceConstants(samplingRate); }
virtual void instanceResetUserInterface() { fDSP->instanceResetUserInterface(); }
virtual void instanceClear() { fDSP->instanceClear(); }
virtual decorator_dsp* clone() { return new decorator_dsp(fDSP->clone()); }
virtual void metadata(Meta* m) { return fDSP->metadata(m); }
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(count, inputs, outputs); }
virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(date_usec, count, inputs, outputs); }
};
/**
* On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
* flags to avoid costly denormals.
*/
#ifdef __SSE__
#include <xmmintrin.h>
#ifdef __SSE2__
#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
#else
#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
#endif
#else
#define AVOIDDENORMALS
#endif
#endif
/************************************************************************
FAUST Architecture File
Copyright (C) 2003-2016 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
************************************************************************
************************************************************************/
#ifndef FAUST_UI_H
#define FAUST_UI_H
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
/*******************************************************************************
* UI : Faust User Interface
* This abstract class contains only the method that the faust compiler can
* generate to describe a DSP interface.
******************************************************************************/
class UI
{
public:
UI() {}
virtual ~UI() {}
// -- widget's layouts
virtual void openTabBox(const char* label) = 0;
virtual void openHorizontalBox(const char* label) = 0;
virtual void openVerticalBox(const char* label) = 0;
virtual void closeBox() = 0;
// -- active widgets
virtual void addButton(const char* label, FAUSTFLOAT* zone) = 0;
virtual void addCheckButton(const char* label, FAUSTFLOAT* zone) = 0;
virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) = 0;
virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) = 0;
virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step) = 0;
// -- passive widgets
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) = 0;
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) = 0;
// -- metadata declarations
virtual void declare(FAUSTFLOAT*, const char*, const char*) {}
};
//----------------------------------------------------------------
// Generic decorator
//----------------------------------------------------------------
class DecoratorUI : public UI
{
protected:
UI* fUI;
public:
DecoratorUI(UI* ui = 0):fUI(ui)
{}
virtual ~DecoratorUI() { delete fUI; }
// -- widget's layouts
virtual void openTabBox(const char* label) { fUI->openTabBox(label); }
virtual void openHorizontalBox(const char* label) { fUI->openHorizontalBox(label); }
virtual void openVerticalBox(const char* label) { fUI->openVerticalBox(label); }
virtual void closeBox() { fUI->closeBox(); }
// -- active widgets
virtual void addButton(const char* label, FAUSTFLOAT* zone) { fUI->addButton(label, zone); }
virtual void addCheckButton(const char* label, FAUSTFLOAT* zone) { fUI->addCheckButton(label, zone); }
virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ fUI->addVerticalSlider(label, zone, init, min, max, step); }
virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ fUI->addHorizontalSlider(label, zone, init, min, max, step); }
virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ fUI->addNumEntry(label, zone, init, min, max, step); }
// -- passive widgets
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
{ fUI->addHorizontalBargraph(label, zone, min, max); }
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
{ fUI->addVerticalBargraph(label, zone, min, max); }
virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val) { fUI->declare(zone, key, val); }
};
#endif
/************************************************************************
************************************************************************
FAUST Architecture File
Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
************************************************************************
************************************************************************/
#ifndef __misc__
#define __misc__
#include <algorithm>
#include <map>
#include <string.h>
#include <stdlib.h>
/************************************************************************
************************************************************************
FAUST Architecture File
Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
************************************************************************
************************************************************************/
#ifndef __meta__
#define __meta__
struct Meta
{
virtual void declare(const char* key, const char* value) = 0;
virtual ~Meta() {};
};
#endif
using std::max;
using std::min;
struct XXXX_Meta : std::map<const char*, const char*>
{
void declare(const char* key, const char* value) { (*this)[key]=value; }
};
struct MY_Meta : Meta, std::map<const char*, const char*>
{
void declare(const char* key, const char* value) { (*this)[key]=value; }
};
inline int lsr(int x, int n) { return int(((unsigned int)x) >> n); }
inline int int2pow2(int x) { int r = 0; while ((1<<r) < x) r++; return r; }
inline long lopt(char* argv[], const char* name, long def)
{
int i;
for (i = 0; argv[i]; i++) if (!strcmp(argv[i], name)) return atoi(argv[i+1]);
return def;
}
inline bool isopt(char* argv[], const char* name)
{
int i;
for (i = 0; argv[i]; i++) if (!strcmp(argv[i], name)) return true;
return false;
}
inline const char* lopts(char* argv[], const char* name, const char* def)
{
int i;
for (i = 0; argv[i]; i++) if (!strcmp(argv[i], name)) return argv[i+1];
return def;
}
#endif
using namespace std;
#if defined(__GNUC__) && __GNUC__ >= 4
# define FAUST_EXPORT __attribute__((visibility("default")))
#else
# define FAUST_EXPORT SC_API_EXPORT
#endif
//----------------------------------------------------------------------------
// Vector intrinsics
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Metadata
//----------------------------------------------------------------------------
class MetaData : public Meta
, public std::map<std::string, std::string>
{
public:
void declare(const char* key, const char* value)
{
(*this)[key] = value;
}
};
//----------------------------------------------------------------------------
// Control counter
//----------------------------------------------------------------------------
class ControlCounter : public UI
{
public:
ControlCounter()
: mNumControlInputs(0),
mNumControlOutputs(0)
{ }
size_t getNumControls() const { return getNumControlInputs(); }
size_t getNumControlInputs() const { return mNumControlInputs; }
size_t getNumControlOutputs() const { return mNumControlOutputs; }
// Layout widgets
virtual void openTabBox(const char* label) { }
virtual void openHorizontalBox(const char* label) { }
virtual void openVerticalBox(const char* label) { }
virtual void closeBox() { }
// Active widgets
virtual void addButton(const char* label, FAUSTFLOAT* zone)
{ addControlInput(); }
virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
{ addControlInput(); }
virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addControlInput(); }
virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addControlInput(); }
virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addControlInput(); }
// Passive widgets
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
{ addControlOutput(); }
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
{ addControlOutput(); }
protected:
void addControlInput() { mNumControlInputs++; }
void addControlOutput() { mNumControlOutputs++; }
private:
size_t mNumControlInputs;
size_t mNumControlOutputs;
};
//----------------------------------------------------------------------------
// UI control
//----------------------------------------------------------------------------
struct Control
{
typedef void (*UpdateFunction)(Control* self, FAUSTFLOAT value);
UpdateFunction updateFunction;
FAUSTFLOAT* zone;
FAUSTFLOAT min, max;
inline void update(FAUSTFLOAT value)
{
(*updateFunction)(this, value);
}
static void simpleUpdate(Control* self, FAUSTFLOAT value)
{
*self->zone = value;
}
static void boundedUpdate(Control* self, FAUSTFLOAT value)
{
*self->zone = sc_clip(value, self->min, self->max);
}
};
//----------------------------------------------------------------------------
// Control allocator
//----------------------------------------------------------------------------
class ControlAllocator : public UI
{
public:
ControlAllocator(Control* controls)
: mControls(controls)
{ }
// Layout widgets
virtual void openTabBox(const char* label) { }
virtual void openHorizontalBox(const char* label) { }
virtual void openVerticalBox(const char* label) { }
virtual void closeBox() { }
// Active widgets
virtual void addButton(const char* label, FAUSTFLOAT* zone)
{ addSimpleControl(zone); }
virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
{ addSimpleControl(zone); }
virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addBoundedControl(zone, min, max, step); }
virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addBoundedControl(zone, min, max, step); }
virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{ addBoundedControl(zone, min, max, step); }
// Passive widgets
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) { }
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max) { }
private:
void addControl(Control::UpdateFunction updateFunction, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT /* step */)
{
Control* ctrl = mControls++;
ctrl->updateFunction = updateFunction;
ctrl->zone = zone;
ctrl->min = min;
ctrl->max = max;
}
void addSimpleControl(FAUSTFLOAT* zone)
{
addControl(Control::simpleUpdate, zone, 0.f, 0.f, 0.f);
}
void addBoundedControl(FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
{
addControl(Control::boundedUpdate, zone, min, max, step);
}
private:
Control* mControls;
};
//----------------------------------------------------------------------------
// FAUST generated code
//----------------------------------------------------------------------------
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
#ifndef FAUSTCLASS
#define FAUSTCLASS mydsp
#endif
class mydsp : public dsp {
private:
FAUSTFLOAT fslider0;
FAUSTFLOAT fslider1;
FAUSTFLOAT fslider2;
int fSamplingFreq;
public:
virtual void metadata(Meta* m) {
m->declare("route.lib/name", "Faust Signal Routing Library");
m->declare("route.lib/version", "0.0");
m->declare("basic.lib/name", "Faust Basic Element Library");
m->declare("basic.lib/version", "0.0");
m->declare("name", "HOABeamHCardioid2Hoa3");
m->declare("version", "1.0");
m->declare("author", "Pierre Lecomte");
m->declare("license", "GPL");
m->declare("copyright", "(c) Pierre Lecomte 2016");
m->declare("math.lib/name", "Faust Math Library");
m->declare("math.lib/version", "2.0");
m->declare("math.lib/author", "GRAME");
m->declare("math.lib/copyright", "GRAME");
m->declare("math.lib/license", "LGPL with exception");
m->declare("lib/ymn.lib/name", "Spherical Harmonics library");
m->declare("lib/ymn.lib/version", "1.0");
m->declare("lib/ymn.lib/author", "Pierre Lecomte");
m->declare("lib/ymn.lib/license", "GPL");
m->declare("lib/ymn.lib/copyright", "(c) Pierre Lecomte 2016");
m->declare("lib/cijk.lib/name", "Cijk matrix");
m->declare("lib/cijk.lib/version", "10");
m->declare("lib/cijk.lib/author", "Pierre Lecomte");
m->declare("lib/cijk.lib/license", "GPL");
m->declare("lib/cijk.lib/copyright", "(c) Pierre Lecomte 2016");
m->declare("lib/gui.lib/name", "GUI Library");
m->declare("lib/gui.lib/version", "1.0");
m->declare("lib/gui.lib/author", "Pierre Lecomte");
m->declare("lib/gui.lib/license", "GPL");
m->declare("lib/gui.lib/copyright", "(c) Pierre Lecomte 2016");
m->declare("signal.lib/name", "Faust Signal Routing Library");
m->declare("signal.lib/version", "0.0");
}
virtual int getNumInputs() { return 16; }
virtual int getNumOutputs() { return 36; }
static void classInit(int samplingFreq) {
}
virtual void instanceConstants(int samplingFreq) {
fSamplingFreq = samplingFreq;
}
virtual void instanceResetUserInterface() {
fslider0 = 0.0;
fslider1 = 0.0;
fslider2 = 0.0;
}
virtual void instanceClear() {
}
virtual void init(int samplingFreq) {
classInit(samplingFreq);
instanceInit(samplingFreq);
}
virtual void instanceInit(int samplingFreq) {
instanceConstants(samplingFreq);
instanceResetUserInterface();
instanceClear();
}
virtual mydsp* clone() {
return new mydsp();
}
virtual int getSampleRate() {
return fSamplingFreq;
}
virtual void buildUserInterface(UI* ui_interface) {
ui_interface->declare(0, "3", "");
ui_interface->openHorizontalBox("Parameters");
ui_interface->declare(&fslider2, "style", "knob");
ui_interface->addHorizontalSlider("Azimuth", &fslider2, 0.0, -1.5707963267948966, 1.5707963267948966, 0.1);
ui_interface->declare(&fslider1, "style", "knob");
ui_interface->addHorizontalSlider("Elevation", &fslider1, 0.0, -1.5707963267948966, 1.5707963267948966, 0.1);
ui_interface->declare(&fslider0, "style", "knob");
ui_interface->addHorizontalSlider("Order", &fslider0, 0.0, 0.0, 2.0, 1.0);
ui_interface->closeBox();
}
virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
int iSlow0 = int(double(fslider0));
int iSlow1 = int((iSlow0 >= 2));
double fSlow2 = double(fslider1);
double fSlow3 = sin(fSlow2);
double fSlow4 = cos(fSlow2);
double fSlow5 = double(fslider2);
double fSlow6 = cos(fSlow5);
double fSlow7 = sin(fSlow5);
double fSlow8 = ((3 * faustpower<2>(fSlow3)) + -1);
double fSlow9 = (0.124224 * fSlow8);
double fSlow10 = sin((2 * fSlow2));
double fSlow11 = faustpower<2>(fSlow4);
double fSlow12 = (2 * fSlow5);
double fSlow13 = cos(fSlow12);
double fSlow14 = sin(fSlow12);
int iSlow15 = int((iSlow0 >= 1));
double fSlow16 = (0.14907119265000002 * fSlow6);
double fSlow17 = (0.17251367312221164 * fSlow13);
double fSlow18 = (0.16666405622891672 * fSlow14);
double fSlow19 = (fSlow11 * fSlow14);
double fSlow20 = (0 - (0.17251367312221164 * fSlow19));
double fSlow21 = (fSlow10 * fSlow7);
double fSlow22 = (0 - (0.14085684693651698 * fSlow21));
double fSlow23 = (0 - (0.044542895106113686 * fSlow19));
double fSlow24 = (0 - (0.10910728580834947 * fSlow21));
double fSlow25 = (0.08908562668799999 * fSlow8);
double fSlow26 = (fSlow11 * fSlow13);
double fSlow27 = (0.044542895106113686 * fSlow26);
double fSlow28 = (fSlow25 + fSlow27);
double fSlow29 = (fSlow4 * fSlow7);
double fSlow30 = (0 - (0.14907119265000002 * fSlow29));
double fSlow31 = (0.19245000000000004 * fSlow4);
double fSlow32 = (0.16666405622891672 * fSlow10);
double fSlow33 = (0.055554711936 * fSlow8);
double fSlow34 = (0.16666405622891672 * fSlow26);
double fSlow35 = (0.11112 - (fSlow33 + fSlow34));
double fSlow36 = (0.14907119265000002 * fSlow3);
double fSlow37 = (0 - (0.08606633430000002 * fSlow29));
double fSlow38 = (fSlow10 * fSlow6);
double fSlow39 = (0.14085684693651698 * fSlow38);
double fSlow40 = (0.43301700000000004 * fSlow7);
double fSlow41 = (0.335413669149 * fSlow6);
double fSlow42 = (0.335413669149 * fSlow3);
double fSlow43 = (0 - (0.193651264638 * fSlow29));
double fSlow44 = (0 - (0.335413669149 * fSlow29));
double fSlow45 = (0.14085684693651698 * fSlow4);
double fSlow46 = ((0.111109299648 * fSlow8) + 0.11112);
double fSlow47 = (0.10910718143999999 * fSlow8);
double fSlow48 = (0.335413669149 * fSlow4);
double fSlow49 = (0.19245000000000004 * fSlow6);
double fSlow50 = (0.14907119265000002 * fSlow7);
double fSlow51 = (0.14085684693651698 * fSlow10);
double fSlow52 = (fSlow25 - fSlow27);
double fSlow53 = (0 - (0.10910728580834947 * fSlow38));
double fSlow54 = (0.14907119265000002 * fSlow4);
double fSlow55 = (fSlow4 * fSlow6);
double fSlow56 = (0 - (0.08606633430000002 * fSlow55));
double fSlow57 = (fSlow34 + (0.11112 - fSlow33));
double fSlow58 = (0 - (0.193651264638 * fSlow55));
double fSlow59 = (0.335413669149 * fSlow7);
double fSlow60 = (fSlow4 * fSlow14);
double fSlow61 = (0.2151622795194362 * fSlow60);
double fSlow62 = (0.15430333080000003 * fSlow6);
double fSlow63 = (0 - (0.15430333080000003 * fSlow29));
double fSlow64 = (0 - (0.03984099900000001 * fSlow29));
double fSlow65 = (0.11904563149935221 * fSlow10);
double fSlow66 = (0 - (0.13746223165253885 * fSlow19));
double fSlow67 = (0.079363856448 * fSlow8);
double fSlow68 = (0.11112 - fSlow67);
double fSlow69 = (0.1259881623 * fSlow3);
double fSlow70 = (0 - (0.03984099900000001 * fSlow55));
double fSlow71 = (0.347186102328 * fSlow6);
double fSlow72 = (0.28347631111800004 * fSlow3);
double fSlow73 = (0 - (0.08964317934 * fSlow55));
double fSlow74 = (0 - (0.08964317934 * fSlow29));
double fSlow75 = (0 - (0.347186102328 * fSlow29));
double fSlow76 = (0 - (0.11904563149935221 * fSlow21));
double fSlow77 = (0.11904563149935221 * fSlow6);
double fSlow78 = (0.06873100824512966 * fSlow7);
double fSlow79 = (0.2151622795194362 * fSlow10);
double fSlow80 = (0.039681866111999996 * fSlow8);
double fSlow81 = (0.11904563149935221 * fSlow26);
double fSlow82 = (fSlow80 + (0.11112 - fSlow81));
double fSlow83 = (0.11904563149935221 * fSlow60);
double fSlow84 = (0.1259881623 * fSlow6);
double fSlow85 = (0 - (0.09759004785000003 * fSlow29));
double fSlow86 = (0 - (0.1259881623 * fSlow29));
double fSlow87 = (0.28347631111800004 * fSlow55);
double fSlow88 = (0.35857228434300004 * fSlow3);
double fSlow89 = (0 - (0.219579889581 * fSlow29));
double fSlow90 = (0 - (0.28347631111800004 * fSlow29));
double fSlow91 = (0.06873100824512966 * fSlow10);
double fSlow92 = (0 - (0.13746223165253885 * fSlow26));
double fSlow93 = (fSlow67 + 0.11112);
double fSlow94 = (0.13801301565000001 * fSlow4);
double fSlow95 = (0.31053251232900003 * fSlow4);
double fSlow96 = (0.1259881623 * fSlow4);
double fSlow97 = ((fSlow80 + fSlow81) + 0.11112);
double fSlow98 = (0 - (0.09759004785000003 * fSlow55));
double fSlow99 = (0.28347631111800004 * fSlow4);
double fSlow100 = (0 - (0.219579889581 * fSlow55));
double fSlow101 = (fSlow4 * fSlow13);
double fSlow102 = (0.2151622795194362 * fSlow101);
double fSlow103 = (0.15430333080000003 * fSlow4);
double fSlow104 = (0.17251367312221164 * fSlow4);
double fSlow105 = (0.11340041877160077 * fSlow10);
double fSlow106 = (0 - (0.07172068811905223 * fSlow19));
double fSlow107 = (0.11112 - (0.09259110374400001 * fSlow8));
double fSlow108 = (0 - (0.07172068811905223 * fSlow26));
double fSlow109 = (0.347186102328 * fSlow4);
double fSlow110 = (0 - (0.14344159140038398 * fSlow19));
double fSlow111 = (0.0878395702892508 * fSlow7);
double fSlow112 = (0 - (0.11340041877160077 * fSlow21));
double fSlow113 = (0.1781713652621752 * fSlow10);
double fSlow114 = (0.15936380355000002 * fSlow3);
double fSlow115 = (0.11110937081927783 * fSlow26);
double fSlow116 = (fSlow33 + (0.11112 - fSlow115));
double fSlow117 = (0 - (0.0878395702892508 * fSlow21));
double fSlow118 = (0.0878395702892508 * fSlow6);
double fSlow119 = (0.04536029660600802 * fSlow7);
double fSlow120 = (0.16903075950000004 * fSlow3);
double fSlow121 = ((0.07407290784 * fSlow8) + 0.11112);
double fSlow122 = (0.04536029660600802 * fSlow10);
double fSlow123 = (0 - (0.14344159140038398 * fSlow26));
double fSlow124 = (0.38032316127 * fSlow3);
double fSlow125 = (0.11110937081927783 * fSlow19);
double fSlow126 = (0.04536029660600802 * fSlow6);
double fSlow127 = ((fSlow33 + fSlow115) + 0.11112);
double fSlow128 = (0.31053251232900003 * fSlow55);
double fSlow129 = (0.11340041877160077 * fSlow7);
double fSlow130 = (0.07172068811905223 * fSlow14);
double fSlow131 = (0.11340041877160077 * fSlow38);
double fSlow132 = (0.347186102328 * fSlow55);
double fSlow133 = (0.18184526118496958 * fSlow4);
double fSlow134 = (0.353557081449 * fSlow4);
double fSlow135 = (0.11111100750000003 * fSlow3);
double fSlow136 = (0.13608274215000005 * fSlow4);
double fSlow137 = (0.25000236495 * fSlow3);
double fSlow138 = (0.30618935181900003 * fSlow4);
double fSlow139 = (0.02969561235 * fSlow7);
double fSlow140 = (0.13746223165253885 * fSlow10);
double fSlow141 = (0.14547853605000002 * fSlow3);
double fSlow142 = (0.068731027392 * fSlow8);
double fSlow143 = (0 - (0.02969561235 * fSlow55));
double fSlow144 = (0 - (0.066815822151 * fSlow55));
double fSlow145 = (0.327330107793 * fSlow3);
double fSlow146 = (0.066815822151 * fSlow7);
double fSlow147 = (0.16264988730000002 * fSlow3);
double fSlow148 = (0 - (0.048600210211011685 * fSlow38));
double fSlow149 = (0.097200435264 * fSlow8);
double fSlow150 = (0.048600210211011685 * fSlow26);
double fSlow151 = (fSlow149 + fSlow150);
double fSlow152 = (0 - (0.048600210211011685 * fSlow19));
double fSlow153 = (0 - (0.05143437945000002 * fSlow55));
double fSlow154 = (0.365966049618 * fSlow3);
double fSlow155 = (0 - (0.11572855643700003 * fSlow55));
double fSlow156 = (0 - (0.10286875890000004 * fSlow29));
double fSlow157 = (0.030737437765308104 * fSlow11);
double fSlow158 = (0 - (0.12294996622351191 * fSlow38));
double fSlow159 = (0 - (0.12294996622351191 * fSlow21));
double fSlow160 = (0.10647773203199999 * fSlow8);
double fSlow161 = (0.16798421640000002 * fSlow3);
double fSlow162 = (0 - (0.10286875890000004 * fSlow55));
double fSlow163 = (0 - (0.23145711287400006 * fSlow29));
double fSlow164 = (0.377968414824 * fSlow3);
double fSlow165 = (0 - (0.23145711287400006 * fSlow55));
double fSlow166 = (0 - (0.05143437945000002 * fSlow29));
double fSlow167 = (fSlow149 - fSlow150);
double fSlow168 = (0 - (0.048600210211011685 * fSlow21));
double fSlow169 = (0.1328032017 * fSlow4);
double fSlow170 = (0.16835609239505758 * fSlow10);
double fSlow171 = (0.29881030912199996 * fSlow55);
double fSlow172 = (0 - (0.11572855643700003 * fSlow29));
double fSlow173 = (0 - (0.11501081430000001 * fSlow29));
double fSlow174 = (0 - (0.02969561235 * fSlow29));
double fSlow175 = (0 - (0.13746223165253885 * fSlow21));
double fSlow176 = (0.11501081430000001 * fSlow4);
double fSlow177 = (0 - (0.25877702143799997 * fSlow29));
double fSlow178 = (0 - (0.066815822151 * fSlow29));
double fSlow179 = (0.25877702143799997 * fSlow55);
double fSlow180 = (0 - (0.13608274215000005 * fSlow29));
double fSlow181 = (0 - (0.12858399051272834 * fSlow19));
double fSlow182 = (0 - (0.12858399051272834 * fSlow21));
double fSlow183 = (0.13608274215000005 * fSlow55);
double fSlow184 = (0 - (0.30618935181900003 * fSlow29));
double fSlow185 = (0.30618935181900003 * fSlow55);
double fSlow186 = (0.18184526118496958 * fSlow101);
double fSlow187 = (0.15713484765000002 * fSlow6);
double fSlow188 = (0 - (0.18184526118496958 * fSlow19));
double fSlow189 = (0 - (0.15713484765000002 * fSlow29));
double fSlow190 = (0 - (0.353557081449 * fSlow29));
double fSlow191 = (0.353557081449 * fSlow55);
double fSlow192 = (0.18727466614636304 * fSlow11);
double fSlow193 = (0.14506240885200392 * fSlow11);
double fSlow194 = (0.11844296195441828 * fSlow10);
double fSlow195 = (0.055834588607999995 * fSlow8);
double fSlow196 = (0.1367661816782935 * fSlow10);
double fSlow197 = (0.10812313354182758 * fSlow11);
double fSlow198 = (0 - (0.034191437838433605 * fSlow38));
double fSlow199 = (0.0837518208 * fSlow8);
double fSlow200 = (0.10812313354182758 * fSlow19);
double fSlow201 = (0.034191437838433605 * fSlow7);
double fSlow202 = (0 - (0.012923184413636137 * fSlow19));
double fSlow203 = (0.012923184413636137 * fSlow26);
double fSlow204 = (0 - (0.0633104249371965 * fSlow38));
double fSlow205 = (0.100102556352 * fSlow8);
double fSlow206 = (0.05005126462409077 * fSlow26);
double fSlow207 = (fSlow205 + fSlow206);
double fSlow208 = (0 - (0.05005126462409077 * fSlow19));
double fSlow209 = (0.04086663239824459 * fSlow11);
double fSlow210 = (0 - (0.12923184413636135 * fSlow38));
double fSlow211 = (0 - (0.12923184413636135 * fSlow21));
double fSlow212 = (0.10551735628799999 * fSlow8);
double fSlow213 = (fSlow205 - fSlow206);
double fSlow214 = (0 - (0.0633104249371965 * fSlow21));
double fSlow215 = (0.1634667447552579 * fSlow38);
double fSlow216 = (0.012923184413636137 * fSlow11);
double fSlow217 = (0.10812313354182758 * fSlow26);
double fSlow218 = (0 - (0.13242313106619366 * fSlow21));
double fSlow219 = (0 - (0.034191437838433605 * fSlow21));
double fSlow220 = (0.13242313106619366 * fSlow38);
double fSlow221 = (0 - fSlow200);
double fSlow222 = (0 - (0.1367661816782935 * fSlow21));
double fSlow223 = (0.1367661816782935 * fSlow38);
double fSlow224 = (0 - (0.14506240885200392 * fSlow19));
double fSlow225 = (0 - (0.11844296195441828 * fSlow21));
double fSlow226 = (0.11844296195441828 * fSlow38);
double fSlow227 = (0.14506240885200392 * fSlow26);
double fSlow228 = (0 - (0.18727466614636304 * fSlow19));
double fSlow229 = (0.18727466614636304 * fSlow26);
FAUSTFLOAT* input0 = input[0];
FAUSTFLOAT* input1 = input[1];
FAUSTFLOAT* input2 = input[2];
FAUSTFLOAT* input3 = input[3];
FAUSTFLOAT* input4 = input[4];
FAUSTFLOAT* input5 = input[5];
FAUSTFLOAT* input6 = input[6];
FAUSTFLOAT* input7 = input[7];
FAUSTFLOAT* input8 = input[8];
FAUSTFLOAT* input9 = input[9];
FAUSTFLOAT* input10 = input[10];
FAUSTFLOAT* input11 = input[11];
FAUSTFLOAT* input12 = input[12];
FAUSTFLOAT* input13 = input[13];
FAUSTFLOAT* input14 = input[14];
FAUSTFLOAT* input15 = input[15];
FAUSTFLOAT* output0 = output[0];
FAUSTFLOAT* output1 = output[1];
FAUSTFLOAT* output2 = output[2];
FAUSTFLOAT* output3 = output[3];
FAUSTFLOAT* output4 = output[4];
FAUSTFLOAT* output5 = output[5];
FAUSTFLOAT* output6 = output[6];
FAUSTFLOAT* output7 = output[7];
FAUSTFLOAT* output8 = output[8];
FAUSTFLOAT* output9 = output[9];
FAUSTFLOAT* output10 = output[10];
FAUSTFLOAT* output11 = output[11];
FAUSTFLOAT* output12 = output[12];
FAUSTFLOAT* output13 = output[13];
FAUSTFLOAT* output14 = output[14];
FAUSTFLOAT* output15 = output[15];
FAUSTFLOAT* output16 = output[16];
FAUSTFLOAT* output17 = output[17];
FAUSTFLOAT* output18 = output[18];
FAUSTFLOAT* output19 = output[19];
FAUSTFLOAT* output20 = output[20];
FAUSTFLOAT* output21 = output[21];
FAUSTFLOAT* output22 = output[22];
FAUSTFLOAT* output23 = output[23];
FAUSTFLOAT* output24 = output[24];
FAUSTFLOAT* output25 = output[25];
FAUSTFLOAT* output26 = output[26];
FAUSTFLOAT* output27 = output[27];
FAUSTFLOAT* output28 = output[28];
FAUSTFLOAT* output29 = output[29];
FAUSTFLOAT* output30 = output[30];
FAUSTFLOAT* output31 = output[31];
FAUSTFLOAT* output32 = output[32];
FAUSTFLOAT* output33 = output[33];
FAUSTFLOAT* output34 = output[34];
FAUSTFLOAT* output35 = output[35];
for (int i=0; i<count; i++) {