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

Revision 1837, 42.6 kB (checked in by jwoithe, 11 years ago)

MOTU: 8pre: disable the phones / main fader mixer widgets because these controls are not software controllable on the 8pre and thus aren't accessible via the dbus interface.
MOTU: 8pre: add pad controls to the channel matrix mixers so the ADAT controls show up at the same place in the matrix mixers as they do on other devices. See also r1384 where a similar issue was addressed for the Ultralite.
MOTU: 8pre: add some pad channels to enlarge the 1x rate data packets to the sizes seen under other systems.

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