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

Revision 1881, 43.2 kB (checked in by jwoithe, 11 years ago)

MOTU: include IDs for the Traveler Mk3 and 896HD Mk3 in the mixer and count these as generation-3 devices.

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