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

Revision 1385, 23.8 kB (checked in by ppalmers, 12 years ago)

Implement a mechanism to disable the samplerate and clock source controls while the device is streaming in order to avoid changes that could mess up jack. The saffire pro controls that cause a device reset to
happen are also disabled while streaming is active.

Line 
1 #
2 # Copyright (C) 2005-2008 by Pieter Palmers
3 #
4 # This file is part of FFADO
5 # FFADO = Free Firewire (pro-)audio drivers for linux
6 #
7 # FFADO is based upon FreeBoB.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 2 of the License, or
12 # (at your option) version 3 of the License.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 #
22
23 from PyQt4.QtGui import QWidget, QHBoxLayout, QMessageBox
24 from mixer_saffire_base import SaffireMixerBase
25 from mixer_saffirepro_largeui import Ui_SaffireProMixerLargeUI
26 from mixer_saffirepro_smallui import Ui_SaffireProMixerSmallUI
27
28 import logging
29 log = logging.getLogger('saffirepro')
30
31 class SaffireProMixer(QWidget):
32     def __init__(self,parent = None):
33         QWidget.__init__(self, parent)
34
35         self.have_adat = False
36         self.samplerate = None
37         self.is_pro10 = None
38
39         # make a layout
40         self.layout = QHBoxLayout()
41         self.setLayout(self.layout)
42
43     def show(self):
44         self.selectCorrectMode()
45         QWidget.show(self)
46
47     def getDisplayTitle(self):
48         try:
49             return self.nickname.text()
50         except:
51             if self.is_pro10:
52                 return "SaffirePRO10"
53             else:
54                 return "SaffirePRO26"
55
56     def selectCorrectMode(self):
57         if self.samplerate <= 96000:
58             log.debug("large")
59             self.small.hide()
60             self.large.initValues()
61             self.large.show()
62         else:
63             log.debug("small")
64             self.large.hide()
65             self.small.initValues()
66             self.small.show()
67
68     def initValues(self):
69         self.is_not_streaming = self.samplerateselect.canChangeValue()
70         selected = self.samplerateselect.selected()
71         self.samplerate = int(self.samplerateselect.getEnumLabel( selected ))
72         log.debug("detected samplerate %d" % self.samplerate)
73
74         # adat on PRO26 makes a difference
75         modelId = self.configrom.getModelId()
76         if modelId == 0x00000003: # PRO26
77             self.is_pro10 = False
78             state = self.hw.getDiscrete('/Control/ADATDisable')
79             if state:
80                 self.have_adat = False
81                 log.debug("detected PRO26, ADAT disabled")
82             else:
83                 self.have_adat = True
84                 log.debug("detected PRO26, ADAT enabled")
85         elif modelId == 0x00000006: # PRO10
86             self.is_pro10 = True
87             self.have_adat = False
88
89         # create the child widgets
90         self.small = SaffireProMixerSmall(self)
91         self.layout.addWidget(self.small)
92         self.large = SaffireProMixerLarge(self)
93         self.layout.addWidget(self.large)
94
95         self.small.hw = self.hw
96         self.small.configrom = self.configrom
97
98         self.large.hw = self.hw
99         self.large.configrom = self.configrom
100
101         self.selectCorrectMode()
102
103     def polledUpdate(self):
104         self.is_not_streaming = self.samplerateselect.canChangeValue()
105         if self.samplerate <= 96000:
106             self.large.polledUpdate()
107         else:
108             self.small.polledUpdate()
109
110 class SaffireProMixerLarge(QWidget, Ui_SaffireProMixerLargeUI, SaffireMixerBase):
111     def __init__(self,parent = None):
112         self.my_parent = parent
113         QWidget.__init__(self,parent)
114         SaffireMixerBase.__init__(self)
115         self.setupUi(self)
116         self.have_adat = False
117         log.debug("Init large Saffire Pro mixer window")
118
119         self.VolumeControls={
120             self.sldIMixAnalog1L: ['/Mixer/InputMix', 0, 0],
121             self.sldIMixAnalog1R: ['/Mixer/InputMix', 0, 1],
122             self.sldIMixAnalog2L: ['/Mixer/InputMix', 1, 0],
123             self.sldIMixAnalog2R: ['/Mixer/InputMix', 1, 1],
124             self.sldIMixAnalog3L: ['/Mixer/InputMix', 2, 0],
125             self.sldIMixAnalog3R: ['/Mixer/InputMix', 2, 1],
126             self.sldIMixAnalog4L: ['/Mixer/InputMix', 3, 0],
127             self.sldIMixAnalog4R: ['/Mixer/InputMix', 3, 1],
128             self.sldIMixAnalog5L: ['/Mixer/InputMix', 4, 0],
129             self.sldIMixAnalog5R: ['/Mixer/InputMix', 4, 1],
130             self.sldIMixAnalog6L: ['/Mixer/InputMix', 5, 0],
131             self.sldIMixAnalog6R: ['/Mixer/InputMix', 5, 1],
132             self.sldIMixAnalog7L: ['/Mixer/InputMix', 6, 0],
133             self.sldIMixAnalog7R: ['/Mixer/InputMix', 6, 1],
134             self.sldIMixAnalog8L: ['/Mixer/InputMix', 7, 0],
135             self.sldIMixAnalog8R: ['/Mixer/InputMix', 7, 1],
136             self.sldIMixAnalog9L: ['/Mixer/InputMix', 8, 0],
137             self.sldIMixAnalog9R: ['/Mixer/InputMix', 8, 1],
138             self.sldIMixAnalog10L: ['/Mixer/InputMix', 9, 0],
139             self.sldIMixAnalog10R: ['/Mixer/InputMix', 9, 1],
140             self.sldIMixADAT11L: ['/Mixer/InputMix', 10, 0],
141             self.sldIMixADAT11R: ['/Mixer/InputMix', 10, 1],
142             self.sldIMixADAT12L: ['/Mixer/InputMix', 11, 0],
143             self.sldIMixADAT12R: ['/Mixer/InputMix', 11, 1],
144             self.sldIMixADAT13L: ['/Mixer/InputMix', 12, 0],
145             self.sldIMixADAT13R: ['/Mixer/InputMix', 12, 1],
146             self.sldIMixADAT14L: ['/Mixer/InputMix', 13, 0],
147             self.sldIMixADAT14R: ['/Mixer/InputMix', 13, 1],
148             self.sldIMixADAT15L: ['/Mixer/InputMix', 14, 0],
149             self.sldIMixADAT15R: ['/Mixer/InputMix', 14, 1],
150             self.sldIMixADAT16L: ['/Mixer/InputMix', 15, 0],
151             self.sldIMixADAT16R: ['/Mixer/InputMix', 15, 1],
152             self.sldIMixADAT17L: ['/Mixer/InputMix', 16, 0],
153             self.sldIMixADAT17R: ['/Mixer/InputMix', 16, 1],
154             self.sldIMixADAT18L: ['/Mixer/InputMix', 17, 0],
155             self.sldIMixADAT18R: ['/Mixer/InputMix', 17, 1],
156             self.sldIMixADAT21L: ['/Mixer/InputMix', 18, 0],
157             self.sldIMixADAT21R: ['/Mixer/InputMix', 18, 1],
158             self.sldIMixADAT22L: ['/Mixer/InputMix', 19, 0],
159             self.sldIMixADAT22R: ['/Mixer/InputMix', 19, 1],
160             self.sldIMixADAT23L: ['/Mixer/InputMix', 20, 0],
161             self.sldIMixADAT23R: ['/Mixer/InputMix', 20, 1],
162             self.sldIMixADAT24L: ['/Mixer/InputMix', 21, 0],
163             self.sldIMixADAT24R: ['/Mixer/InputMix', 21, 1],
164             self.sldIMixADAT25L: ['/Mixer/InputMix', 22, 0],
165             self.sldIMixADAT25R: ['/Mixer/InputMix', 22, 1],
166             self.sldIMixADAT26L: ['/Mixer/InputMix', 23, 0],
167             self.sldIMixADAT26R: ['/Mixer/InputMix', 23, 1],
168             self.sldIMixADAT27L: ['/Mixer/InputMix', 24, 0],
169             self.sldIMixADAT27R: ['/Mixer/InputMix', 24, 1],
170             self.sldIMixADAT28L: ['/Mixer/InputMix', 25, 0],
171             self.sldIMixADAT28R: ['/Mixer/InputMix', 25, 1],
172            
173             self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
174             self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
175             self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
176             self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
177             self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
178             self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
179             self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
180             self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
181             self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
182             self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
183            
184             self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
185             self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
186             self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
187             self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
188             self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
189             self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
190             self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
191             self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
192            
193             self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
194             self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
195             self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
196             self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
197             self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
198             self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
199             self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
200             self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
201             self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
202             self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
203             }
204
205
206         self.SelectorControls={
207             # control elements
208             self.chkInsert1: ['/Control/Insert1'],
209             self.chkInsert2: ['/Control/Insert2'],
210             self.chkPhantom14: ['/Control/Phantom_1to4'],
211             self.chkPhantom58: ['/Control/Phantom_5to8'],
212             self.chkAC3: ['/Control/AC3pass'],
213             self.chkMidiThru: ['/Control/MidiTru'],
214             self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
215             #self.chkEnableADAT1: ['/Control/EnableAdat1'],
216             #self.chkEnableADAT2: ['/Control/EnableAdat2'],
217             #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
218             self.chkMidiEnable: ['/Control/MIDIEnable'],
219             self.chkAdatDisable: ['/Control/ADATDisable'],
220             # Mixer switches
221             self.chkMute12: ['/Mixer/Out12Mute', [self.chkHwCtrl12]],
222             self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
223             self.chkPad12: ['/Mixer/Out12Pad'],
224             self.chkDim12: ['/Mixer/Out12Dim'],
225             self.chkMute34: ['/Mixer/Out34Mute', [self.chkHwCtrl34]],
226             self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
227             self.chkPad34: ['/Mixer/Out34Pad'],
228             self.chkDim34: ['/Mixer/Out34Dim'],
229             self.chkMute56: ['/Mixer/Out56Mute', [self.chkHwCtrl56]],
230             self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
231             self.chkPad56: ['/Mixer/Out56Pad'],
232             self.chkDim56: ['/Mixer/Out56Dim'],
233             self.chkMute78: ['/Mixer/Out78Mute', [self.chkHwCtrl78]],
234             self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
235             self.chkPad78: ['/Mixer/Out78Pad'],
236             self.chkDim78: ['/Mixer/Out78Dim'],
237             # direct monitoring
238             self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
239             self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
240             self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
241             self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
242             self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
243             self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
244             self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
245             self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
246         }
247
248         self.VolumeControlsLowRes={
249             self.sldOut12Level:      ['/Mixer/Out12Level'],
250             self.sldOut34Level:      ['/Mixer/Out34Level'],
251             self.sldOut56Level:      ['/Mixer/Out56Level'],
252             self.sldOut78Level:      ['/Mixer/Out78Level'],
253         }
254
255         self.TriggerButtonControls={
256             self.btnReboot:        ['/Control/Reboot'],
257             self.btnIdentify:      ['/Control/FlashLed'],
258             self.btnSaveSettings:  ['/Control/SaveSettings'],
259         }
260
261         self.TextControls={
262         }
263
264         self.saveTextControls={
265         }
266
267         self.ComboControls={
268             self.comboStandalone:        ['/Control/StandaloneConfig'],
269         }
270
271     def updateMatrixVolume(self,a0):
272         SaffireMixerBase.updateMatrixVolume(self,a0)
273     def updateLowResVolume(self,a0):
274         SaffireMixerBase.updateLowResVolume(self,a0)
275     def updateSelector(self,a0):
276         sender = self.sender()
277         #if sender == self.chkAC3 and not self.my_parent.is_not_streaming:
278             #msg = QMessageBox()
279             #msg.question( msg, "Error", \
280                 #"<qt>Change not permitted. Is streaming active?</qt>", \
281                 #QMessageBox.Ok )
282             #self.chkAC3.setEnabled(False)
283             #if a0:
284                 #self.chkAC3.setChecked(False)
285             #else:
286                 #self.chkAC3.setChecked(True)
287             #return
288         if sender == self.chkMidiEnable and not self.my_parent.is_not_streaming:
289             msg = QMessageBox()
290             msg.question( msg, "Error", \
291                 "<qt>Change not permitted. Is streaming active?</qt>", \
292                 QMessageBox.Ok )
293             self.chkMidiEnable.setEnabled(False)
294             state = self.hw.getDiscrete(self.SelectorControls[self.chkMidiEnable][0])
295             if state:
296                 self.chkMidiEnable.setChecked(True)
297             else:
298                 self.chkMidiEnable.setChecked(False)
299             return
300         if sender == self.chkAdatDisable and not self.my_parent.is_not_streaming:
301             msg = QMessageBox()
302             msg.question( msg, "Error", \
303                 "<qt>Change not permitted. Is streaming active?</qt>", \
304                 QMessageBox.Ok )
305             self.chkAdatDisable.setEnabled(False)
306             state = self.hw.getDiscrete(self.SelectorControls[self.chkAdatDisable][0])
307             if state:
308                 self.chkAdatDisable.setChecked(True)
309             else:
310                 self.chkAdatDisable.setChecked(False)
311             return
312         SaffireMixerBase.updateSelector(self,a0)
313
314     def triggerButton(self):
315         sender = self.sender()
316         if sender == self.btnReboot and not self.my_parent.is_not_streaming:
317             msg = QMessageBox()
318             msg.question( msg, "Error", \
319                 "<qt>Operation not permitted. Is streaming active?</qt>", \
320                 QMessageBox.Ok )
321             self.btnReboot.setEnabled(False)
322             return
323         SaffireMixerBase.triggerButton(self)
324
325     def saveText(self):
326         SaffireMixerBase.saveText(self)
327     def initCombo(self, combo):
328         SaffireMixerBase.initCombo(self,combo)
329     def selectCombo(self, mode):
330         SaffireMixerBase.selectCombo(self,mode)
331
332     def updateValues(self):
333         for i in range(self.tabInputMix.count()):
334             self.tabInputMix.setTabEnabled(i, True)
335
336         if not self.my_parent.have_adat:
337             for i in range(self.tabInputMix.count()):
338                 page = self.tabInputMix.widget(i)
339                 name = page.objectName()
340                 if name[0:4] == "adat":
341                     self.tabInputMix.setTabEnabled(i, False)
342                 else:
343                     self.tabInputMix.setTabEnabled(i, True)
344
345         self.tabInputMix.setCurrentWidget(self.tabInputMix.widget(0))
346         SaffireMixerBase.updateValues(self)
347
348     def polledUpdate(self):
349         #log.debug("polled update (large)")
350         self.polledUpdateHwCtrl(self.chkHwCtrl12, self.sldOut12Level)
351         self.polledUpdateHwCtrl(self.chkHwCtrl34, self.sldOut34Level)
352         self.polledUpdateHwCtrl(self.chkHwCtrl56, self.sldOut56Level)
353         self.polledUpdateHwCtrl(self.chkHwCtrl78, self.sldOut78Level)
354
355         #make these inaccessible whenever streaming is running
356         #self.chkAC3.setEnabled(self.my_parent.is_not_streaming)
357         self.chkMidiEnable.setEnabled(self.my_parent.is_not_streaming)
358         self.chkAdatDisable.setEnabled(self.my_parent.is_not_streaming)
359         self.btnReboot.setEnabled(self.my_parent.is_not_streaming)
360
361     def polledUpdateHwCtrl(self, selector, volctrl):
362         state = selector.isChecked()
363         if state:
364             self.polledUpdateVolumeLowRes('/Mixer/MonitorDial', volctrl, 2)
365             volctrl.setEnabled(False)
366         else:
367             volctrl.setEnabled(True)
368
369 class SaffireProMixerSmall(QWidget, Ui_SaffireProMixerSmallUI, SaffireMixerBase):
370     def __init__(self,parent = None):
371         self.my_parent = parent
372         QWidget.__init__(self,parent)
373         SaffireMixerBase.__init__(self)
374         self.setupUi(self)
375         log.debug("Init small Saffire Pro mixer window")
376
377         self.VolumeControls={
378
379             self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
380             self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
381             self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
382             self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
383             self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
384             self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
385             self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
386             self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
387             self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
388             self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
389            
390             self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
391             self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
392             self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
393             self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
394             self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
395             self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
396             self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
397             self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
398            
399             self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
400             self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
401             self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
402             self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
403             self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
404             self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
405             self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
406             self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
407             self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
408             self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
409             }
410
411
412         self.SelectorControls={
413             # control elements
414             self.chkInsert1: ['/Control/Insert1'],
415             self.chkInsert2: ['/Control/Insert2'],
416             self.chkPhantom14: ['/Control/Phantom_1to4'],
417             self.chkPhantom58: ['/Control/Phantom_5to8'],
418             self.chkAC3: ['/Control/AC3pass'],
419             self.chkMidiThru: ['/Control/MidiTru'],
420             self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
421             #self.chkEnableADAT1: ['/Control/EnableAdat1'],
422             #self.chkEnableADAT2: ['/Control/EnableAdat2'],
423             #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
424             self.chkMidiEnable: ['/Control/MIDIEnable'],
425             self.chkAdatDisable: ['/Control/ADATDisable'],
426             # Mixer switches
427             self.chkMute12: ['/Mixer/Out12Mute'],
428             self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
429             self.chkPad12: ['/Mixer/Out12Pad'],
430             self.chkDim12: ['/Mixer/Out12Dim'],
431             self.chkMute34: ['/Mixer/Out34Mute'],
432             self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
433             self.chkPad34: ['/Mixer/Out34Pad'],
434             self.chkDim34: ['/Mixer/Out34Dim'],
435             self.chkMute56: ['/Mixer/Out56Mute'],
436             self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
437             self.chkPad56: ['/Mixer/Out56Pad'],
438             self.chkDim56: ['/Mixer/Out56Dim'],
439             self.chkMute78: ['/Mixer/Out78Mute'],
440             self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
441             self.chkPad78: ['/Mixer/Out78Pad'],
442             self.chkDim78: ['/Mixer/Out78Dim'],
443             # direct monitoring
444             self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
445             self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
446             self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
447             self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
448             self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
449             self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
450             self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
451             self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
452         }
453
454         self.VolumeControlsLowRes={
455             self.sldOut12Level:      ['/Mixer/Out12Level'],
456             self.sldOut34Level:      ['/Mixer/Out34Level'],
457             self.sldOut56Level:      ['/Mixer/Out56Level'],
458             self.sldOut78Level:      ['/Mixer/Out78Level'],
459         }
460
461         self.TriggerButtonControls={
462             self.btnReboot:        ['/Control/Reboot'],
463             self.btnIdentify:      ['/Control/FlashLed'],
464             self.btnSaveSettings:  ['/Control/SaveSettings'],
465         }
466
467         self.TextControls={
468         }
469
470         self.saveTextControls={
471         }
472
473         self.ComboControls={
474             self.comboStandalone:        ['/Control/StandaloneConfig'],
475         }
476
477     def updateMatrixVolume(self,a0):
478         SaffireMixerBase.updateMatrixVolume(self,a0)
479     def updateLowResVolume(self,a0):
480         SaffireMixerBase.updateLowResVolume(self,a0)
481     def updateSelector(self,a0):
482         sender = self.sender()
483         #if sender == self.chkAC3 and not self.my_parent.is_not_streaming:
484             #msg = QMessageBox()
485             #msg.question( msg, "Error", \
486                 #"<qt>Change not permitted. Is streaming active?</qt>", \
487                 #QMessageBox.Ok )
488             #self.chkAC3.setEnabled(False)
489             #if a0:
490                 #self.chkAC3.setChecked(False)
491             #else:
492                 #self.chkAC3.setChecked(True)
493             #return
494         if sender == self.chkMidiEnable and not self.my_parent.is_not_streaming:
495             msg = QMessageBox()
496             msg.question( msg, "Error", \
497                 "<qt>Change not permitted. Is streaming active?</qt>", \
498                 QMessageBox.Ok )
499             self.chkMidiEnable.setEnabled(False)
500             state = self.hw.getDiscrete(self.SelectorControls[self.chkMidiEnable][0])
501             if state:
502                 self.chkMidiEnable.setChecked(True)
503             else:
504                 self.chkMidiEnable.setChecked(False)
505             return
506         if sender == self.chkAdatDisable and not self.my_parent.is_not_streaming:
507             msg = QMessageBox()
508             msg.question( msg, "Error", \
509                 "<qt>Change not permitted. Is streaming active?</qt>", \
510                 QMessageBox.Ok )
511             self.chkAdatDisable.setEnabled(False)
512             state = self.hw.getDiscrete(self.SelectorControls[self.chkAdatDisable][0])
513             if state:
514                 self.chkAdatDisable.setChecked(True)
515             else:
516                 self.chkAdatDisable.setChecked(False)
517             return
518         SaffireMixerBase.updateSelector(self,a0)
519
520     def triggerButton(self):
521         sender = self.sender()
522         if sender == self.btnReboot and not self.my_parent.is_not_streaming:
523             msg = QMessageBox()
524             msg.question( msg, "Error", \
525                 "<qt>Operation not permitted. Is streaming active?</qt>", \
526                 QMessageBox.Ok )
527             self.btnReboot.setEnabled(False)
528             return
529         SaffireMixerBase.triggerButton(self)
530
531     def saveText(self):
532         SaffireMixerBase.saveText(self)
533     def initCombo(self, combo):
534         SaffireMixerBase.initCombo(self,combo)
535     def selectCombo(self, mode):
536         SaffireMixerBase.selectCombo(self,mode)
537
538     def updateValues(self):
539         SaffireMixerBase.updateValues(self)
540
541     def polledUpdate(self):
542         #log.debug("polled update (small)")
543         self.polledUpdateHwCtrl(self.chkHwCtrl12, self.sldOut12Level)
544         self.polledUpdateHwCtrl(self.chkHwCtrl34, self.sldOut34Level)
545         self.polledUpdateHwCtrl(self.chkHwCtrl56, self.sldOut56Level)
546         self.polledUpdateHwCtrl(self.chkHwCtrl78, self.sldOut78Level)
547
548         #make these inaccessible whenever streaming is running
549         #self.chkAC3.setEnabled(self.my_parent.is_not_streaming)
550         self.chkMidiEnable.setEnabled(self.my_parent.is_not_streaming)
551         self.chkAdatDisable.setEnabled(self.my_parent.is_not_streaming)
552         self.btnReboot.setEnabled(self.my_parent.is_not_streaming)
553
554     def polledUpdateHwCtrl(self, selector, volctrl):
555         state = selector.isChecked()
556         if state:
557             self.polledUpdateVolumeLowRes('/Mixer/MonitorDial', volctrl, 2)
558             volctrl.setEnabled(False)
559         else:
560             volctrl.setEnabled(True)
Note: See TracBrowser for help on using the browser.