root/branches/libffado-2.0/support/mixer/mixer_motu.py

Revision 1315, 39.8 kB (checked in by jwoithe, 12 years ago)

MOTU: first cut at supporting the meter controls of the 896HD. Please test and report what works and what doesn't.

Line 
1 #
2 # Copyright (C) 2005-2008 by Pieter Palmers
3 # Copyright (C) 2008 by Jonathan Woithe
4 #
5 # This file is part of FFADO
6 # FFADO = Free Firewire (pro-)audio drivers for linux
7 #
8 # FFADO is based upon FreeBoB.
9 #
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 2 of the License, or
13 # (at your option) version 3 of the License.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 #
23
24 from qt import *
25 from mixer_motuui import *
26
27 # Model defines.  These must agree with what is used in motu_avdevice.h.
28 MOTU_MODEL_NONE     = 0x0000
29 MOTU_MODEL_828mkII  = 0x0001
30 MOTU_MODEL_TRAVELER = 0x0002
31 MOTU_MODEL_ULTRALITE= 0x0003
32 MOTU_MODEL_8PRE     = 0x0004
33 MOTU_MODEL_828MkI   = 0x0005
34 MOTU_MODEL_896HD    = 0x0006
35                            
36 class MotuMixer(MotuMixerUI):
37     def __init__(self,parent = None,name = None,fl = 0):
38         MotuMixerUI.__init__(self,parent,name,fl)
39
40     # public slot: channel faders within a matrix mixer
41     def updateChannelFader(self, a0):
42         sender = self.sender()
43         vol = 128-a0
44         print "setting %s for mix %d channel %d to %d" % (self.ChannelFaders[sender][0],
45             self.ChannelFaders[sender][1], self.ChannelFaders[sender][2], vol)
46         self.hw.setMatrixMixerValue(self.ChannelFaders[sender][0],
47             self.ChannelFaders[sender][1], self.ChannelFaders[sender][2], vol)
48
49     # public slot: a multivalue control within a matrix mixer
50     def updateChannelControl(self, a0):
51         sender = self.sender()
52         val = a0
53         print "setting %s for mix %d channel %d to %d" % (self.ChannelControls[sender][0],
54             self.ChannelControls[sender][1], self.ChannelControls[sender][2], val)
55         self.hw.setMatrixMixerValue(self.ChannelControls[sender][0],
56             self.ChannelControls[sender][1], self.ChannelControls[sender][2], val)
57
58     # public slot: a generic single multivalue control
59     def updateControl(self, a0):
60         sender = self.sender()
61         val = a0
62         print "setting %s control to %d" % (self.Controls[sender][0], val)
63         self.hw.setDiscrete(self.Controls[sender][0], val)
64
65     # public slot: a binary switch within a matrix mixer
66     def updateChannelBinarySwitch(self, a0):
67         sender = self.sender()
68         val=a0
69         print "setting %s for mix %d channel %d switch to %d" % (self.ChannelBinarySwitches[sender][0],
70             self.ChannelBinarySwitches[sender][1], self.ChannelBinarySwitches[sender][2], val)
71         self.hw.setMatrixMixerValue(self.ChannelBinarySwitches[sender][0],
72             self.ChannelBinarySwitches[sender][1], self.ChannelBinarySwitches[sender][2], val)
73
74     # public slot: generic single binary switch
75     def updateBinarySwitch(self, a0):
76         sender = self.sender()
77         val=a0
78         print "setting %s switch to %d" % (self.BinarySwitches[sender][0], val)
79         self.hw.setDiscrete(self.BinarySwitches[sender][0], val)
80
81     # public slot: a faders (not in a matrix mixer)
82     def updateFader(self, a0):
83         sender = self.sender()
84         vol = 128-a0
85         print "setting %s mix fader to %d" % (self.Faders[sender][0], vol)
86         self.hw.setDiscrete(self.Faders[sender][0], vol)
87
88     # public slot: mix destination control
89     def updateMixDest(self, a0):
90         sender = self.sender()
91         dest=a0
92         print "setting %s mix destination to %d" % (self.MixDests[sender][0], dest)
93         self.hw.setDiscrete(self.MixDests[sender][0], dest)
94
95     # public slots: mix output controls
96     def set_mix1_dest(self,a0):
97         self.setMixDest('mix1', a0)
98
99     def setSelector(self,a0,a1):
100         name=a0
101         state = a1
102         print "setting %s state to %d" % (name, state)
103         self.hw.setDiscrete(self.SelectorControls[name][0], state)
104
105     # Hide and disable a control
106     def disable_hide(self,widget):
107         widget.hide()
108         widget.setEnabled(False)
109
110     def init(self):
111         print "Init MOTU mixer window"
112
113         # For matrix mixer controls (channel faders, pans, solos, mutes) the
114         # first index (the row) is the zero-based mix number while the
115         # second index (the column) is the zero-based channel number.  The
116         # order of the channel enumeration must agree with that used when
117         # creating the dbus controls within motu_avdevice.cpp.
118         self.ChannelFaders={
119             self.mix1ana1_fader: ['/Mixer/fader', 0, 0],
120             self.mix1ana2_fader: ['/Mixer/fader', 0, 1],
121             self.mix1ana3_fader: ['/Mixer/fader', 0, 2],
122             self.mix1ana4_fader: ['/Mixer/fader', 0, 3],
123             self.mix1ana5_fader: ['/Mixer/fader', 0, 4],
124             self.mix1ana6_fader: ['/Mixer/fader', 0, 5],
125             self.mix1ana7_fader: ['/Mixer/fader', 0, 6],
126             self.mix1ana8_fader: ['/Mixer/fader', 0, 7],
127             self.mix1aes1_fader: ['/Mixer/fader', 0, 8],
128             self.mix1aes2_fader: ['/Mixer/fader', 0, 9],
129             self.mix1spdif1_fader: ['/Mixer/fader', 0, 10],
130             self.mix1spdif2_fader: ['/Mixer/fader', 0, 11],
131             self.mix1adat1_fader: ['/Mixer/fader', 0, 12],
132             self.mix1adat2_fader: ['/Mixer/fader', 0, 13],
133             self.mix1adat3_fader: ['/Mixer/fader', 0, 14],
134             self.mix1adat4_fader: ['/Mixer/fader', 0, 15],
135             self.mix1adat5_fader: ['/Mixer/fader', 0, 16],
136             self.mix1adat6_fader: ['/Mixer/fader', 0, 17],
137             self.mix1adat7_fader: ['/Mixer/fader', 0, 18],
138             self.mix1adat8_fader: ['/Mixer/fader', 0, 19],
139
140             self.mix2ana1_fader: ['/Mixer/fader', 1, 0],
141             self.mix2ana2_fader: ['/Mixer/fader', 1, 1],
142             self.mix2ana3_fader: ['/Mixer/fader', 1, 2],
143             self.mix2ana4_fader: ['/Mixer/fader', 1, 3],
144             self.mix2ana5_fader: ['/Mixer/fader', 1, 4],
145             self.mix2ana6_fader: ['/Mixer/fader', 1, 5],
146             self.mix2ana7_fader: ['/Mixer/fader', 1, 6],
147             self.mix2ana8_fader: ['/Mixer/fader', 1, 7],
148             self.mix2aes1_fader: ['/Mixer/fader', 1, 8],
149             self.mix2aes2_fader: ['/Mixer/fader', 1, 9],
150             self.mix2spdif1_fader: ['/Mixer/fader', 1, 10],
151             self.mix2spdif2_fader: ['/Mixer/fader', 1, 11],
152             self.mix2adat1_fader: ['/Mixer/fader', 1, 12],
153             self.mix2adat2_fader: ['/Mixer/fader', 1, 13],
154             self.mix2adat3_fader: ['/Mixer/fader', 1, 14],
155             self.mix2adat4_fader: ['/Mixer/fader', 1, 15],
156             self.mix2adat5_fader: ['/Mixer/fader', 1, 16],
157             self.mix2adat6_fader: ['/Mixer/fader', 1, 17],
158             self.mix2adat7_fader: ['/Mixer/fader', 1, 18],
159             self.mix2adat8_fader: ['/Mixer/fader', 1, 19],
160
161             self.mix3ana1_fader: ['/Mixer/fader', 2, 0],
162             self.mix3ana2_fader: ['/Mixer/fader', 2, 1],
163             self.mix3ana3_fader: ['/Mixer/fader', 2, 2],
164             self.mix3ana4_fader: ['/Mixer/fader', 2, 3],
165             self.mix3ana5_fader: ['/Mixer/fader', 2, 4],
166             self.mix3ana6_fader: ['/Mixer/fader', 2, 5],
167             self.mix3ana7_fader: ['/Mixer/fader', 2, 6],
168             self.mix3ana8_fader: ['/Mixer/fader', 2, 7],
169             self.mix3aes1_fader: ['/Mixer/fader', 2, 8],
170             self.mix3aes2_fader: ['/Mixer/fader', 2, 9],
171             self.mix3spdif1_fader: ['/Mixer/fader', 2, 10],
172             self.mix3spdif2_fader: ['/Mixer/fader', 2, 11],
173             self.mix3adat1_fader: ['/Mixer/fader', 2, 12],
174             self.mix3adat2_fader: ['/Mixer/fader', 2, 13],
175             self.mix3adat3_fader: ['/Mixer/fader', 2, 14],
176             self.mix3adat4_fader: ['/Mixer/fader', 2, 15],
177             self.mix3adat5_fader: ['/Mixer/fader', 2, 16],
178             self.mix3adat6_fader: ['/Mixer/fader', 2, 17],
179             self.mix3adat7_fader: ['/Mixer/fader', 2, 18],
180             self.mix3adat8_fader: ['/Mixer/fader', 2, 19],
181
182             self.mix4ana1_fader: ['/Mixer/fader', 3, 0],
183             self.mix4ana2_fader: ['/Mixer/fader', 3, 1],
184             self.mix4ana3_fader: ['/Mixer/fader', 3, 2],
185             self.mix4ana4_fader: ['/Mixer/fader', 3, 3],
186             self.mix4ana5_fader: ['/Mixer/fader', 3, 4],
187             self.mix4ana6_fader: ['/Mixer/fader', 3, 5],
188             self.mix4ana7_fader: ['/Mixer/fader', 3, 6],
189             self.mix4ana8_fader: ['/Mixer/fader', 3, 7],
190             self.mix4aes1_fader: ['/Mixer/fader', 3, 8],
191             self.mix4aes2_fader: ['/Mixer/fader', 3, 9],
192             self.mix4spdif1_fader: ['/Mixer/fader', 3, 10],
193             self.mix4spdif2_fader: ['/Mixer/fader', 3, 11],
194             self.mix4adat1_fader: ['/Mixer/fader', 3, 12],
195             self.mix4adat2_fader: ['/Mixer/fader', 3, 13],
196             self.mix4adat3_fader: ['/Mixer/fader', 3, 14],
197             self.mix4adat4_fader: ['/Mixer/fader', 3, 15],
198             self.mix4adat5_fader: ['/Mixer/fader', 3, 16],
199             self.mix4adat6_fader: ['/Mixer/fader', 3, 17],
200             self.mix4adat7_fader: ['/Mixer/fader', 3, 18],
201             self.mix4adat8_fader: ['/Mixer/fader', 3, 19],
202         }
203
204         self.Faders={
205             self.mix1_fader: ['/Mixer/Mix1/Mix_fader'],
206             self.mix2_fader: ['/Mixer/Mix2/Mix_fader'],
207             self.mix3_fader: ['/Mixer/Mix3/Mix_fader'],
208             self.mix4_fader: ['/Mixer/Mix4/Mix_fader'],
209         }
210
211         self.ChannelControls={
212             self.mix1ana1_pan:   ['/Mixer/pan', 0, 0],
213             self.mix1ana2_pan:   ['/Mixer/pan', 0, 1],
214             self.mix1ana3_pan:   ['/Mixer/pan', 0, 2],
215             self.mix1ana4_pan:   ['/Mixer/pan', 0, 3],
216             self.mix1ana5_pan:   ['/Mixer/pan', 0, 4],
217             self.mix1ana6_pan:   ['/Mixer/pan', 0, 5],
218             self.mix1ana7_pan:   ['/Mixer/pan', 0, 6],
219             self.mix1ana8_pan:   ['/Mixer/pan', 0, 7],
220             self.mix1aes1_pan:   ['/Mixer/pan', 0, 8],
221             self.mix1aes2_pan:   ['/Mixer/pan', 0, 9],
222             self.mix1spdif1_pan: ['/Mixer/pan', 0, 10],
223             self.mix1spdif2_pan: ['/Mixer/pan', 0, 11],
224             self.mix1adat1_pan:  ['/Mixer/pan', 0, 12],
225             self.mix1adat2_pan:  ['/Mixer/pan', 0, 13],
226             self.mix1adat3_pan:  ['/Mixer/pan', 0, 14],
227             self.mix1adat4_pan:  ['/Mixer/pan', 0, 15],
228             self.mix1adat5_pan:  ['/Mixer/pan', 0, 16],
229             self.mix1adat6_pan:  ['/Mixer/pan', 0, 17],
230             self.mix1adat7_pan:  ['/Mixer/pan', 0, 18],
231             self.mix1adat8_pan:  ['/Mixer/pan', 0, 19],
232
233             self.mix2ana1_pan:   ['/Mixer/pan', 1, 0],
234             self.mix2ana2_pan:   ['/Mixer/pan', 1, 1],
235             self.mix2ana3_pan:   ['/Mixer/pan', 1, 2],
236             self.mix2ana4_pan:   ['/Mixer/pan', 1, 3],
237             self.mix2ana5_pan:   ['/Mixer/pan', 1, 4],
238             self.mix2ana6_pan:   ['/Mixer/pan', 1, 5],
239             self.mix2ana7_pan:   ['/Mixer/pan', 1, 6],
240             self.mix2ana8_pan:   ['/Mixer/pan', 1, 7],
241             self.mix2aes1_pan:   ['/Mixer/pan', 1, 8],
242             self.mix2aes2_pan:   ['/Mixer/pan', 1, 9],
243             self.mix2spdif1_pan: ['/Mixer/pan', 1, 10],
244             self.mix2spdif2_pan: ['/Mixer/pan', 1, 11],
245             self.mix2adat1_pan:  ['/Mixer/pan', 1, 12],
246             self.mix2adat2_pan:  ['/Mixer/pan', 1, 13],
247             self.mix2adat3_pan:  ['/Mixer/pan', 1, 14],
248             self.mix2adat4_pan:  ['/Mixer/pan', 1, 15],
249             self.mix2adat5_pan:  ['/Mixer/pan', 1, 16],
250             self.mix2adat6_pan:  ['/Mixer/pan', 1, 17],
251             self.mix2adat7_pan:  ['/Mixer/pan', 1, 18],
252             self.mix2adat8_pan:  ['/Mixer/pan', 1, 19],
253
254             self.mix3ana1_pan:   ['/Mixer/pan', 2, 0],
255             self.mix3ana2_pan:   ['/Mixer/pan', 2, 1],
256             self.mix3ana3_pan:   ['/Mixer/pan', 2, 2],
257             self.mix3ana4_pan:   ['/Mixer/pan', 2, 3],
258             self.mix3ana5_pan:   ['/Mixer/pan', 2, 4],
259             self.mix3ana6_pan:   ['/Mixer/pan', 2, 5],
260             self.mix3ana7_pan:   ['/Mixer/pan', 2, 6],
261             self.mix3ana8_pan:   ['/Mixer/pan', 2, 7],
262             self.mix3aes1_pan:   ['/Mixer/pan', 2, 8],
263             self.mix3aes2_pan:   ['/Mixer/pan', 2, 9],
264             self.mix3spdif1_pan: ['/Mixer/pan', 2, 10],
265             self.mix3spdif2_pan: ['/Mixer/pan', 2, 11],
266             self.mix3adat1_pan:  ['/Mixer/pan', 2, 12],
267             self.mix3adat2_pan:  ['/Mixer/pan', 2, 13],
268             self.mix3adat3_pan:  ['/Mixer/pan', 2, 14],
269             self.mix3adat4_pan:  ['/Mixer/pan', 2, 15],
270             self.mix3adat5_pan:  ['/Mixer/pan', 2, 16],
271             self.mix3adat6_pan:  ['/Mixer/pan', 2, 17],
272             self.mix3adat7_pan:  ['/Mixer/pan', 2, 18],
273             self.mix3adat8_pan:  ['/Mixer/pan', 2, 19],
274
275             self.mix4ana1_pan:   ['/Mixer/pan', 3, 0],
276             self.mix4ana2_pan:   ['/Mixer/pan', 3, 1],
277             self.mix4ana3_pan:   ['/Mixer/pan', 3, 2],
278             self.mix4ana4_pan:   ['/Mixer/pan', 3, 3],
279             self.mix4ana5_pan:   ['/Mixer/pan', 3, 4],
280             self.mix4ana6_pan:   ['/Mixer/pan', 3, 5],
281             self.mix4ana7_pan:   ['/Mixer/pan', 3, 6],
282             self.mix4ana8_pan:   ['/Mixer/pan', 3, 7],
283             self.mix4aes1_pan:   ['/Mixer/pan', 3, 8],
284             self.mix4aes2_pan:   ['/Mixer/pan', 3, 9],
285             self.mix4spdif1_pan: ['/Mixer/pan', 3, 10],
286             self.mix4spdif2_pan: ['/Mixer/pan', 3, 11],
287             self.mix4adat1_pan:  ['/Mixer/pan', 3, 12],
288             self.mix4adat2_pan:  ['/Mixer/pan', 3, 13],
289             self.mix4adat3_pan:  ['/Mixer/pan', 3, 14],
290             self.mix4adat4_pan:  ['/Mixer/pan', 3, 15],
291             self.mix4adat5_pan:  ['/Mixer/pan', 3, 16],
292             self.mix4adat6_pan:  ['/Mixer/pan', 3, 17],
293             self.mix4adat7_pan:  ['/Mixer/pan', 3, 18],
294             self.mix4adat8_pan:  ['/Mixer/pan', 3, 19],
295         }
296
297         self.Controls={
298             self.ana1_trimgain:  ['/Mixer/Control/Ana1_trimgain'],
299             self.ana2_trimgain:  ['/Mixer/Control/Ana2_trimgain'],
300             self.ana3_trimgain:  ['/Mixer/Control/Ana3_trimgain'],
301             self.ana4_trimgain:  ['/Mixer/Control/Ana4_trimgain'],
302         }
303
304         self.ChannelBinarySwitches={
305             self.mix1ana1_mute:  ['/Mixer/mute', 0, 0],
306             self.mix1ana2_mute:  ['/Mixer/mute', 0, 1],
307             self.mix1ana3_mute:  ['/Mixer/mute', 0, 2],
308             self.mix1ana4_mute:  ['/Mixer/mute', 0, 3],
309             self.mix1ana5_mute:  ['/Mixer/mute', 0, 4],
310             self.mix1ana6_mute:  ['/Mixer/mute', 0, 5],
311             self.mix1ana7_mute:  ['/Mixer/mute', 0, 6],
312             self.mix1ana8_mute:  ['/Mixer/mute', 0, 7],
313             self.mix1aes1_mute:  ['/Mixer/mute', 0, 8],
314             self.mix1aes2_mute:  ['/Mixer/mute', 0, 9],
315             self.mix1spdif1_mute: ['/Mixer/mute', 0, 10],
316             self.mix1spdif2_mute: ['/Mixer/mute', 0, 11],
317             self.mix1adat1_mute: ['/Mixer/mute', 0, 12],
318             self.mix1adat2_mute: ['/Mixer/mute', 0, 13],
319             self.mix1adat3_mute: ['/Mixer/mute', 0, 14],
320             self.mix1adat4_mute: ['/Mixer/mute', 0, 15],
321             self.mix1adat5_mute: ['/Mixer/mute', 0, 16],
322             self.mix1adat6_mute: ['/Mixer/mute', 0, 17],
323             self.mix1adat7_mute: ['/Mixer/mute', 0, 18],
324             self.mix1adat8_mute: ['/Mixer/mute', 0, 19],
325             self.mix1ana1_solo:  ['/Mixer/solo', 0, 0],
326             self.mix1ana2_solo:  ['/Mixer/solo', 0, 1],
327             self.mix1ana3_solo:  ['/Mixer/solo', 0, 2],
328             self.mix1ana4_solo:  ['/Mixer/solo', 0, 3],
329             self.mix1ana5_solo:  ['/Mixer/solo', 0, 4],
330             self.mix1ana6_solo:  ['/Mixer/solo', 0, 5],
331             self.mix1ana7_solo:  ['/Mixer/solo', 0, 6],
332             self.mix1ana8_solo:  ['/Mixer/solo', 0, 7],
333             self.mix1aes1_solo:  ['/Mixer/solo', 0, 8],
334             self.mix1aes2_solo:  ['/Mixer/solo', 0, 9],
335             self.mix1spdif1_solo: ['/Mixer/solo', 0, 10],
336             self.mix1spdif2_solo: ['/Mixer/solo', 0, 11],
337             self.mix1adat1_solo: ['/Mixer/solo', 0, 12],
338             self.mix1adat2_solo: ['/Mixer/solo', 0, 13],
339             self.mix1adat3_solo: ['/Mixer/solo', 0, 14],
340             self.mix1adat4_solo: ['/Mixer/solo', 0, 15],
341             self.mix1adat5_solo: ['/Mixer/solo', 0, 16],
342             self.mix1adat6_solo: ['/Mixer/solo', 0, 17],
343             self.mix1adat7_solo: ['/Mixer/solo', 0, 18],
344             self.mix1adat8_solo: ['/Mixer/solo', 0, 19],
345
346             self.mix2ana1_mute:  ['/Mixer/mute', 1, 0],
347             self.mix2ana2_mute:  ['/Mixer/mute', 1, 1],
348             self.mix2ana3_mute:  ['/Mixer/mute', 1, 2],
349             self.mix2ana4_mute:  ['/Mixer/mute', 1, 3],
350             self.mix2ana5_mute:  ['/Mixer/mute', 1, 4],
351             self.mix2ana6_mute:  ['/Mixer/mute', 1, 5],
352             self.mix2ana7_mute:  ['/Mixer/mute', 1, 6],
353             self.mix2ana8_mute:  ['/Mixer/mute', 1, 7],
354             self.mix2aes1_mute:  ['/Mixer/mute', 1, 8],
355             self.mix2aes2_mute:  ['/Mixer/mute', 1, 9],
356             self.mix2spdif1_mute: ['/Mixer/mute', 1, 10],
357             self.mix2spdif2_mute: ['/Mixer/mute', 1, 11],
358             self.mix2adat1_mute: ['/Mixer/mute', 1, 12],
359             self.mix2adat2_mute: ['/Mixer/mute', 1, 13],
360             self.mix2adat3_mute: ['/Mixer/mute', 1, 14],
361             self.mix2adat4_mute: ['/Mixer/mute', 1, 15],
362             self.mix2adat5_mute: ['/Mixer/mute', 1, 16],
363             self.mix2adat6_mute: ['/Mixer/mute', 1, 17],
364             self.mix2adat7_mute: ['/Mixer/mute', 1, 18],
365             self.mix2adat8_mute: ['/Mixer/mute', 1, 19],
366             self.mix2ana1_solo:  ['/Mixer/solo', 1, 0],
367             self.mix2ana2_solo:  ['/Mixer/solo', 1, 1],
368             self.mix2ana3_solo:  ['/Mixer/solo', 1, 2],
369             self.mix2ana4_solo:  ['/Mixer/solo', 1, 3],
370             self.mix2ana5_solo:  ['/Mixer/solo', 1, 4],
371             self.mix2ana6_solo:  ['/Mixer/solo', 1, 5],
372             self.mix2ana7_solo:  ['/Mixer/solo', 1, 6],
373             self.mix2ana8_solo:  ['/Mixer/solo', 1, 7],
374             self.mix2aes1_solo:  ['/Mixer/solo', 1, 8],
375             self.mix2aes2_solo:  ['/Mixer/solo', 1, 9],
376             self.mix2spdif1_solo: ['/Mixer/solo', 1, 10],
377             self.mix2spdif2_solo: ['/Mixer/solo', 1, 11],
378             self.mix2adat1_solo: ['/Mixer/solo', 1, 12],
379             self.mix2adat2_solo: ['/Mixer/solo', 1, 13],
380             self.mix2adat3_solo: ['/Mixer/solo', 1, 14],
381             self.mix2adat4_solo: ['/Mixer/solo', 1, 15],
382             self.mix2adat5_solo: ['/Mixer/solo', 1, 16],
383             self.mix2adat6_solo: ['/Mixer/solo', 1, 17],
384             self.mix2adat7_solo: ['/Mixer/solo', 1, 18],
385             self.mix2adat8_solo: ['/Mixer/solo', 1, 19],
386
387             self.mix3ana1_mute:  ['/Mixer/mute', 2, 0],
388             self.mix3ana2_mute:  ['/Mixer/mute', 2, 1],
389             self.mix3ana3_mute:  ['/Mixer/mute', 2, 2],
390             self.mix3ana4_mute:  ['/Mixer/mute', 2, 3],
391             self.mix3ana5_mute:  ['/Mixer/mute', 2, 4],
392             self.mix3ana6_mute:  ['/Mixer/mute', 2, 5],
393             self.mix3ana7_mute:  ['/Mixer/mute', 2, 6],
394             self.mix3ana8_mute:  ['/Mixer/mute', 2, 7],
395             self.mix3aes1_mute:  ['/Mixer/mute', 2, 8],
396             self.mix3aes2_mute:  ['/Mixer/mute', 2, 9],
397             self.mix3spdif1_mute: ['/Mixer/mute', 2, 10],
398             self.mix3spdif2_mute: ['/Mixer/mute', 2, 11],
399             self.mix3adat1_mute: ['/Mixer/mute', 2, 12],
400             self.mix3adat2_mute: ['/Mixer/mute', 2, 13],
401             self.mix3adat3_mute: ['/Mixer/mute', 2, 14],
402             self.mix3adat4_mute: ['/Mixer/mute', 2, 15],
403             self.mix3adat5_mute: ['/Mixer/mute', 2, 16],
404             self.mix3adat6_mute: ['/Mixer/mute', 2, 17],
405             self.mix3adat7_mute: ['/Mixer/mute', 2, 18],
406             self.mix3adat8_mute: ['/Mixer/mute', 2, 19],
407             self.mix3ana1_solo:  ['/Mixer/solo', 2, 0],
408             self.mix3ana2_solo:  ['/Mixer/solo', 2, 1],
409             self.mix3ana3_solo:  ['/Mixer/solo', 2, 2],
410             self.mix3ana4_solo:  ['/Mixer/solo', 2, 3],
411             self.mix3ana5_solo:  ['/Mixer/solo', 2, 4],
412             self.mix3ana6_solo:  ['/Mixer/solo', 2, 5],
413             self.mix3ana7_solo:  ['/Mixer/solo', 2, 6],
414             self.mix3ana8_solo:  ['/Mixer/solo', 2, 7],
415             self.mix3aes1_solo:  ['/Mixer/solo', 2, 8],
416             self.mix3aes2_solo:  ['/Mixer/solo', 2, 9],
417             self.mix3spdif1_solo: ['/Mixer/solo', 2, 10],
418             self.mix3spdif2_solo: ['/Mixer/solo', 2, 11],
419             self.mix3adat1_solo: ['/Mixer/solo', 2, 12],
420             self.mix3adat2_solo: ['/Mixer/solo', 2, 13],
421             self.mix3adat3_solo: ['/Mixer/solo', 2, 14],
422             self.mix3adat4_solo: ['/Mixer/solo', 2, 15],
423             self.mix3adat5_solo: ['/Mixer/solo', 2, 16],
424             self.mix3adat6_solo: ['/Mixer/solo', 2, 17],
425             self.mix3adat7_solo: ['/Mixer/solo', 2, 18],
426             self.mix3adat8_solo: ['/Mixer/solo', 2, 19],
427
428             self.mix4ana1_mute:  ['/Mixer/mute', 3, 0],
429             self.mix4ana2_mute:  ['/Mixer/mute', 3, 1],
430             self.mix4ana3_mute:  ['/Mixer/mute', 3, 2],
431             self.mix4ana4_mute:  ['/Mixer/mute', 3, 3],
432             self.mix4ana5_mute:  ['/Mixer/mute', 3, 4],
433             self.mix4ana6_mute:  ['/Mixer/mute', 3, 5],
434             self.mix4ana7_mute:  ['/Mixer/mute', 3, 6],
435             self.mix4ana8_mute:  ['/Mixer/mute', 3, 7],
436             self.mix4aes1_mute:  ['/Mixer/mute', 3, 8],
437             self.mix4aes2_mute:  ['/Mixer/mute', 3, 9],
438             self.mix4spdif1_mute: ['/Mixer/mute', 3, 10],
439             self.mix4spdif2_mute: ['/Mixer/mute', 3, 11],
440             self.mix4adat1_mute: ['/Mixer/mute', 3, 12],
441             self.mix4adat2_mute: ['/Mixer/mute', 3, 13],
442             self.mix4adat3_mute: ['/Mixer/mute', 3, 14],
443             self.mix4adat4_mute: ['/Mixer/mute', 3, 15],
444             self.mix4adat5_mute: ['/Mixer/mute', 3, 16],
445             self.mix4adat6_mute: ['/Mixer/mute', 3, 17],
446             self.mix4adat7_mute: ['/Mixer/mute', 3, 18],
447             self.mix4adat8_mute: ['/Mixer/mute', 3, 19],
448             self.mix4ana1_solo:  ['/Mixer/solo', 3, 0],
449             self.mix4ana2_solo:  ['/Mixer/solo', 3, 1],
450             self.mix4ana3_solo:  ['/Mixer/solo', 3, 2],
451             self.mix4ana4_solo:  ['/Mixer/solo', 3, 3],
452             self.mix4ana5_solo:  ['/Mixer/solo', 3, 4],
453             self.mix4ana6_solo:  ['/Mixer/solo', 3, 5],
454             self.mix4ana7_solo:  ['/Mixer/solo', 3, 6],
455             self.mix4ana8_solo:  ['/Mixer/solo', 3, 7],
456             self.mix4aes1_solo:  ['/Mixer/solo', 3, 8],
457             self.mix4aes2_solo:  ['/Mixer/solo', 3, 9],
458             self.mix4spdif1_solo: ['/Mixer/solo', 3, 10],
459             self.mix4spdif2_solo: ['/Mixer/solo', 3, 11],
460             self.mix4adat1_solo: ['/Mixer/solo', 3, 12],
461             self.mix4adat2_solo: ['/Mixer/solo', 3, 13],
462             self.mix4adat3_solo: ['/Mixer/solo', 3, 14],
463             self.mix4adat4_solo: ['/Mixer/solo', 3, 15],
464             self.mix4adat5_solo: ['/Mixer/solo', 3, 16],
465             self.mix4adat6_solo: ['/Mixer/solo', 3, 17],
466             self.mix4adat7_solo: ['/Mixer/solo', 3, 18],
467             self.mix4adat8_solo: ['/Mixer/solo', 3, 19],
468         }
469
470         self.BinarySwitches={
471             self.mix1_mute:      ['/Mixer/Mix1/Mix_mute'],
472             self.mix2_mute:      ['/Mixer/Mix2/Mix_mute'],
473             self.mix3_mute:      ['/Mixer/Mix3/Mix_mute'],
474             self.mix4_mute:      ['/Mixer/Mix4/Mix_mute'],
475
476             self.ana1_pad:       ['/Mixer/Control/Ana1_pad'],
477             self.ana2_pad:       ['/Mixer/Control/Ana2_pad'],
478             self.ana3_pad:       ['/Mixer/Control/Ana3_pad'],
479             self.ana4_pad:       ['/Mixer/Control/Ana4_pad'],
480             self.ana5_level:     ['/Mixer/Control/Ana5_level'],
481             self.ana6_level:     ['/Mixer/Control/Ana6_level'],
482             self.ana7_level:     ['/Mixer/Control/Ana7_level'],
483             self.ana8_level:     ['/Mixer/Control/Ana8_level'],
484             self.ana5_boost:     ['/Mixer/Control/Ana5_boost'],
485             self.ana6_boost:     ['/Mixer/Control/Ana6_boost'],
486             self.ana7_boost:     ['/Mixer/Control/Ana7_boost'],
487             self.ana8_boost:     ['/Mixer/Control/Ana8_boost'],
488
489             # Some interfaces have level/boost on analog 1-4 in place of trimgain/pad
490             self.ana1_level:     ['/Mixer/Control/Ana1_level'],
491             self.ana2_level:     ['/Mixer/Control/Ana2_level'],
492             self.ana3_level:     ['/Mixer/Control/Ana3_level'],
493             self.ana4_level:     ['/Mixer/Control/Ana4_level'],
494             self.ana1_boost:     ['/Mixer/Control/Ana1_boost'],
495             self.ana2_boost:     ['/Mixer/Control/Ana2_boost'],
496             self.ana3_boost:     ['/Mixer/Control/Ana3_boost'],
497             self.ana4_boost:     ['/Mixer/Control/Ana4_boost'],
498
499         }
500
501         # Ultimately these may be rolled into the BinarySwitches controls,
502         # but since they aren't implemented and therefore need to be
503         # disabled it's easier to keep them separate for the moment.  The
504         # dbus path for these is yet to be finalised too - for example we
505         # may end up using a matrix mixer.
506         self.PairSwitches={
507 #            self.mix1ana1_2_pair:   ['Mixer/Mix1/Ana1_2_pair'],
508 #            self.mix1ana3_4_pair:   ['Mixer/Mix1/Ana3_4_pair'],
509 #            self.mix1ana5_6_pair:   ['Mixer/Mix1/Ana5_6_pair'],
510 #            self.mix1ana7_8_pair:   ['Mixer/Mix1/Ana7_8_pair'],
511 #            self.mix1aes1_2_pair:   ['Mixer/Mix1/Aes1_2_pair'],
512 #            self.mix1adat1_2_pair:  ['Mixer/Mix1/Adat1_2_pair'],
513 #            self.mix1adat3_4_pair:  ['Mixer/Mix1/Adat3_4_pair'],
514 #            self.mix1adat5_6_pair:  ['Mixer/Mix1/Adat5_6_pair'],
515 #            self.mix1adat7_8_pair:  ['Mixer/Mix1/Adat7_8_pair'],
516 #            self.mix1spdif1_2_pair: ['Mixer/Mix1/Spdif1_2_pair'],
517
518 #            self.mix2ana1_2_pair:   ['Mixer/Mix2/Ana1_2_pair'],
519 #            self.mix2ana3_4_pair:   ['Mixer/Mix2/Ana3_4_pair'],
520 #            self.mix2ana5_6_pair:   ['Mixer/Mix2/Ana5_6_pair'],
521 #            self.mix2ana7_8_pair:   ['Mixer/Mix2/Ana7_8_pair'],
522 #            self.mix2aes1_2_pair:   ['Mixer/Mix2/Aes1_2_pair'],
523 #            self.mix2adat1_2_pair:  ['Mixer/Mix2/Adat1_2_pair'],
524 #            self.mix2adat3_4_pair:  ['Mixer/Mix2/Adat3_4_pair'],
525 #            self.mix2adat5_6_pair:  ['Mixer/Mix2/Adat5_6_pair'],
526 #            self.mix2adat7_8_pair:  ['Mixer/Mix2/Adat7_8_pair'],
527 #            self.mix2spdif1_2_pair: ['Mixer/Mix2/Spdif1_2_pair'],
528
529 #            self.mix3ana1_2_pair:   ['Mixer/Mix3/Ana1_2_pair'],
530 #            self.mix3ana3_4_pair:   ['Mixer/Mix3/Ana3_4_pair'],
531 #            self.mix3ana5_6_pair:   ['Mixer/Mix3/Ana5_6_pair'],
532 #            self.mix3ana7_8_pair:   ['Mixer/Mix3/Ana7_8_pair'],
533 #            self.mix3aes1_2_pair:   ['Mixer/Mix3/Aes1_2_pair'],
534 #            self.mix3adat1_2_pair:  ['Mixer/Mix3/Adat1_2_pair'],
535 #            self.mix3adat3_4_pair:  ['Mixer/Mix3/Adat3_4_pair'],
536 #            self.mix3adat5_6_pair:  ['Mixer/Mix3/Adat5_6_pair'],
537 #            self.mix3adat7_8_pair:  ['Mixer/Mix3/Adat7_8_pair'],
538 #            self.mix3spdif1_2_pair: ['Mixer/Mix3/Spdif1_2_pair'],
539
540 #            self.mix4ana1_2_pair:   ['Mixer/Mix4/Ana1_2_pair'],
541 #            self.mix4ana3_4_pair:   ['Mixer/Mix4/Ana3_4_pair'],
542 #            self.mix4ana5_6_pair:   ['Mixer/Mix4/Ana5_6_pair'],
543 #            self.mix4ana7_8_pair:   ['Mixer/Mix4/Ana7_8_pair'],
544 #            self.mix4aes1_2_pair:   ['Mixer/Mix4/Aes1_2_pair'],
545 #            self.mix4adat1_2_pair:  ['Mixer/Mix4/Adat1_2_pair'],
546 #            self.mix4adat3_4_pair:  ['Mixer/Mix4/Adat3_4_pair'],
547 #            self.mix4adat5_6_pair:  ['Mixer/Mix4/Adat5_6_pair'],
548 #            self.mix4adat7_8_pair:  ['Mixer/Mix4/Adat7_8_pair'],
549 #            self.mix4spdif1_2_pair: ['Mixer/Mix4/Spdif1_2_pair'],
550         }
551
552         self.MixDests={
553             self.mix1_dest:      ['/Mixer/Mix1/Mix_dest'],
554             self.mix2_dest:      ['/Mixer/Mix2/Mix_dest'],
555             self.mix3_dest:      ['/Mixer/Mix3/Mix_dest'],
556             self.mix4_dest:      ['/Mixer/Mix4/Mix_dest'],
557
558             self.phones_src:     ['/Mixer/Control/Phones_src'],
559
560             self.optical_in_mode:   ['/Mixer/Control/OpticalIn_mode'],
561             self.optical_out_mode:  ['/Mixer/Control/OpticalOut_mode'],
562
563             self.meter_src_ctrl:    ['/Mixer/Control/Meter_src'],
564             self.aesebu_meter_ctrl: ['/Mixer/Control/Meter_aesebu_src'],
565             self.peakhold_time_ctrl:['/Mixer/Control/Meter_peakhold_time'],
566             self.cliphold_time_ctrl:['/Mixer/Control/Meter_cliphold_time'],
567         }
568
569         self.SelectorControls={
570
571         }
572
573         # Other mixer variables
574         self.is_streaming = 0
575         self.sample_rate = 0
576         self.model = MOTU_MODEL_NONE
577
578     def initValues(self):
579         # Is the device streaming?
580         self.is_streaming = self.hw.getDiscrete('/Mixer/Info/IsStreaming')
581         print "device streaming flag: %d" % (self.is_streaming)
582
583         # Retrieve other device settings as needed
584         self.model = self.hw.getDiscrete('/Mixer/Info/Model')
585         print "device model identifier: %d" % (self.model)
586         self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate')
587         print "device sample rate: %d" % (self.sample_rate)
588         self.has_mic_inputs = self.hw.getDiscrete('/Mixer/Info/HasMicInputs')
589         print "device has mic inputs: %d" % (self.has_mic_inputs)
590         self.has_aesebu_inputs = self.hw.getDiscrete('/Mixer/Info/HasAESEBUInputs')
591         print "device has AES/EBU inputs: %d" % (self.has_aesebu_inputs)
592         self.has_spdif_inputs = self.hw.getDiscrete('/Mixer/Info/HasSPDIFInputs')
593         print "device has SPDIF inputs: %d" % (self.has_spdif_inputs)
594         self.has_optical_spdif = self.hw.getDiscrete('/Mixer/Info/HasOpticalSPDIF')
595         print "device has optical SPDIF: %d" % (self.has_optical_spdif)
596
597         # Customise the UI based on device options retrieved
598         if (self.has_mic_inputs):
599             # Mic input controls displace AES/EBU since no current device
600             # has both.
601             self.mix1_tab.page(1).setTabLabel("Mic inputs");
602             self.mix2_tab.page(1).setTabLabel("Mic inputs");
603             self.mix3_tab.page(1).setTabLabel("Mic inputs");
604             self.mix4_tab.page(1).setTabLabel("Mic inputs");
605             # FIXME: when implmented, will mic channels just reuse the AES/EBU
606             # dbus path?  If not we'll have to reset the respective values in
607             # the control arrays (self.ChannelFaders etc).
608         else:
609             if (not(self.has_aesebu_inputs)):
610                 self.mix1_tab.page(1).setEnabled(False)
611                 self.mix2_tab.page(1).setEnabled(False)
612                 self.mix3_tab.page(1).setEnabled(False)
613                 self.mix4_tab.page(1).setEnabled(False)
614         if (not(self.has_spdif_inputs)):
615             self.mix1_tab.page(2).setEnabled(False);
616             self.mix2_tab.page(2).setEnabled(False);
617             self.mix3_tab.page(2).setEnabled(False);
618             self.mix4_tab.page(2).setEnabled(False);
619
620         # Devices without AES/EBU inputs/outputs (normally ID 6 in the
621         # destination lists) have dedicated "MainOut" outputs instead.  The
622         # 896HD is an exception: it uses ID 6 for MainOut and ID 7
623         # (nominally SPDIF) for AES/EBU.
624         if (not(self.has_aesebu_inputs) or self.model==MOTU_MODEL_896HD):
625             self.mix1_dest.changeItem("MainOut", 6)
626             self.mix2_dest.changeItem("MainOut", 6)
627             self.mix3_dest.changeItem("MainOut", 6)
628             self.mix4_dest.changeItem("MainOut", 6)
629             self.phones_src.changeItem("MainOut", 6)
630         # Change the SPDIF destination to AES/EBU for the 896HD.
631         if (self.model == MOTU_MODEL_896HD):
632             self.mix1_dest.changeItem("AES/EBU", 7)
633             self.mix2_dest.changeItem("AES/EBU", 7)
634             self.mix3_dest.changeItem("AES/EBU", 7)
635             self.mix4_dest.changeItem("AES/EBU", 7)
636             self.phones_src.changeItem("AES/EBU", 7)
637
638         # Some devices don't have the option of selecting an optical SPDIF
639         # mode.
640         if (not(self.has_optical_spdif)):
641             self.optical_in_mode.removeItem(2)
642             self.optical_out_mode.removeItem(2)
643
644         # Only the 896HD has meter controls
645         if (self.model != MOTU_MODEL_896HD):
646             self.disable_hide(self.meter_src)
647             self.disable_hide(self.aesebu_meter)
648             self.disable_hide(self.peakhold_time)
649             self.disable_hide(self.cliphold_time)
650
651         # Some controls must be disabled if the device is streaming
652         if (self.is_streaming):
653             print "Disabling controls which require inactive streaming"
654             self.optical_in_mode.setEnabled(False)
655             self.optical_out_mode.setEnabled(False)
656
657         # Some channels aren't available at higher sampling rates
658         if (self.sample_rate > 96000):
659             print "Disabling controls not present above 96 kHz"
660             self.mix1_tab.page(3).setEnabled(False)  # ADAT
661             self.mix1_tab.page(2).setEnabled(False)  # SPDIF
662             self.mix1_tab.page(1).setEnabled(False)  # AES/EBU
663             self.mix2_tab.page(3).setEnabled(False)  # ADAT
664             self.mix2_tab.page(2).setEnabled(False)  # SPDIF
665             self.mix2_tab.page(1).setEnabled(False)  # AES/EBU
666             self.mix3_tab.page(3).setEnabled(False)  # ADAT
667             self.mix3_tab.page(2).setEnabled(False)  # SPDIF
668             self.mix3_tab.page(1).setEnabled(False)  # AES/EBU
669             self.mix4_tab.page(3).setEnabled(False)  # ADAT
670             self.mix4_tab.page(2).setEnabled(False)  # SPDIF
671             self.mix4_tab.page(1).setEnabled(False)  # AES/EBU
672         if (self.sample_rate > 48000):
673             print "Disabling controls not present above 48 kHz"
674             self.mix1_adat5.setEnabled(False)
675             self.mix1_adat6.setEnabled(False)
676             self.mix1_adat7.setEnabled(False)
677             self.mix1_adat8.setEnabled(False)
678             self.mix2_adat5.setEnabled(False)
679             self.mix2_adat6.setEnabled(False)
680             self.mix2_adat7.setEnabled(False)
681             self.mix2_adat8.setEnabled(False)
682             self.mix3_adat5.setEnabled(False)
683             self.mix3_adat6.setEnabled(False)
684             self.mix3_adat7.setEnabled(False)
685             self.mix3_adat8.setEnabled(False)
686             self.mix4_adat5.setEnabled(False)
687             self.mix4_adat6.setEnabled(False)
688             self.mix4_adat7.setEnabled(False)
689             self.mix4_adat8.setEnabled(False)
690
691         # Ensure the correct input controls are active for a given interface
692         if (self.model == MOTU_MODEL_TRAVELER):
693             self.disable_hide(self.ana1_level)
694             self.disable_hide(self.ana2_level)
695             self.disable_hide(self.ana3_level)
696             self.disable_hide(self.ana4_level)
697             self.disable_hide(self.ana1_boost)
698             self.disable_hide(self.ana2_boost)
699             self.disable_hide(self.ana3_boost)
700             self.disable_hide(self.ana4_boost)
701             self.disable_hide(self.ana5_trimgain)
702             self.disable_hide(self.ana5_trimgain_label)
703             self.disable_hide(self.ana6_trimgain)
704             self.disable_hide(self.ana6_trimgain_label)
705             self.disable_hide(self.ana7_trimgain)
706             self.disable_hide(self.ana7_trimgain_label)
707             self.disable_hide(self.ana8_trimgain)
708             self.disable_hide(self.ana8_trimgain_label)
709             self.disable_hide(self.ana5_pad)
710             self.disable_hide(self.ana6_pad)
711             self.disable_hide(self.ana7_pad)
712             self.disable_hide(self.ana8_pad)
713         else:
714             self.disable_hide(self.ana1_trimgain)
715             self.disable_hide(self.ana1_trimgain_label)
716             self.disable_hide(self.ana2_trimgain)
717             self.disable_hide(self.ana2_trimgain_label)
718             self.disable_hide(self.ana3_trimgain)
719             self.disable_hide(self.ana3_trimgain_label)
720             self.disable_hide(self.ana4_trimgain)
721             self.disable_hide(self.ana4_trimgain_label)
722             self.disable_hide(self.ana1_pad)
723             self.disable_hide(self.ana2_pad)
724             self.disable_hide(self.ana3_pad)
725             self.disable_hide(self.ana4_pad)
726             self.disable_hide(self.ana5_trimgain)
727             self.disable_hide(self.ana5_trimgain_label)
728             self.disable_hide(self.ana6_trimgain)
729             self.disable_hide(self.ana6_trimgain_label)
730             self.disable_hide(self.ana7_trimgain)
731             self.disable_hide(self.ana7_trimgain_label)
732             self.disable_hide(self.ana8_trimgain)
733             self.disable_hide(self.ana8_trimgain_label)
734             self.disable_hide(self.ana5_pad)
735             self.disable_hide(self.ana6_pad)
736             self.disable_hide(self.ana7_pad)
737             self.disable_hide(self.ana8_pad)
738
739         # Now fetch the current values into the respective controls.  Don't
740         # bother fetching controls which are disabled.
741         for ctrl, info in self.ChannelFaders.iteritems():
742             if (not(ctrl.isEnabled())):
743                 continue
744             vol = 128-self.hw.getMatrixMixerValue(info[0], info[1], info[2])
745             print "%s for mix %d channel %d is %d" % (info[0], info[1], info[2], vol)
746             ctrl.setValue(vol)
747             QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateChannelFader)
748
749         for ctrl, info in self.Faders.iteritems():
750             if (not(ctrl.isEnabled())):
751                 continue
752             vol = 128-self.hw.getDiscrete(info[0])
753             print "%s mix fader is %d" % (info[0] , vol)
754             ctrl.setValue(vol)
755             QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateFader)
756
757         for ctrl, info in self.ChannelControls.iteritems():
758             if (not(ctrl.isEnabled())):
759                 continue
760             pan = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
761             print "%s for mix %d channel %d is %d" % (info[0], info[1], info[2], pan)
762             ctrl.setValue(pan)
763             QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateChannelControl)
764
765         for ctrl, info in self.Controls.iteritems():
766             if (not(ctrl.isEnabled())):
767                 continue
768             pan = self.hw.getDiscrete(info[0])
769             print "%s control is %d" % (info[0] , pan)
770             ctrl.setValue(pan)
771             QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateControl)
772
773         # Disable the channel pair controls since they aren't yet implemented
774         for ctrl, info in self.PairSwitches.iteritems():
775             print "%s control is not implemented yet: disabling" % (info[0])
776             ctrl.setEnabled(False)
777
778         for ctrl, info in self.ChannelBinarySwitches.iteritems():
779             if (not(ctrl.isEnabled())):
780                 continue
781             val = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
782             print "%s for mix %d channel %d is %d" % (info[0] , info[1], info[2], val)
783             ctrl.setOn(val)
784             QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updateChannelBinarySwitch)
785
786         for ctrl, info in self.BinarySwitches.iteritems():
787             if (not(ctrl.isEnabled())):
788                 continue
789             val = self.hw.getDiscrete(info[0])
790             print "%s switch is %d" % (info[0] , val)
791             ctrl.setOn(val)
792             QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updateBinarySwitch)
793
794         for ctrl, info in self.MixDests.iteritems():
795             if (not(ctrl.isEnabled())):
796                 continue
797             dest = self.hw.getDiscrete(info[0])
798             print "%s mix destination is %d" % (info[0] , dest)
799             ctrl.setCurrentItem(dest)
800             QObject.connect(ctrl, SIGNAL('activated(int)'), self.updateMixDest)
801
802         for name, ctrl in self.SelectorControls.iteritems():
803             state = self.hw.getDiscrete(ctrl[0])
804             print "%s state is %d" % (name , state)
805             ctrl[1].setCurrentItem(state)   
806
807         # FIXME: If optical mode is not ADAT, disable ADAT controls here.
808         # It can't be done earlier because we need the current values of the
809         # ADAT channel controls in case the user goes ahead and enables the
810         # ADAT optical mode.
Note: See TracBrowser for help on using the browser.