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

Revision 1365, 40.2 kB (checked in by jwoithe, 12 years ago)

MOTU: disable ADAT mixer controls for the Ultralite since it doesn't include ADAT channels

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