root/trunk/libffado/support/mixer-qt4/mixer_motu.py

Revision 1501, 41.0 kB (checked in by ppalmers, 12 years ago)

fix merge issues with the QT4 mixer

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