root/branches/libffado-2.0/support/mixer-qt4/mixer_edirolfa101.py

Revision 1446, 4.8 kB (checked in by wagi, 12 years ago)

invert the faders so that the max value is at the top and the min at the bottom.

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