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

Revision 1364, 3.2 kB (checked in by ppalmers, 12 years ago)

port mixer UI's to Qt4. Make Qt4 the first option to be checked in scons.

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