root/trunk/libffado/support/mixer-qt4/ffado/mixer/bcoaudio5control.py

Revision 1691, 3.3 kB (checked in by arnonym, 11 years ago)

Only load the mixerwidgets that are actually needed.

To automate this, a rules are imposed:

The filename has to be the lower-case variant of the mixer name

This should speed up loading time of ffado-mixer. Please everybody test this and report any errors as I don't have all the devices to test everything fully.

  • Property svn:mergeinfo set to
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 ffado.config import *
26 import logging
27 log = logging.getLogger('bridgeco')
28
29 class BCoAudio5Control(QWidget):
30     def __init__(self,parent = None):
31         QWidget.__init__(self,parent)
32         uicLoad("ffado/mixer/bcoaudio5", self)
33
34         self.VolumeControls={
35             'in_line12'  :   ['/Mixer/Feature_Volume_1', self.sldInput12],
36             'in_line34'  :   ['/Mixer/Feature_Volume_2', self.sldInput34],
37             'in_spdif'   :   ['/Mixer/Feature_Volume_3', self.sldInputSPDIF],
38             'out_line12' :   ['/Mixer/Feature_Volume_6', self.sldOutput12],
39             'out_line34' :   ['/Mixer/Feature_Volume_7', self.sldOutput34],
40             'cross_a'    :   ['/Mixer/Feature_Volume_4', self.sldCrossA],
41             'cross_b'    :   ['/Mixer/Feature_Volume_5', self.sldCrossB],
42             }
43
44         self.ComboControls={
45             'line34source':   ['/Mixer/Selector_1', self.comboMixSource],
46         }
47
48     def setComboMixSource(self,a0):
49         self.setSelector('line34source', a0)
50
51     def setVolumeIn12(self,a0):
52         self.setVolume('in_line12', a0)
53
54     def setVolumeIn34(self,a0):
55         self.setVolume('in_line34', a0)
56
57     def setVolumeInSPDIF(self,a0):
58         self.setVolume('in_spdif', a0)
59
60     def setVolumeOut12(self,a0):
61         self.setVolume('out_line12', a0)
62
63     def setVolumeOut34(self,a0):
64         self.setVolume('out_line34', a0)
65
66     def setCrossA(self,a0):
67         self.setVolume('cross_a', a0)
68
69     def setCrossB(self,a0):
70         self.setVolume('cross_b', a0)
71
72     def setVolume(self,a0,a1):
73         name = a0
74         vol = -a1
75         log.debug("setting %s volume to %d" % (name, vol))
76         self.hw.setContignuous(self.VolumeControls[name][0], vol)
77
78     def setSelector(self,a0,a1):
79         name = a0
80         state = a1
81         log.debug("setting %s state to %d" % (name, state))
82         self.hw.setDiscrete(self.ComboControls[name][0], state)
83         # verify
84         state = self.hw.getDiscrete(self.ComboControls[name][0])
85         self.hw.setDiscrete(self.ComboControls[name][0], state)
86
87     def initValues(self):
88         for name, ctrl in self.VolumeControls.iteritems():
89             vol = self.hw.getContignuous(ctrl[0])
90             log.debug("%s volume is %d" % (name , vol))
91             ctrl[1].setValue(-vol)
92
93         for name, ctrl in self.ComboControls.iteritems():
94             state = self.hw.getDiscrete(ctrl[0])
95             log.debug("%s state is %d" % (name , state))
96             ctrl[1].setCurrentIndex( state )
97
98 # vim: et
Note: See TracBrowser for help on using the browser.