-
Notifications
You must be signed in to change notification settings - Fork 5
/
BELAUGens.sc
94 lines (83 loc) · 2.75 KB
/
BELAUGens.sc
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
/*
* BELAUGens to access the analog and digital I/O
* created by nescivi, (c) 2016
* https://www.nescivi.eu
*/
/* input: id of analog pin to read; can be modulated at audiorate
* output: value of analog analogPin
*/
MultiplexAnalogIn : UGen {
signalRange { ^\unipolar }
*ar { arg analogPin = 0, muxChannel=0, mul=1.0, add=0.0;
^this.multiNew('audio', analogPin, muxChannel ).madd(mul,add)
}
*kr { arg analogPin = 0, muxChannel=0, mul=1.0, add=0.0;
^this.multiNew('control', analogPin, muxChannel ).madd(mul,add)
}
}
/* input: id of analog pin to read; can be modulated at audiorate
* output: value of analog analogPin
*/
AnalogIn : UGen {
signalRange { ^\unipolar }
*ar { arg analogPin = 0, mul=1.0, add=0.0;
^this.multiNew('audio', analogPin ).madd(mul,add)
}
*kr { arg analogPin = 0, mul=1.0, add=0.0;
^this.multiNew('control', analogPin ).madd(mul,add)
}
}
/* input 1: id of analog pin to read; can be modulated at audiorate
* input 2: value to write out
* output: none
*/
AnalogOut : UGen {
*ar { arg analogPin = 0, output=0, mul=1.0, add=0.0;
^this.multiNew('audio', analogPin, output ).madd(mul,add)
}
*kr { arg analogPin = 0, output=0, mul=1.0, add=0.0;
^this.multiNew('control', analogPin, output ).madd(mul,add)
}
numOutputs { ^0 }
writeOutputSpecs {}
}
/* input: id of digital pin to read; cannot be modulated
* output: value of digital pin
*/
DigitalIn : UGen {
signalRange { ^\unipolar }
*ar { arg digitalPin = 0, mul=1.0, add=0.0;
^this.multiNew('audio', digitalPin ).madd(mul,add)
}
*kr { arg digitalPin = 0, mul=1.0, add=0.0;
^this.multiNew('control', digitalPin ).madd(mul,add)
}
}
/* input 1: id of digital pin to read; cannot be modulated
* input 2: value to write out
* output: none
*/
DigitalOut : UGen {
*ar { arg digitalPin = 0, output=0, writeMode=0, mul=1.0, add=0.0;
^this.multiNew('audio', digitalPin, output, writeMode ).madd(mul,add)
}
*kr { arg digitalPin = 0, output=0, writeMode=0, mul=1.0, add=0.0;
^this.multiNew('control', digitalPin, output, writeMode ).madd(mul,add)
}
numOutputs { ^0 }
writeOutputSpecs {}
}
/* input 1: id of digital pin to read; cannot be modulated
* input 2: value to write out
* input 3: pin mode ( < 0.5 = input, otherwise output)
* output: value of digital pin (last read value)
*/
DigitalIO : UGen {
signalRange { ^\unipolar }
*ar { arg digitalPin = 0, output=0, pinMode=0, mul=1.0, add=0.0;
^this.multiNew('audio', digitalPin, output, pinMode ).madd(mul,add)
}
*kr { arg digitalPin = 0, output=0, pinMode=0, mul=1.0, add=0.0;
^this.multiNew('control', digitalPin, output, pinMode ).madd(mul,add)
}
}