root/trunk/libffado/support/mixer/mixer_saffirele.py

Revision 945, 7.8 kB (checked in by ppalmers, 15 years ago)

Add mixer application for the Saffire LE (untested)

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_saffireleui import *
25
26 class SaffireLEMixer(SaffireLEMixerUI):
27     def __init__(self,parent = None,name = None,modal = 0,fl = 0):
28         SaffireLEMixerUI.__init__(self,parent,name,modal,fl)
29
30     def init(self):
31             print "Init Saffire LE mixer window"
32
33             self.VolumeControls={
34                     self.sldIN1Out1: ['/Mixer/LEMix48', 0, 0],
35                     self.sldIN1Out2: ['/Mixer/LEMix48', 0, 1],
36                     self.sldIN1Out3: ['/Mixer/LEMix48', 0, 2],
37                     self.sldIN1Out4: ['/Mixer/LEMix48', 0, 3],
38                     self.sldIN2Out1: ['/Mixer/LEMix48', 1, 0],
39                     self.sldIN2Out2: ['/Mixer/LEMix48', 1, 1],
40                     self.sldIN2Out3: ['/Mixer/LEMix48', 1, 2],
41                     self.sldIN2Out4: ['/Mixer/LEMix48', 1, 3],
42                     self.sldIN3Out1: ['/Mixer/LEMix48', 2, 0],
43                     self.sldIN3Out2: ['/Mixer/LEMix48', 2, 1],
44                     self.sldIN3Out3: ['/Mixer/LEMix48', 2, 2],
45                     self.sldIN3Out4: ['/Mixer/LEMix48', 2, 3],
46                     self.sldIN4Out1: ['/Mixer/LEMix48', 3, 0],
47                     self.sldIN4Out2: ['/Mixer/LEMix48', 3, 1],
48                     self.sldIN4Out3: ['/Mixer/LEMix48', 3, 2],
49                     self.sldIN4Out4: ['/Mixer/LEMix48', 3, 3],
50                     self.sldSPDIF1Out1: ['/Mixer/LEMix48', 4, 0],
51                     self.sldSPDIF1Out2: ['/Mixer/LEMix48', 4, 1],
52                     self.sldSPDIF1Out3: ['/Mixer/LEMix48', 4, 2],
53                     self.sldSPDIF1Out4: ['/Mixer/LEMix48', 4, 3],
54                     self.sldSPDIF2Out1: ['/Mixer/LEMix48', 5, 0],
55                     self.sldSPDIF2Out2: ['/Mixer/LEMix48', 5, 1],
56                     self.sldSPDIF2Out3: ['/Mixer/LEMix48', 5, 2],
57                     self.sldSPDIF2Out4: ['/Mixer/LEMix48', 5, 3],
58                    
59                     self.sldPC1Out1: ['/Mixer/LEMix48', 6, 0],
60                     self.sldPC1Out2: ['/Mixer/LEMix48', 6, 1],
61                     self.sldPC1Out3: ['/Mixer/LEMix48', 6, 2],
62                     self.sldPC1Out4: ['/Mixer/LEMix48', 6, 3],
63                     self.sldPC2Out1: ['/Mixer/LEMix48', 7, 0],
64                     self.sldPC2Out2: ['/Mixer/LEMix48', 7, 1],
65                     self.sldPC2Out3: ['/Mixer/LEMix48', 7, 2],
66                     self.sldPC2Out4: ['/Mixer/LEMix48', 7, 3],
67                     self.sldPC3Out1: ['/Mixer/LEMix48', 8, 0],
68                     self.sldPC3Out2: ['/Mixer/LEMix48', 8, 1],
69                     self.sldPC3Out3: ['/Mixer/LEMix48', 8, 2],
70                     self.sldPC3Out4: ['/Mixer/LEMix48', 8, 3],
71                     self.sldPC4Out1: ['/Mixer/LEMix48', 9, 0],
72                     self.sldPC4Out2: ['/Mixer/LEMix48', 9, 1],
73                     self.sldPC4Out3: ['/Mixer/LEMix48', 9, 2],
74                     self.sldPC4Out4: ['/Mixer/LEMix48', 9, 3],
75                     self.sldPC5Out1: ['/Mixer/LEMix48', 10, 0],
76                     self.sldPC5Out2: ['/Mixer/LEMix48', 10, 1],
77                     self.sldPC5Out3: ['/Mixer/LEMix48', 10, 2],
78                     self.sldPC5Out4: ['/Mixer/LEMix48', 10, 3],
79                     self.sldPC6Out1: ['/Mixer/LEMix48', 11, 0],
80                     self.sldPC6Out2: ['/Mixer/LEMix48', 11, 1],
81                     self.sldPC6Out3: ['/Mixer/LEMix48', 11, 2],
82                     self.sldPC6Out4: ['/Mixer/LEMix48', 11, 3],
83                     self.sldPC7Out1: ['/Mixer/LEMix48', 12, 0],
84                     self.sldPC7Out2: ['/Mixer/LEMix48', 12, 1],
85                     self.sldPC7Out3: ['/Mixer/LEMix48', 12, 2],
86                     self.sldPC7Out4: ['/Mixer/LEMix48', 12, 3],
87                     self.sldPC8Out1: ['/Mixer/LEMix48', 13, 0],
88                     self.sldPC8Out2: ['/Mixer/LEMix48', 13, 1],
89                     self.sldPC8Out3: ['/Mixer/LEMix48', 13, 2],
90                     self.sldPC8Out4: ['/Mixer/LEMix48', 13, 3],
91                    }
92
93             self.SelectorControls={
94                     self.chkOut1Mute:      ['/Mixer/Out1Mute'],
95                     self.chkOut2Mute:      ['/Mixer/Out2Mute'],
96                     self.chkOut3Mute:      ['/Mixer/Out3Mute'],
97                     self.chkOut4Mute:      ['/Mixer/Out4Mute'],
98                     self.chkOut5Mute:      ['/Mixer/Out5Mute'],
99                     self.chkOut6Mute:      ['/Mixer/Out6Mute'],
100                     self.chkOut7Mute:      ['/Mixer/Out7Mute'],
101                     self.chkOut8Mute:      ['/Mixer/Out8Mute'],
102                     }
103
104             self.VolumeControlsLowRes={
105                     }
106
107     def updateMatrixVolume(self,a0):
108         sender = self.sender()
109         vol = 0x7FFF-a0
110         print "set %s %d %d to %d" % (
111                     self.VolumeControls[sender][0],
112                     self.VolumeControls[sender][1],
113                     self.VolumeControls[sender][2],
114                     vol)
115         self.hw.setMatrixMixerValue(self.VolumeControls[sender][0],
116                                     self.VolumeControls[sender][1],
117                                     self.VolumeControls[sender][2],
118                                     vol)
119     def updateLowResVolume(self,a0):
120         sender = self.sender()
121         vol = a0
122         print "set %s to %d" % (
123                     self.VolumeControlsLowRes[sender][0],
124                     vol)
125         self.hw.setDiscrete(self.VolumeControlsLowRes[sender][0], vol)
126
127     def updateSelector(self,a0):
128         sender = self.sender()
129         if a0:
130             state = 1
131         else:
132             state = 0
133         print "set %s to %d" % (
134                     self.SelectorControls[sender][0],
135                     state)
136         self.hw.setDiscrete(self.SelectorControls[sender][0], state)
137        
138     def initValues(self):
139             for ctrl, info in self.VolumeControls.iteritems():
140                 vol = self.hw.getMatrixMixerValue(self.VolumeControls[ctrl][0],
141                                                   self.VolumeControls[ctrl][1],
142                                                   self.VolumeControls[ctrl][2])
143
144                 print "%s volume is %d" % (ctrl.name() , 0x7FFF-vol)
145                 ctrl.setValue(0x7FFF-vol)
146
147                 # connect the UI element
148                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixVolume)
149
150             for ctrl, info in self.VolumeControlsLowRes.iteritems():
151                 vol = self.hw.getDiscrete(self.VolumeControlsLowRes[ctrl][0])
152
153                 print "%s volume is %d" % (ctrl.name() , vol)
154                 ctrl.setValue(vol)
155
156                 # connect the UI element
157                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateLowResVolume)
158
159             for ctrl, info in self.SelectorControls.iteritems():
160                 state = self.hw.getDiscrete(self.SelectorControls[ctrl][0])
161                 print "%s state is %d" % (ctrl.name() , state)
162                 if state:
163                     ctrl.setChecked(True)
164                 else:
165                     ctrl.setChecked(False)
166
167                 # connect the UI element
168                 QObject.connect(ctrl,SIGNAL('stateChanged(int)'),self.updateSelector)
Note: See TracBrowser for help on using the browser.