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

Revision 742, 8.2 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_saffireui import *
25
26 class SaffireMixer(SaffireMixerUI):
27     def __init__(self,parent = None,name = None,modal = 0,fl = 0):
28         SaffireMixerUI.__init__(self,parent,name,modal,fl)
29
30     def init(self):
31             print "Init Saffire mixer window"
32
33             self.VolumeControls={
34                     self.sldPC12Out12: ['/Mixer/PCMix', 0, 0],
35                     self.sldPC12Out34: ['/Mixer/PCMix', 0, 1],
36                     self.sldPC12Out56: ['/Mixer/PCMix', 0, 2],
37                     self.sldPC12Out78: ['/Mixer/PCMix', 0, 3],
38                     self.sldPC12Out910: ['/Mixer/PCMix', 0, 4],
39                     self.sldPC34Out12: ['/Mixer/PCMix', 1, 0],
40                     self.sldPC34Out34: ['/Mixer/PCMix', 1, 1],
41                     self.sldPC34Out56: ['/Mixer/PCMix', 1, 2],
42                     self.sldPC34Out78: ['/Mixer/PCMix', 1, 3],
43                     self.sldPC34Out910: ['/Mixer/PCMix', 1, 4],
44                     self.sldPC56Out12: ['/Mixer/PCMix', 2, 0],
45                     self.sldPC56Out34: ['/Mixer/PCMix', 2, 1],
46                     self.sldPC56Out56: ['/Mixer/PCMix', 2, 2],
47                     self.sldPC56Out78: ['/Mixer/PCMix', 2, 3],
48                     self.sldPC56Out910: ['/Mixer/PCMix', 2, 4],
49                     self.sldPC78Out12: ['/Mixer/PCMix', 3, 0],
50                     self.sldPC78Out34: ['/Mixer/PCMix', 3, 1],
51                     self.sldPC78Out56: ['/Mixer/PCMix', 3, 2],
52                     self.sldPC78Out78: ['/Mixer/PCMix', 3, 3],
53                     self.sldPC78Out910: ['/Mixer/PCMix', 3, 4],
54                     self.sldPC910Out12: ['/Mixer/PCMix', 4, 0],
55                     self.sldPC910Out34: ['/Mixer/PCMix', 4, 1],
56                     self.sldPC910Out56: ['/Mixer/PCMix', 4, 2],
57                     self.sldPC910Out78: ['/Mixer/PCMix', 4, 3],
58                     self.sldPC910Out910: ['/Mixer/PCMix', 4, 4],
59                     self.sldIN1Out1: ['/Mixer/InputMix', 0, 0],
60                     self.sldIN1Out3: ['/Mixer/InputMix', 0, 2],
61                     self.sldIN1Out5: ['/Mixer/InputMix', 0, 4],
62                     self.sldIN1Out7: ['/Mixer/InputMix', 0, 6],
63                     self.sldIN1Out9: ['/Mixer/InputMix', 0, 8],
64                     self.sldIN2Out2: ['/Mixer/InputMix', 1, 1],
65                     self.sldIN2Out4: ['/Mixer/InputMix', 1, 3],
66                     self.sldIN2Out6: ['/Mixer/InputMix', 1, 5],
67                     self.sldIN2Out8: ['/Mixer/InputMix', 1, 7],
68                     self.sldIN2Out10: ['/Mixer/InputMix', 1, 9],
69                     self.sldIN3Out1: ['/Mixer/InputMix', 2, 0],
70                     self.sldIN3Out3: ['/Mixer/InputMix', 2, 2],
71                     self.sldIN3Out5: ['/Mixer/InputMix', 2, 4],
72                     self.sldIN3Out7: ['/Mixer/InputMix', 2, 6],
73                     self.sldIN3Out9: ['/Mixer/InputMix', 2, 8],
74                     self.sldIN4Out2: ['/Mixer/InputMix', 3, 1],
75                     self.sldIN4Out4: ['/Mixer/InputMix', 3, 3],
76                     self.sldIN4Out6: ['/Mixer/InputMix', 3, 5],
77                     self.sldIN4Out8: ['/Mixer/InputMix', 3, 7],
78                     self.sldIN4Out10: ['/Mixer/InputMix', 3, 9],
79                     self.sldREV1Out1: ['/Mixer/InputMix', 4, 0],
80                     self.sldREV1Out3: ['/Mixer/InputMix', 4, 2],
81                     self.sldREV1Out5: ['/Mixer/InputMix', 4, 4],
82                     self.sldREV1Out7: ['/Mixer/InputMix', 4, 6],
83                     self.sldREV1Out9: ['/Mixer/InputMix', 4, 8],
84                     self.sldREV2Out2: ['/Mixer/InputMix', 5, 1],
85                     self.sldREV2Out4: ['/Mixer/InputMix', 5, 3],
86                     self.sldREV2Out6: ['/Mixer/InputMix', 5, 5],
87                     self.sldREV2Out8: ['/Mixer/InputMix', 5, 7],
88                     self.sldREV2Out10: ['/Mixer/InputMix', 5, 9],
89                     }
90
91
92             self.SelectorControls={
93                     self.chkSpdifSwitch:    ['/Mixer/SpdifSwitch'],
94                     self.chkOut12Mute:      ['/Mixer/Out12Mute'],
95                     self.chkOut12HwCtrl:    ['/Mixer/Out12HwCtrl'],
96                     self.chkOut12Dim:       ['/Mixer/Out12Dim'],
97                     self.chkOut34Mute:      ['/Mixer/Out34Mute'],
98                     self.chkOut34HwCtrl:    ['/Mixer/Out34HwCtrl'],
99                     self.chkOut56Mute:      ['/Mixer/Out56Mute'],
100                     self.chkOut56HwCtrl:    ['/Mixer/Out56HwCtrl'],
101                     self.chkOut78Mute:      ['/Mixer/Out78Mute'],
102                     self.chkOut78HwCtrl:    ['/Mixer/Out78HwCtrl'],
103                     self.chkOut910Mute:     ['/Mixer/Out910Mute'],
104                     }
105
106             self.VolumeControlsLowRes={
107                     self.sldOut12Level:      ['/Mixer/Out12Level'],
108                     self.sldOut34Level:      ['/Mixer/Out34Level'],
109                     self.sldOut56Level:      ['/Mixer/Out56Level'],
110                     self.sldOut78Level:      ['/Mixer/Out78Level'],
111                     }
112
113     def updateMatrixVolume(self,a0):
114         sender = self.sender()
115         vol = 0x7FFF-a0
116         print "set %s %d %d to %d" % (
117                     self.VolumeControls[sender][0],
118                     self.VolumeControls[sender][1],
119                     self.VolumeControls[sender][2],
120                     vol)
121         self.hw.setMatrixMixerValue(self.VolumeControls[sender][0],
122                                     self.VolumeControls[sender][1],
123                                     self.VolumeControls[sender][2],
124                                     vol)
125     def updateLowResVolume(self,a0):
126         sender = self.sender()
127         vol = a0
128         print "set %s to %d" % (
129                     self.VolumeControlsLowRes[sender][0],
130                     vol)
131         self.hw.setDiscrete(self.VolumeControlsLowRes[sender][0], vol)
132
133     def updateSelector(self,a0):
134         sender = self.sender()
135         if a0:
136             state = 1
137         else:
138             state = 0
139         print "set %s to %d" % (
140                     self.SelectorControls[sender][0],
141                     state)
142         self.hw.setDiscrete(self.SelectorControls[sender][0], state)
143        
144     def initValues(self):
145             for ctrl, info in self.VolumeControls.iteritems():
146                 vol = self.hw.getMatrixMixerValue(self.VolumeControls[ctrl][0],
147                                                   self.VolumeControls[ctrl][1],
148                                                   self.VolumeControls[ctrl][2])
149
150                 print "%s volume is %d" % (ctrl.name() , 0x7FFF-vol)
151                 ctrl.setValue(0x7FFF-vol)
152
153                 # connect the UI element
154                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixVolume)
155
156             for ctrl, info in self.VolumeControlsLowRes.iteritems():
157                 vol = self.hw.getDiscrete(self.VolumeControlsLowRes[ctrl][0])
158
159                 print "%s volume is %d" % (ctrl.name() , vol)
160                 ctrl.setValue(vol)
161
162                 # connect the UI element
163                 QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateLowResVolume)
164
165             for ctrl, info in self.SelectorControls.iteritems():
166                 state = self.hw.getDiscrete(self.SelectorControls[ctrl][0])
167                 print "%s state is %d" % (ctrl.name() , state)
168                 if state:
169                     ctrl.setChecked(True)
170                 else:
171                     ctrl.setChecked(False)
172
173                 # connect the UI element
174                 QObject.connect(ctrl,SIGNAL('stateChanged(int)'),self.updateSelector)
Note: See TracBrowser for help on using the browser.