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

Revision 954, 7.5 kB (checked in by ppalmers, 15 years ago)

remove missing controls

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                     }
99
100             self.VolumeControlsLowRes={
101                     }
102
103     def updateMatrixVolume(self,a0):
104         sender = self.sender()
105         vol = 0x7FFF-a0
106         print "set %s %d %d to %d" % (
107                     self.VolumeControls[sender][0],
108                     self.VolumeControls[sender][1],
109                     self.VolumeControls[sender][2],
110                     vol)
111         self.hw.setMatrixMixerValue(self.VolumeControls[sender][0],
112                                     self.VolumeControls[sender][1],
113                                     self.VolumeControls[sender][2],
114                                     vol)
115     def updateLowResVolume(self,a0):
116         sender = self.sender()
117         vol = a0
118         print "set %s to %d" % (
119                     self.VolumeControlsLowRes[sender][0],
120                     vol)
121         self.hw.setDiscrete(self.VolumeControlsLowRes[sender][0], vol)
122
123     def updateSelector(self,a0):
124         sender = self.sender()
125         if a0:
126             state = 1
127         else:
128             state = 0
129         print "set %s to %d" % (
130                     self.SelectorControls[sender][0],
131                     state)
132         self.hw.setDiscrete(self.SelectorControls[sender][0], state)
133        
134     def initValues(self):
135             for ctrl, info in self.VolumeControls.iteritems():
136                 vol = self.hw.getMatrixMixerValue(self.VolumeControls[ctrl][0],
137                                                   self.VolumeControls[ctrl][1],
138                                                   self.VolumeControls[ctrl][2])
139
140                 print "%s volume is %d" % (ctrl.name() , 0x7FFF-vol)
141                 ctrl.setValue(0x7FFF-vol)
142
143                 # connect the UI element
144                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixVolume)
145
146             for ctrl, info in self.VolumeControlsLowRes.iteritems():
147                 vol = self.hw.getDiscrete(self.VolumeControlsLowRes[ctrl][0])
148
149                 print "%s volume is %d" % (ctrl.name() , vol)
150                 ctrl.setValue(vol)
151
152                 # connect the UI element
153                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateLowResVolume)
154
155             for ctrl, info in self.SelectorControls.iteritems():
156                 state = self.hw.getDiscrete(self.SelectorControls[ctrl][0])
157                 print "%s state is %d" % (ctrl.name() , state)
158                 if state:
159                     ctrl.setChecked(True)
160                 else:
161                     ctrl.setChecked(False)
162
163                 # connect the UI element
164                 QObject.connect(ctrl,SIGNAL('stateChanged(int)'),self.updateSelector)
Note: See TracBrowser for help on using the browser.