forked from s-e-a-m/faust-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardware.lib
196 lines (181 loc) · 8.03 KB
/
hardware.lib
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
//############################################################# hardware.lib ###
//
// A library for real word hardware connection. Its official prefix is `ha`.
//
// * AUDIO INTERFACE
// * MIDI
// *
// *
// *
//
//##############################################################################
/*******************************************************************************
Except where noted otherwise, Copyright (C) 2019-2020 by SEAM
GRAME LICENSE
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA.
EXCEPTION TO THE LGPL LICENSE : As a special exception, you may create a larger
FAUST program which directly or indirectly imports this library file and still
distribute the compiled code generated by the FAUST compiler, or a modified
version of this compiled code, under your own copyright and license. This
EXCEPTION TO THE LGPL LICENSE explicitly grants you the right to freely choose
the license for the resulting compiled code. In particular the resulting compiled
code has no obligation to be LGPL or GPL. For example you are free to choose a
commercial or closed source license or any other license if you decide so.
*******************************************************************************/
declare name "Faust Hardware Interface Library";
declare version "0.1";
declare author "Giuseppe Silvi";
declare license "CC4";
// da studiare per outsel
//selectoutn(n, s) = _ <: par(i, n, *(s==i));
//========================================================== AUDIO INTERFACE ===
//==============================================================================
//--------------------------------------- RME FireFace 800 - MONO INPUT SELECTOR
//-------------------------------------------------------------------- 18 INPUTS
ff800 = ba.selectn(18,channel) : shmeter
with{
channel = nentry("[01] RME FF800 - INPUT SELECTOR
[style:menu{
'Analog IN 1':0;
'Analog IN 2':1;
'Analog IN 3':2;
'Analog IN 4':3;
'Analog IN 5':4;
'Analog IN 6':5;
'Analog IN 7':6;
'Analog IN 8':7;
'Analog IN 9':8;
'Analog IN 10':9;
'ADAT IN 1':10;
'ADAT IN 2':11;
'ADAT IN 3':12;
'ADAT IN 4':13;
'ADAT IN 5':14;
'ADAT IN 6':15;
'ADAT IN 7':16;
'ADAT IN 8':17
}]", 0, 0, 18, 1) : int;
};
//------------------------------------- RME FireFace 800 - STEREO INPUT SELECTOR
//-------------------------------------------------------------------- 18 INPUTS
ff800_ST = si.bus(18) <: ba.selectn(18,lchannel),
ba.selectn(18,rchannel) : shmeter, shmeter
with{
rchannel = lchannel+(1);
lchannel = nentry("[01] RME FF800 - INPUT SELECTOR
[style:menu{
'Analog IN 1-2':0;
'Analog IN 3-4':2;
'Analog IN 5-6':4;
'Analog IN 7-8':6;
'Analog IN 9-10':8;
'ADAT IN 1-2':10;
'ADAT IN 3-4':12;
'ADAT IN 5-6':14;
'ADAT IN 7-8':16
}]", 0, 0, 18, 1) : int;
};
//--------------------------------------- RME FireFace 800 - WXYZ INPUT SELECTOR
//-------------------------------------------------------------------- 18 INPUTS
ff800_WXYZ = si.bus(18) <:
ba.selectn(18,wchannel), ba.selectn(18,xchannel), ba.selectn(18,ychannel),
ba.selectn(18,zchannel) : shmeter, shmeter, shmeter, shmeter
with{
zchannel = ychannel+(1);
ychannel = xchannel+(1);
xchannel = wchannel+(1);
wchannel = nentry("[01] RME FF800 - INPUT SELECTOR
[style:menu{
'Analog IN 1-2-3-4':0;
'Analog IN 5-6-7-8':4;
'ADAT IN 1-2-3-4':10;
'ADAT IN 5-6-7-8':14
}]", 0, 0, 18, 1) : int;
};
//-------------------------------------------- RME FireFace UFX - INPUT SELECTOR
// insel = ba.selectn(18,channel) : hmeter : _
// with{
// hmeter(x) = attach(x, an.amp_follower(0.150, x) : ba.linear2db : hbargraph("[02] METER [unit:dB]", -70, +5));
// envelop = abs : max ~ -(1.0/ma.SR) : max(ba.db2linear(-70)) : ba.linear2db;
// channel = nentry("[01] Input Channel Selector
// [style:menu{'Analog IN 1':0;
// 'Analog IN 2':1;
// 'Analog IN 3':2;
// 'Analog IN 4':3;
// 'Analog IN 5':4;
// 'Analog IN 6':5;
// 'Analog IN 7':6;
// 'Analog IN 8':7;
// 'Analog IN 9':8;
// 'Analog IN 10':9;
// 'ADAT IN 1':10;
// 'ADAT IN 2':11;
// 'ADAT IN 3':12;
// 'ADAT IN 4':13;
// 'ADAT IN 5':14;
// 'ADAT IN 6':15;
// 'ADAT IN 7':16;
// 'ADAT IN 8':17}]", 0, 0, 18, 1) : int;
// };
//===================================================================== MIDI ===
//==============================================================================
//--------------------------------------------------------------------- MIDI GUI
//----------------------------------------------------------- BEHRINGER BCF 2000
g81 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g82 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g83 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g84 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g85 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g86 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g87 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
g88 = vslider("[08] [midi:ctrl 88]", 0, -70, +6, 0.1) : ba.db2linear : si.smoo;
//Ctrl Chan tester (ctrl chan): tester(midi in, midi out)
// controlchantester = vgroup("CTRL CHAN IN/OUT", valuetest(81,1,81,1))
// with{
// valuetest(i,ic,o,oc) = hslider("Ctrl Value IN (Ctrl %i Channel %ic) [midi:ctrl %i %ic]", 60, 0, 127, 1) :
// hbargraph("Ctrl Value OUT (Ctrl %o) Channel OUT(Chan %oc) [midi:ctrl %o %oc]", 0, 127);
// };
//
// process = controlchantester;
bcf2000 = hgroup("BEHRINGER BCF 2000", par(i, 8, channel(i)))
with{
knob1(v) = vslider("[01][style:knob] Knob %f [midi:ctrl %f]", 0,0,127,1)
with{f = v+(1);};
pushknob1(v) = checkbox("[02]Push Knob %f [midi:ctrl %f]")
with{f = v+(33);};
knob2(v) = vslider("[03][style:knob] Knob %f [midi:ctrl %f]", 0,0,127,1)
with{f = v+(9);};
pushknob2(v) = checkbox("[04]Push Knob %f [midi:ctrl %f]")
with{f = v+(41);};
knob3(v) = vslider("[05][style:knob] Knob %f [midi:ctrl %f]", 0,0,127,1)
with{f = v+(17);};
pushknob3(v) = checkbox("[06]Push Knob %f [midi:ctrl %f]")
with{f = v+(49);};
knob4(v) = vslider("[07][style:knob] Knob %f [midi:ctrl %f]", 0,0,127,1)
with{f = v+(25);};
pushknob4(v) = checkbox("[08]Push Knob %f [midi:ctrl %f]")
with{f = v+(57);};
button1(v) = checkbox("[09]Button %f [midi:ctrl %f]")
with{f = v+(65);};
button2(v) = checkbox("[10]Button %f [midi:ctrl %f]")
with{f = v+(73);};
fader(v) = vslider("[11]ctrl %f [midi:ctrl %f]", 0,0,127,1)
with{f = v+(81);};
channel(v) = vgroup("ch %f", knob1(v), pushknob1(v), knob2(v), pushknob2(v), knob3(v), pushknob3(v), knob4(v), pushknob4(v), button1(v), button2(v), fader(v))
with{f = v+(81);};
};
// process = bcf2000;
miditester = hgroup("MIDITESTER", par(i, 127, fader(i)))
with{
fader(v) = vslider("ctrl %3f [midi:ctrl %3f]", 0,0,127,1)
with{f = v+(1);};
};