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

Revision 1216, 17.0 kB (checked in by ppalmers, 13 years ago)

add support for the different mixers at different samplerates or configurations for the saffires

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 qt import *
24 from mixer_saffire_base import SaffireMixerBase
25 from mixer_saffireprolargeui import SaffireProMixerLargeUI
26 from mixer_saffireprosmallui import SaffireProMixerSmallUI
27
28 class SaffireProMixerLarge(SaffireProMixerLargeUI, SaffireMixerBase):
29     def __init__(self,parent = None,name = None,fl = 0):
30         SaffireProMixerLargeUI.__init__(self,parent,name,fl)
31         SaffireMixerBase.__init__(self)
32         self.have_adat = False
33
34     def init(self):
35             print "Init large Saffire Pro mixer window"
36
37             self.VolumeControls={
38                 self.sldIMixAnalog1L: ['/Mixer/InputMix', 0, 0],
39                 self.sldIMixAnalog1R: ['/Mixer/InputMix', 0, 1],
40                 self.sldIMixAnalog2L: ['/Mixer/InputMix', 1, 0],
41                 self.sldIMixAnalog2R: ['/Mixer/InputMix', 1, 1],
42                 self.sldIMixAnalog3L: ['/Mixer/InputMix', 2, 0],
43                 self.sldIMixAnalog3R: ['/Mixer/InputMix', 2, 1],
44                 self.sldIMixAnalog4L: ['/Mixer/InputMix', 3, 0],
45                 self.sldIMixAnalog4R: ['/Mixer/InputMix', 3, 1],
46                 self.sldIMixAnalog5L: ['/Mixer/InputMix', 4, 0],
47                 self.sldIMixAnalog5R: ['/Mixer/InputMix', 4, 1],
48                 self.sldIMixAnalog6L: ['/Mixer/InputMix', 5, 0],
49                 self.sldIMixAnalog6R: ['/Mixer/InputMix', 5, 1],
50                 self.sldIMixAnalog7L: ['/Mixer/InputMix', 6, 0],
51                 self.sldIMixAnalog7R: ['/Mixer/InputMix', 6, 1],
52                 self.sldIMixAnalog8L: ['/Mixer/InputMix', 7, 0],
53                 self.sldIMixAnalog8R: ['/Mixer/InputMix', 7, 1],
54                 self.sldIMixAnalog9L: ['/Mixer/InputMix', 8, 0],
55                 self.sldIMixAnalog9R: ['/Mixer/InputMix', 8, 1],
56                 self.sldIMixAnalog10L: ['/Mixer/InputMix', 9, 0],
57                 self.sldIMixAnalog10R: ['/Mixer/InputMix', 9, 1],
58                 self.sldIMixADAT11L: ['/Mixer/InputMix', 10, 0],
59                 self.sldIMixADAT11R: ['/Mixer/InputMix', 10, 1],
60                 self.sldIMixADAT12L: ['/Mixer/InputMix', 11, 0],
61                 self.sldIMixADAT12R: ['/Mixer/InputMix', 11, 1],
62                 self.sldIMixADAT13L: ['/Mixer/InputMix', 12, 0],
63                 self.sldIMixADAT13R: ['/Mixer/InputMix', 12, 1],
64                 self.sldIMixADAT14L: ['/Mixer/InputMix', 13, 0],
65                 self.sldIMixADAT14R: ['/Mixer/InputMix', 13, 1],
66                 self.sldIMixADAT15L: ['/Mixer/InputMix', 14, 0],
67                 self.sldIMixADAT15R: ['/Mixer/InputMix', 14, 1],
68                 self.sldIMixADAT16L: ['/Mixer/InputMix', 15, 0],
69                 self.sldIMixADAT16R: ['/Mixer/InputMix', 15, 1],
70                 self.sldIMixADAT17L: ['/Mixer/InputMix', 16, 0],
71                 self.sldIMixADAT17R: ['/Mixer/InputMix', 16, 1],
72                 self.sldIMixADAT18L: ['/Mixer/InputMix', 17, 0],
73                 self.sldIMixADAT18R: ['/Mixer/InputMix', 17, 1],
74                 self.sldIMixADAT21L: ['/Mixer/InputMix', 18, 0],
75                 self.sldIMixADAT21R: ['/Mixer/InputMix', 18, 1],
76                 self.sldIMixADAT22L: ['/Mixer/InputMix', 19, 0],
77                 self.sldIMixADAT22R: ['/Mixer/InputMix', 19, 1],
78                 self.sldIMixADAT23L: ['/Mixer/InputMix', 20, 0],
79                 self.sldIMixADAT23R: ['/Mixer/InputMix', 20, 1],
80                 self.sldIMixADAT24L: ['/Mixer/InputMix', 21, 0],
81                 self.sldIMixADAT24R: ['/Mixer/InputMix', 21, 1],
82                 self.sldIMixADAT25L: ['/Mixer/InputMix', 22, 0],
83                 self.sldIMixADAT25R: ['/Mixer/InputMix', 22, 1],
84                 self.sldIMixADAT26L: ['/Mixer/InputMix', 23, 0],
85                 self.sldIMixADAT26R: ['/Mixer/InputMix', 23, 1],
86                 self.sldIMixADAT27L: ['/Mixer/InputMix', 24, 0],
87                 self.sldIMixADAT27R: ['/Mixer/InputMix', 24, 1],
88                 self.sldIMixADAT28L: ['/Mixer/InputMix', 25, 0],
89                 self.sldIMixADAT28R: ['/Mixer/InputMix', 25, 1],
90                
91                 self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
92                 self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
93                 self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
94                 self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
95                 self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
96                 self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
97                 self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
98                 self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
99                 self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
100                 self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
101                
102                 self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
103                 self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
104                 self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
105                 self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
106                 self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
107                 self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
108                 self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
109                 self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
110                
111                 self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
112                 self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
113                 self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
114                 self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
115                 self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
116                 self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
117                 self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
118                 self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
119                 self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
120                 self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
121                 }
122
123
124             self.SelectorControls={
125                 # control elements
126                 self.chkInsert1: ['/Control/Insert1'],
127                 self.chkInsert2: ['/Control/Insert2'],
128                 self.chkPhantom14: ['/Control/Phantom_1to4'],
129                 self.chkPhantom58: ['/Control/Phantom_5to8'],
130                 self.chkAC3: ['/Control/AC3pass'],
131                 self.chkMidiThru: ['/Control/MidiTru'],
132                 self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
133                 #self.chkEnableADAT1: ['/Control/EnableAdat1'],
134                 #self.chkEnableADAT2: ['/Control/EnableAdat2'],
135                 #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
136                 self.chkMidiEnable: ['/Control/MIDIEnable'],
137                 self.chkAdatDisable: ['/Control/ADATDisable'],
138                 # Mixer switches
139                 self.chkMute12: ['/Mixer/Out12Mute'],
140                 self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
141                 self.chkPad12: ['/Mixer/Out12Pad'],
142                 self.chkDim12: ['/Mixer/Out12Dim'],
143                 self.chkMute34: ['/Mixer/Out34Mute'],
144                 self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
145                 self.chkPad34: ['/Mixer/Out34Pad'],
146                 self.chkDim34: ['/Mixer/Out34Dim'],
147                 self.chkMute56: ['/Mixer/Out56Mute'],
148                 self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
149                 self.chkPad56: ['/Mixer/Out56Pad'],
150                 self.chkDim56: ['/Mixer/Out56Dim'],
151                 self.chkMute78: ['/Mixer/Out78Mute'],
152                 self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
153                 self.chkPad78: ['/Mixer/Out78Pad'],
154                 self.chkDim78: ['/Mixer/Out78Dim'],
155                 # direct monitoring
156                 self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
157                 self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
158                 self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
159                 self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
160                 self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
161                 self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
162                 self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
163                 self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
164             }
165
166             self.VolumeControlsLowRes={
167                 self.sldOut12Level:      ['/Mixer/Out12Level'],
168                 self.sldOut34Level:      ['/Mixer/Out34Level'],
169                 self.sldOut56Level:      ['/Mixer/Out56Level'],
170                 self.sldOut78Level:      ['/Mixer/Out78Level'],
171             }
172
173             self.TriggerButtonControls={
174                 self.btnReboot:        ['/Control/Reboot'],
175                 self.btnIdentify:      ['/Control/FlashLed'],
176                 self.btnSaveSettings:  ['/Control/SaveSettings'],
177             }
178
179             self.TextControls={
180             }
181
182             self.saveTextControls={
183             }
184
185             self.ComboControls={
186                 self.comboStandalone:        ['/Control/StandaloneConfig'],
187             }
188
189     def updateMatrixVolume(self,a0):
190         SaffireMixerBase.updateMatrixVolume(self,a0)
191     def updateLowResVolume(self,a0):
192         SaffireMixerBase.updateLowResVolume(self,a0)
193     def updateSelector(self,a0):
194         SaffireMixerBase.updateSelector(self,a0)
195     def triggerButton(self):
196         SaffireMixerBase.triggerButton(self)
197     def saveText(self):
198         SaffireMixerBase.saveText(self)
199     def initCombo(self, combo):
200         SaffireMixerBase.initCombo(self,combo)
201     def selectCombo(self, mode):
202         SaffireMixerBase.selectCombo(self,mode)
203
204     def updateValues(self):
205         self.samplerate = self.hw.getDiscrete('/Generic/SamplerateSelect')
206         self.modelId = self.configrom.getModelId()
207         if self.modelId == 0x00000003:
208             state = self.hw.getDiscrete('/Control/ADATDisable')
209             if state:
210                 self.have_adat = False
211                 print "detected PRO26 at %d, ADAT disabled" % self.samplerate
212             else:
213                 self.have_adat = True
214                 print "detected PRO26 at %d, ADAT enabled" % self.samplerate
215         else:
216             self.have_adat = False
217             print "detected PRO10 at %d, ADAT not available" % self.samplerate
218
219         for i in range(self.tabInputMix.count()):
220             self.tabInputMix.setTabEnabled(self.tabInputMix.page(i), True)
221
222         if not self.have_adat:
223             for i in range(self.tabInputMix.count()):
224                 page = self.tabInputMix.page(i)
225                 name = page.name()
226                 if name[0:4] == "adat":
227                     self.tabInputMix.setTabEnabled(page, False)
228                 else:
229                     self.tabInputMix.setTabEnabled(page, True)
230
231         self.tabInputMix.setCurrentPage(0)
232         SaffireMixerBase.updateValues(self)
233
234 class SaffireProMixerSmall(SaffireProMixerSmallUI, SaffireMixerBase):
235     def __init__(self,parent = None,name = None,fl = 0):
236         SaffireProMixerSmallUI.__init__(self,parent,name,fl)
237         SaffireMixerBase.__init__(self)
238
239     def init(self):
240             print "Init small Saffire Pro mixer window"
241
242             self.VolumeControls={
243
244                 self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
245                 self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
246                 self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
247                 self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
248                 self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
249                 self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
250                 self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
251                 self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
252                 self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
253                 self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
254                
255                 self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
256                 self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
257                 self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
258                 self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
259                 self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
260                 self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
261                 self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
262                 self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
263                
264                 self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
265                 self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
266                 self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
267                 self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
268                 self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
269                 self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
270                 self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
271                 self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
272                 self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
273                 self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
274                 }
275
276
277             self.SelectorControls={
278                 # control elements
279                 self.chkInsert1: ['/Control/Insert1'],
280                 self.chkInsert2: ['/Control/Insert2'],
281                 self.chkPhantom14: ['/Control/Phantom_1to4'],
282                 self.chkPhantom58: ['/Control/Phantom_5to8'],
283                 self.chkAC3: ['/Control/AC3pass'],
284                 self.chkMidiThru: ['/Control/MidiTru'],
285                 self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
286                 #self.chkEnableADAT1: ['/Control/EnableAdat1'],
287                 #self.chkEnableADAT2: ['/Control/EnableAdat2'],
288                 #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
289                 self.chkMidiEnable: ['/Control/MIDIEnable'],
290                 self.chkAdatDisable: ['/Control/ADATDisable'],
291                 # Mixer switches
292                 self.chkMute12: ['/Mixer/Out12Mute'],
293                 self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
294                 self.chkPad12: ['/Mixer/Out12Pad'],
295                 self.chkDim12: ['/Mixer/Out12Dim'],
296                 self.chkMute34: ['/Mixer/Out34Mute'],
297                 self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
298                 self.chkPad34: ['/Mixer/Out34Pad'],
299                 self.chkDim34: ['/Mixer/Out34Dim'],
300                 self.chkMute56: ['/Mixer/Out56Mute'],
301                 self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
302                 self.chkPad56: ['/Mixer/Out56Pad'],
303                 self.chkDim56: ['/Mixer/Out56Dim'],
304                 self.chkMute78: ['/Mixer/Out78Mute'],
305                 self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
306                 self.chkPad78: ['/Mixer/Out78Pad'],
307                 self.chkDim78: ['/Mixer/Out78Dim'],
308                 # direct monitoring
309                 self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
310                 self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
311                 self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
312                 self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
313                 self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
314                 self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
315                 self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
316                 self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
317             }
318
319             self.VolumeControlsLowRes={
320                 self.sldOut12Level:      ['/Mixer/Out12Level'],
321                 self.sldOut34Level:      ['/Mixer/Out34Level'],
322                 self.sldOut56Level:      ['/Mixer/Out56Level'],
323                 self.sldOut78Level:      ['/Mixer/Out78Level'],
324             }
325
326             self.TriggerButtonControls={
327                 self.btnReboot:        ['/Control/Reboot'],
328                 self.btnIdentify:      ['/Control/FlashLed'],
329                 self.btnSaveSettings:  ['/Control/SaveSettings'],
330             }
331
332             self.TextControls={
333             }
334
335             self.saveTextControls={
336             }
337
338             self.ComboControls={
339                 self.comboStandalone:        ['/Control/StandaloneConfig'],
340             }
341
342     def updateMatrixVolume(self,a0):
343         SaffireMixerBase.updateMatrixVolume(self,a0)
344     def updateLowResVolume(self,a0):
345         SaffireMixerBase.updateLowResVolume(self,a0)
346     def updateSelector(self,a0):
347         SaffireMixerBase.updateSelector(self,a0)
348     def triggerButton(self):
349         SaffireMixerBase.triggerButton(self)
350     def saveText(self):
351         SaffireMixerBase.saveText(self)
352     def initCombo(self, combo):
353         SaffireMixerBase.initCombo(self,combo)
354     def selectCombo(self, mode):
355         SaffireMixerBase.selectCombo(self,mode)
356
357     def updateValues(self):
358         SaffireMixerBase.updateValues(self)
Note: See TracBrowser for help on using the browser.