-
Notifications
You must be signed in to change notification settings - Fork 2
/
bus.go
283 lines (232 loc) · 6.74 KB
/
bus.go
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
package voicemeeter
import (
"fmt"
"time"
)
// iBus defines the interface bus types must satisfy
type iBus interface {
String() string
Mute() bool
SetMute(val bool)
Mono() bool
SetMono(val bool)
Label() string
SetLabel(val string)
Gain() float64
SetGain(val float64)
Eq() *eQ
Mode() *busMode
Levels() *levels
FadeTo(target float32, time_ int)
FadeBy(change float32, time_ int)
}
// bus represents a bus channel
type bus struct {
iRemote
eQ *eQ
mode *busMode
levels *levels
}
// Mute returns the value of the Mute parameter
func (b *bus) Mute() bool {
return b.getter_bool("Mute")
}
// SetMute sets the value of the Mute parameter
func (b *bus) SetMute(val bool) {
b.setter_bool("Mute", val)
}
// Mono returns the value of the Mute parameter
func (b *bus) Mono() bool {
return b.getter_bool("Mono")
}
// SetMono sets the value of the Mute parameter
func (b *bus) SetMono(val bool) {
b.setter_bool("Mono", val)
}
// Label returns the value of the MC parameter
func (b *bus) Label() string {
return b.getter_string("Label")
}
// SetLabel sets the value of the MC parameter
func (b *bus) SetLabel(val string) {
b.setter_string("Label", val)
}
// Gain returns the value of the Gain parameter
func (b *bus) Gain() float64 {
return b.getter_float("Gain")
}
// SetGain sets the value of the Gain parameter
func (b *bus) SetGain(val float64) {
b.setter_float("Gain", val)
}
// Eq returns the eQ field
func (b *bus) Eq() *eQ {
return b.eQ
}
// Mode returns address of a busMode struct
func (b *bus) Mode() *busMode {
return b.mode
}
// Levels returns the levels field
func (b *bus) Levels() *levels {
return b.levels
}
// FadeTo sets the value of gain to target over at time interval of time_
func (b *bus) FadeTo(target float32, time_ int) {
b.setter_string("FadeTo", fmt.Sprintf("(\"%f\", %d)", target, time_))
time.Sleep(time.Millisecond)
}
// FadeBy adjusts the value of gain by change over a time interval of time_
func (b *bus) FadeBy(change float32, time_ int) {
b.setter_string("FadeBy", fmt.Sprintf("(\"%f\", %d)", change, time_))
time.Sleep(time.Millisecond)
}
// PhysicalBus represents a single physical bus
type PhysicalBus struct {
bus
}
// newPhysicalBus returns a PhysicalBus type cast to an iBus
func newPhysicalBus(i int, k *kind) iBus {
e := newEq(fmt.Sprintf("bus[%d].EQ", i), i)
b := newBusMode(i)
l := newBusLevels(i, k)
pb := PhysicalBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}, e, b, l}}
return &pb
}
// String implements the fmt.stringer interface
func (p *PhysicalBus) String() string {
return fmt.Sprintf("PhysicalBus%d", p.index)
}
// VirtualBus represents a single virtual bus
type VirtualBus struct {
bus
}
// newVirtualBus returns a VirtualBus type cast to an iBus
func newVirtualBus(i int, k *kind) iBus {
e := newEq(fmt.Sprintf("bus[%d].EQ", i), i)
b := newBusMode(i)
l := newBusLevels(i, k)
vb := VirtualBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}, e, b, l}}
return &vb
}
// String implements the fmt.stringer interface
func (v *VirtualBus) String() string {
return fmt.Sprintf("VirtualBus%d", v.index)
}
// busMode offers methods for getting/setting bus mode states
type busMode struct {
iRemote
}
// newBusMode returns a busMode struct
func newBusMode(i int) *busMode {
return &busMode{iRemote{fmt.Sprintf("bus[%d].mode", i), i}}
}
// Normal gets the value of the Mode.Normal parameter
func (bm *busMode) Normal() bool {
return bm.getter_bool("Normal")
}
// SetNormal sets the value of the Mode.Normal parameter
func (bm *busMode) SetNormal(val bool) {
bm.setter_bool("Normal", val)
}
// Amix gets the value of the Mode.Amix parameter
func (bm *busMode) Amix() bool {
return bm.getter_bool("Amix")
}
// SetAmix sets the value of the Mode.Amix parameter
func (bm *busMode) SetAmix(val bool) {
bm.setter_bool("Amix", val)
}
// Bmix gets the value of the Mode.Bmix parameter
func (bm *busMode) Bmix() bool {
return bm.getter_bool("Bmix")
}
// SetBmix sets the value of the Mode.Bmix parameter
func (bm *busMode) SetBmix(val bool) {
bm.setter_bool("Bmix", val)
}
// Repeat gets the value of the Mode.Repeat parameter
func (bm *busMode) Repeat() bool {
return bm.getter_bool("Repeat")
}
// SetRepeat sets the value of the Mode.Repeat parameter
func (bm *busMode) SetRepeat(val bool) {
bm.setter_bool("Repeat", val)
}
// Composite gets the value of the Mode.Composite parameter
func (bm *busMode) Composite() bool {
return bm.getter_bool("Composite")
}
// SetComposite sets the value of the Mode.Composite parameter
func (bm *busMode) SetComposite(val bool) {
bm.setter_bool("Composite", val)
}
// TvMix gets the value of the Mode.TvMix parameter
func (bm *busMode) TvMix() bool {
return bm.getter_bool("TvMix")
}
// SetTvMix sets the value of the Mode.TvMix parameter
func (bm *busMode) SetTvMix(val bool) {
bm.setter_bool("TvMix", val)
}
// UpMix21 gets the value of the Mode.UpMix21 parameter
func (bm *busMode) UpMix21() bool {
return bm.getter_bool("UpMix21")
}
// SetUpMix21 sets the value of the Mode.UpMix21 parameter
func (bm *busMode) SetUpMix21(val bool) {
bm.setter_bool("UpMix21", val)
}
// UpMix41 gets the value of the Mode.UpMix41 parameter
func (bm *busMode) UpMix41() bool {
return bm.getter_bool("UpMix41")
}
// SetUpMix41 sets the value of the Mode.UpMix41 parameter
func (bm *busMode) SetUpMix41(val bool) {
bm.setter_bool("UpMix41", val)
}
// UpMix61 gets the value of the Mode.UpMix61 parameter
func (bm *busMode) UpMix61() bool {
return bm.getter_bool("UpMix61")
}
// SetUpMix61 sets the value of the Mode.UpMix61 parameter
func (bm *busMode) SetUpMix61(val bool) {
bm.setter_bool("UpMix61", val)
}
// CenterOnly gets the value of the Mode.CenterOnly parameter
func (bm *busMode) CenterOnly() bool {
return bm.getter_bool("CenterOnly")
}
// SetCenterOnly sets the value of the Mode.CenterOnly parameter
func (bm *busMode) SetCenterOnly(val bool) {
bm.setter_bool("CenterOnly", val)
}
// LfeOnly gets the value of the Mode.LFE parameter
func (bm *busMode) LfeOnly() bool {
return bm.getter_bool("LfeOnly")
}
// SetLfeOnly sets the value of the Mode.LFE parameter
func (bm *busMode) SetLfeOnly(val bool) {
bm.setter_bool("LfeOnly", val)
}
// RearOnly gets the value of the Mode.RearOnly parameter
func (bm *busMode) RearOnly() bool {
return bm.getter_bool("RearOnly")
}
// SetRearOnly sets the value of the Mode.RearOnly parameter
func (bm *busMode) SetRearOnly(val bool) {
bm.setter_bool("RearOnly", val)
}
// newBusLevels represents the levels field for a channel
func newBusLevels(i int, k *kind) *levels {
init := i * 8
return &levels{iRemote{fmt.Sprintf("bus[%d]", i), i}, k, init, 8, "bus"}
}
// All returns the level values for a bus
func (l *levels) All() []float64 {
levels := make([]float64, l.offset)
for i := range levels {
levels[i] = convertLevel(_levelCache.busLevels[l.init+i])
}
return levels
}