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

Revision 1364, 3.6 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 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 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_phase88ui import *
26
27 class Phase88Control(QWidget, Ui_Phase88ControlUI):
28     def __init__(self,parent = None):
29         QWidget.__init__(self,parent)
30         self.setupUi(self)
31
32         self.VolumeControls={
33             'master':    ['/Mixer/Feature_Volume_1', self.sldInputMaster],
34             'line12' :   ['/Mixer/Feature_Volume_2', self.sldInput12],
35             'line34' :   ['/Mixer/Feature_Volume_3', self.sldInput34],
36             'line56' :   ['/Mixer/Feature_Volume_4', self.sldInput56],
37             'line78' :   ['/Mixer/Feature_Volume_5', self.sldInput78],
38             'spdif' :    ['/Mixer/Feature_Volume_6', self.sldInputSPDIF],
39             'waveplay' : ['/Mixer/Feature_Volume_7', self.sldInputWavePlay],
40             }
41
42         self.SelectorControls={
43             'outassign':    ['/Mixer/Selector_6', self.comboOutAssign],
44             'inassign':     ['/Mixer/Selector_7', self.comboInAssign],
45             'externalsync': ['/Mixer/Selector_8', self.comboExtSync],
46             'syncsource':   ['/Mixer/Selector_9', self.comboSyncSource],
47             'frontback':    ['/Mixer/Selector_10', self.comboFrontBack],
48         }
49
50     def switchFrontState(self,a0):
51         self.setSelector('frontback', a0)
52
53     def switchOutAssign(self,a0):
54         self.setSelector('outassign', a0)
55
56     def switchWaveInAssign(self,a0):
57         self.setSelector('inassign', a0)
58
59     def switchSyncSource(self,a0):
60         self.setSelector('syncsource', a0)
61
62     def switchExtSyncSource(self,a0):
63         self.setSelector('externalsync', a0)
64
65     def setVolume12(self,a0):
66         self.setVolume('line12', a0)
67
68     def setVolume34(self,a0):
69         self.setVolume('line34', a0)
70
71     def setVolume56(self,a0):
72         self.setVolume('line56', a0)
73
74     def setVolume78(self,a0):
75         self.setVolume('line78', a0)
76
77     def setVolumeSPDIF(self,a0):
78         self.setVolume('spdif', a0)
79
80     def setVolumeWavePlay(self,a0):
81         self.setVolume('waveplay', a0)
82
83     def setVolumeMaster(self,a0):
84         self.setVolume('master', a0)
85
86     def setVolume(self,a0,a1):
87         name=a0
88         vol = -a1
89         print "setting %s volume to %d" % (name, vol)
90         self.hw.setContignuous(self.VolumeControls[name][0], vol)
91
92     def setSelector(self,a0,a1):
93         name=a0
94         state = a1
95         print "setting %s state to %d" % (name, state)
96         self.hw.setDiscrete(self.SelectorControls[name][0], state)
97
98     def initValues(self):
99         for name, ctrl in self.VolumeControls.iteritems():
100             vol = self.hw.getContignuous(ctrl[0])
101             print "%s volume is %d" % (name , vol)
102             ctrl[1].setValue(-vol)
103
104         for name, ctrl in self.SelectorControls.iteritems():
105             state = self.hw.getDiscrete(ctrl[0])
106             print "%s state is %d" % (name , state)
107             ctrl[1].setCurrentIndex(state)   
Note: See TracBrowser for help on using the browser.