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

Revision 1361, 4.8 kB (checked in by ppalmers, 14 years ago)

Merge 2.0 branch changes.

svn merge -r1349:HEAD svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0

Line 
1 #
2 # Copyright (C) 2005-2008 by Daniel Wagner
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_edirolfa101ui import *
25
26 class EdirolFa101Control(EdirolFa101ControlUI):
27     def __init__(self, parent = None, name = None, fl = 0):
28         EdirolFa101ControlUI.__init__(self, parent, name, fl)
29
30     def setVolumeIn1(self, vol):
31         self.setValue('vol1', vol)
32
33     def setVolumeIn2(self, vol):
34         self.setValue('vol2', vol)
35
36     def setVolumeIn3(self, vol):
37         self.setValue('vol3', vol)
38
39     def setVolumeIn4(self, vol):
40         self.setValue('vol4', vol)
41
42     def setVolumeIn5(self, vol):
43         self.setValue('vol5', vol)
44
45     def setVolumeIn6(self, vol):
46         self.setValue('vol6', vol)
47
48     def setVolumeIn7(self, vol):
49         self.setValue('vol7', vol)
50            
51     def setVolumeIn8(self, vol):
52         self.setValue('vol8', vol)
53        
54     def setVolumeIn9(self, vol):
55         self.setValue('vol9', vol)
56
57     def setVolumeIn10(self,vol):
58         self.setValue('vol10', vol)
59
60     def setBalanceIn1(self, bal):
61         self.setValue('bal1', bal)
62
63     def setBalanceIn2(self, bal):
64         self.setValue('bal2', bal)
65
66     def setBalanceIn3(self, bal):
67         self.setValue('bal3', bal)
68
69     def setBalanceIn4(self, bal):
70         self.setValue('bal4', bal)
71
72     def setBalanceIn5(self, bal):
73         self.setValue('bal5', bal)
74
75     def setBalanceIn6(self, bal):
76         self.setValue('bal6', bal)
77
78     def setBalanceIn7(self, bal):
79         self.setValue('bal7', bal)
80            
81     def setBalanceIn8(self, bal):
82         self.setValue('bal8', bal)
83        
84     def setBalanceIn9(self, bal):
85         self.setValue('bal9', bal)
86
87     def setBalanceIn10(self,bal):
88         self.setValue('bal10', bal)
89
90     def setValue(self, name, val):
91         val = -val
92         ctrl = self.VolumeControls[name]
93         print "setting %s to %d" % (name, val)
94         self.hw.setContignuous(ctrl[0], val, idx = ctrl[1])
95
96     def init(self):
97         print "Init Edirol FA-101 window"
98
99         self.VolumeControls = {
100             #          feature name, channel, qt slider
101             'vol1'  :   ['/Mixer/Feature_Volume_5', 1, self.sldInput1],
102             'vol2'  :   ['/Mixer/Feature_Volume_5', 2, self.sldInput2],
103             'vol3'  :   ['/Mixer/Feature_Volume_1', 1, self.sldInput3],
104             'vol4'  :   ['/Mixer/Feature_Volume_1', 2, self.sldInput4],
105             'vol5'  :   ['/Mixer/Feature_Volume_2', 1, self.sldInput5],
106             'vol6'  :   ['/Mixer/Feature_Volume_2', 2, self.sldInput6],
107             'vol7'  :   ['/Mixer/Feature_Volume_3', 1, self.sldInput7],
108             'vol8'  :   ['/Mixer/Feature_Volume_3', 2, self.sldInput8],
109             'vol9'  :   ['/Mixer/Feature_Volume_4', 1, self.sldInput9],
110             'vol10' :   ['/Mixer/Feature_Volume_4', 2, self.sldInput10],
111
112             'bal1'  :   ['/Mixer/Feature_LRBalance_5', 1, self.sldBal1],
113             'bal2'  :   ['/Mixer/Feature_LRBalance_5', 2, self.sldBal2],
114             'bal3'  :   ['/Mixer/Feature_LRBalance_1', 1, self.sldBal3],
115             'bal4'  :   ['/Mixer/Feature_LRBalance_1', 2, self.sldBal4],
116             'bal5'  :   ['/Mixer/Feature_LRBalance_2', 1, self.sldBal5],
117             'bal6'  :   ['/Mixer/Feature_LRBalance_2', 2, self.sldBal6],
118             'bal7'  :   ['/Mixer/Feature_LRBalance_3', 1, self.sldBal7],
119             'bal8'  :   ['/Mixer/Feature_LRBalance_3', 2, self.sldBal8],
120             'bal9'  :   ['/Mixer/Feature_LRBalance_4', 1, self.sldBal9],
121             'bal10' :   ['/Mixer/Feature_LRBalance_4', 2, self.sldBal10],
122             }
123
124     def initValues(self):
125         for name, ctrl in self.VolumeControls.iteritems():
126             val = self.hw.getContignuous(ctrl[0], idx = ctrl[1])
127             print "%s value is %d" % (name , val)
128
129             # Workaround: The current value is not properly initialized
130             # on the device and returns after bootup always 0.
131             # Though we happen to know what the correct value should
132             # be therefore we overwrite the 0
133             if name[0:3] == 'bal' and val == 0:
134                 if ctrl[1] == 1:
135                     val = 32512
136                 else:
137                     val = -32768
138                    
139             ctrl[2].setValue(-val)
Note: See TracBrowser for help on using the browser.