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

Revision 742, 11.5 kB (checked in by ppalmers, 13 years ago)

- Remove some obsolete support files and dirs

- Clean up the license statements in the source files. Everything is

GPL version 3 now.

- Add license and copyright notices to scons scripts

- Clean up some other text files

Line 
1 #
2 # Copyright (C) 2005-2007 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 3 of the License, or
12 # (at your option) any later version.
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_af2ui import *
25
26 class AudioFire2Mixer(AudioFire2MixerUI):
27     def __init__(self,parent = None,name = None,modal = 0,fl = 0):
28         AudioFire2MixerUI.__init__(self,parent,name,modal,fl)
29
30     def init(self):
31             print "Init AF2 mixer window"
32
33             self.VolumeControls={
34                     self.sldOut1:    ['/Mixer/OUT0Gain'],
35                     self.sldOut2:    ['/Mixer/OUT1Gain'],
36                     self.sldOut3:    ['/Mixer/OUT2Gain'],
37                     self.sldOut4:    ['/Mixer/OUT3Gain'],
38                     self.sldOut5:    ['/Mixer/OUT4Gain'],
39                     self.sldOut6:    ['/Mixer/OUT5Gain'],
40                     self.sldPC1Out12:        ['/Mixer/PC0Gain'],
41                     self.sldPC2Out12:        ['/Mixer/PC1Gain'],
42                     self.sldPC3Out34:        ['/Mixer/PC2Gain'],
43                     self.sldPC4Out34:        ['/Mixer/PC3Gain'],
44                     self.sldPC5Out56:        ['/Mixer/PC4Gain'],
45                     self.sldPC6Out56:        ['/Mixer/PC5Gain'],
46                     }
47
48             self.MatrixButtonControls={
49                     self.btnIn1Out12Mute:    ['/Mixer/MonitorMute',0,0],
50                     self.btnIn1Out12Solo:    ['/Mixer/MonitorSolo',0,0],
51                     self.btnIn1Out34Mute:    ['/Mixer/MonitorMute',0,2],
52                     self.btnIn1Out34Solo:    ['/Mixer/MonitorSolo',0,2],
53                     self.btnIn1Out56Mute:    ['/Mixer/MonitorMute',0,4],
54                     self.btnIn1Out56Solo:    ['/Mixer/MonitorSolo',0,4],
55                     self.btnIn2Out12Mute:    ['/Mixer/MonitorMute',1,0],
56                     self.btnIn2Out12Solo:    ['/Mixer/MonitorSolo',1,0],
57                     self.btnIn2Out34Mute:    ['/Mixer/MonitorMute',1,2],
58                     self.btnIn2Out34Solo:    ['/Mixer/MonitorSolo',1,2],
59                     self.btnIn2Out56Mute:    ['/Mixer/MonitorMute',1,4],
60                     self.btnIn2Out56Solo:    ['/Mixer/MonitorSolo',1,4],
61                     self.btnIn3Out12Mute:    ['/Mixer/MonitorMute',2,0],
62                     self.btnIn3Out12Solo:    ['/Mixer/MonitorSolo',2,0],
63                     self.btnIn3Out34Mute:    ['/Mixer/MonitorMute',2,2],
64                     self.btnIn3Out34Solo:    ['/Mixer/MonitorSolo',2,2],
65                     self.btnIn3Out56Mute:    ['/Mixer/MonitorMute',2,4],
66                     self.btnIn3Out56Solo:    ['/Mixer/MonitorSolo',2,4],
67                     self.btnIn4Out12Mute:    ['/Mixer/MonitorMute',3,0],
68                     self.btnIn4Out12Solo:    ['/Mixer/MonitorSolo',3,0],
69                     self.btnIn4Out34Mute:    ['/Mixer/MonitorMute',3,2],
70                     self.btnIn4Out34Solo:    ['/Mixer/MonitorSolo',3,2],
71                     self.btnIn4Out56Mute:    ['/Mixer/MonitorMute',3,4],
72                     self.btnIn4Out56Solo:    ['/Mixer/MonitorSolo',3,4],
73                     }
74
75             self.MatrixRotaryControls={
76                     self.rotIn1Out12Pan:     ['/Mixer/MonitorPan',0,0],
77                     self.rotIn1Out34Pan:     ['/Mixer/MonitorPan',0,2],
78                     self.rotIn1Out56Pan:     ['/Mixer/MonitorPan',0,4],
79                     self.rotIn2Out12Pan:     ['/Mixer/MonitorPan',1,0],
80                     self.rotIn2Out34Pan:     ['/Mixer/MonitorPan',1,2],
81                     self.rotIn2Out56Pan:     ['/Mixer/MonitorPan',1,4],
82                     self.rotIn3Out12Pan:     ['/Mixer/MonitorPan',2,0],
83                     self.rotIn3Out34Pan:     ['/Mixer/MonitorPan',2,2],
84                     self.rotIn3Out56Pan:     ['/Mixer/MonitorPan',2,4],
85                     self.rotIn4Out12Pan:     ['/Mixer/MonitorPan',3,0],
86                     self.rotIn4Out34Pan:     ['/Mixer/MonitorPan',3,2],
87                     self.rotIn4Out56Pan:     ['/Mixer/MonitorPan',3,4],
88                     }
89
90             self.MatrixVolumeControls={
91                     self.sldIn1Out12:        ['/Mixer/MonitorGain',0,0],
92                     self.sldIn1Out34:        ['/Mixer/MonitorGain',0,2],
93                     self.sldIn1Out56:        ['/Mixer/MonitorGain',0,4],
94                     self.sldIn2Out12:        ['/Mixer/MonitorGain',1,0],
95                     self.sldIn2Out34:        ['/Mixer/MonitorGain',1,2],
96                     self.sldIn2Out56:        ['/Mixer/MonitorGain',1,4],
97                     self.sldIn3Out12:        ['/Mixer/MonitorGain',2,0],
98                     self.sldIn3Out34:        ['/Mixer/MonitorGain',2,2],
99                     self.sldIn3Out56:        ['/Mixer/MonitorGain',2,4],
100                     self.sldIn4Out12:        ['/Mixer/MonitorGain',3,0],
101                     self.sldIn4Out34:        ['/Mixer/MonitorGain',3,2],
102                     self.sldIn4Out56:        ['/Mixer/MonitorGain',3,4],
103                     }
104
105             self.SelectorControls={
106                     self.btnOut1Pad:        ['/Mixer/OUT0Nominal'],
107                     self.btnOut2Pad:        ['/Mixer/OUT1Nominal'],
108                     #self.btnIn1Pad:         ['/Mixer/IN0Nominal'],
109                     #self.btnIn2Pad:         ['/Mixer/IN1Nominal'],
110                     self.btnOut1Mute:       ['/Mixer/OUT0Mute'],
111                     self.btnOut2Mute:       ['/Mixer/OUT1Mute'],
112                     self.btnOut3Mute:       ['/Mixer/OUT2Mute'],
113                     self.btnOut4Mute:       ['/Mixer/OUT3Mute'],
114                     self.btnOut5Mute:       ['/Mixer/OUT4Mute'],
115                     self.btnOut6Mute:       ['/Mixer/OUT5Mute'],
116                     self.btnPC1Out12Mute:   ['/Mixer/PC0Mute'],
117                     self.btnPC2Out12Mute:   ['/Mixer/PC1Mute'],
118                     self.btnPC3Out34Mute:   ['/Mixer/PC2Mute'],
119                     self.btnPC4Out34Mute:   ['/Mixer/PC4Mute'],
120                     self.btnPC5Out56Mute:   ['/Mixer/PC3Mute'],
121                     self.btnPC6Out56Mute:   ['/Mixer/PC5Mute'],
122                     }
123
124
125     def updateMatrixButton(self,a0):
126         sender = self.sender()
127         if a0:
128             state = 1
129         else:
130             state = 0
131         print "set %s %d %d to %d" % (
132                     self.MatrixButtonControls[sender][0],
133                     self.MatrixButtonControls[sender][1],
134                     self.MatrixButtonControls[sender][2],
135                     state)
136         self.hw.setMatrixMixerValue(self.MatrixButtonControls[sender][0],
137                                     self.MatrixButtonControls[sender][1],
138                                     self.MatrixButtonControls[sender][2],
139                                     state)
140
141     def updateMatrixRotary(self,a0):
142         sender = self.sender()
143         vol = a0
144         print "set %s %d %d to %d" % (
145                     self.MatrixRotaryControls[sender][0],
146                     self.MatrixRotaryControls[sender][1],
147                     self.MatrixRotaryControls[sender][2],
148                     vol)
149         self.hw.setMatrixMixerValue(self.MatrixRotaryControls[sender][0],
150                                     self.MatrixRotaryControls[sender][1],
151                                     self.MatrixRotaryControls[sender][2],
152                                     vol)
153
154     def updateMatrixVolume(self,a0):
155         sender = self.sender()
156         vol = 0x01000000-a0
157         print "set %s %d %d to %d" % (
158                     self.MatrixVolumeControls[sender][0],
159                     self.MatrixVolumeControls[sender][1],
160                     self.MatrixVolumeControls[sender][2],
161                     vol)
162         self.hw.setMatrixMixerValue(self.MatrixVolumeControls[sender][0],
163                                     self.MatrixVolumeControls[sender][1],
164                                     self.MatrixVolumeControls[sender][2],
165                                     vol)
166
167     def updateVolume(self,a0):
168         sender = self.sender()
169         vol = 0x01000000-a0
170         print "set %s to %d" % (
171                     self.VolumeControls[sender][0],
172                     vol)
173         self.hw.setContignuous(self.VolumeControls[sender][0],
174                               vol)
175
176     def updateSelector(self,a0):
177         sender = self.sender()
178         if a0:
179             state = 1
180         else:
181             state = 0
182         print "set %s to %d" % (
183                     self.SelectorControls[sender][0],
184                     state)
185         self.hw.setDiscrete(self.SelectorControls[sender][0], state)
186        
187     def initValues(self):
188             for ctrl, info in self.MatrixVolumeControls.iteritems():
189                 vol = self.hw.getMatrixMixerValue(self.MatrixVolumeControls[ctrl][0],
190                                                   self.MatrixVolumeControls[ctrl][1],
191                                                   self.MatrixVolumeControls[ctrl][2])
192
193                 print "%s volume is %d" % (ctrl.name() , 0x01000000-vol)
194                 ctrl.setValue(0x01000000-vol)
195
196                 # connect the UI element
197                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixVolume)
198
199             for ctrl, info in self.MatrixButtonControls.iteritems():
200                 state = self.hw.getMatrixMixerValue(self.MatrixButtonControls[ctrl][0],
201                                                   self.MatrixButtonControls[ctrl][1],
202                                                   self.MatrixButtonControls[ctrl][2])
203
204                 print "%s state is %d" % (ctrl.name() , state)
205                 if state:
206                     ctrl.setOn(True)
207                 else:
208                     ctrl.setOn(False)
209
210                 # connect the UI element
211                 QObject.connect(ctrl,SIGNAL('stateChanged(int)'),self.updateMatrixButton)
212                
213             for ctrl, info in self.MatrixRotaryControls.iteritems():
214                 vol = self.hw.getMatrixMixerValue(self.MatrixRotaryControls[ctrl][0],
215                                                   self.MatrixRotaryControls[ctrl][1],
216                                                   self.MatrixRotaryControls[ctrl][2])
217
218                 print "%s value is %d" % (ctrl.name(), vol)
219                 ctrl.setValue(vol)
220
221                 # connect the UI element
222                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixRotary)
223
224             for ctrl, info in self.VolumeControls.iteritems():
225                 vol = self.hw.getContignuous(self.VolumeControls[ctrl][0])
226
227                 print "%s volume is %d" % (ctrl.name() , 0x01000000-vol)
228                 ctrl.setValue(0x01000000-vol)
229
230                 # connect the UI element
231                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateVolume)
232
233             for ctrl, info in self.SelectorControls.iteritems():
234                 state = self.hw.getDiscrete(self.SelectorControls[ctrl][0])
235                 print "%s state is %d" % (ctrl.name() , state)
236                 if state:
237                     ctrl.setOn(True)
238                 else:
239                     ctrl.setOn(False)
240
241                 # connect the UI element
242                 QObject.connect(ctrl,SIGNAL('stateChanged(int)'),self.updateSelector)
Note: See TracBrowser for help on using the browser.