root/trunk/libffado/support/mixer-qt4/ffado/mixer/motu.py

Revision 1873, 43.1 kB (checked in by jwoithe, 11 years ago)

MOTU: fix a bug in the MOTU mixer which caused ffadomixer to crash out with a python error. The bug was added in r1840 - sorry about that. Thanks to Luke Yelavich for posting a debug trace which unearthed this bug.

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