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

Revision 1364, 4.0 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_quatafireui import *
26
27 class QuataFireMixer(QWidget, Ui_QuataFireMixerUI):
28     def __init__(self,parent = None):
29         QWidget.__init__(self,parent)
30         self.setupUi(self)
31
32         self.VolumeControls={
33                 self.sldCh1: ['/Mixer/Feature_Volume_1', 1],
34                 self.sldCh2: ['/Mixer/Feature_Volume_1', 2],
35                 self.sldCh34: ['/Mixer/Feature_Volume_2', 0],
36                 self.sldCh56: ['/Mixer/Feature_Volume_3', 0],
37                 self.sldDawAll: ['/Mixer/Feature_Volume_4', 0],
38                 self.sldDawCH1: ['/Mixer/Feature_Volume_4', 1],
39                 self.sldDawCH2: ['/Mixer/Feature_Volume_4', 2],
40                 self.sldDawCH3: ['/Mixer/Feature_Volume_4', 3],
41                 self.sldDawCH4: ['/Mixer/Feature_Volume_4', 4],
42                 self.sldDawCH5: ['/Mixer/Feature_Volume_4', 5],
43                 self.sldDawCH6: ['/Mixer/Feature_Volume_4', 6],
44                 self.sldDawCH7: ['/Mixer/Feature_Volume_4', 7],
45                 self.sldDawCH8: ['/Mixer/Feature_Volume_4', 8],
46                 }
47         self.PanControls={
48                 #self.dialCh1: ['/Mixer/Feature_Volume_1'],
49                 #self.dialCh2: ['/Mixer/Feature_Volume_1'],
50                 self.dialCh34: ['/Mixer/Feature_Volume_2'],
51                 self.dialCh56: ['/Mixer/Feature_Volume_3'],
52                 }
53
54     def updateVolume(self,a0):
55         sender = self.sender()
56         vol = -a0
57         print "setting %s volume to %d" % (self.VolumeControls[sender][0], vol)
58         self.hw.setContignuous(self.VolumeControls[sender][0], vol, self.VolumeControls[sender][1])
59
60     def updatePan(self,a0):
61         sender = self.sender()
62         pan_left = a0
63         if pan_left < 0:
64             pan_left = 0
65
66         pan_right = -a0
67         if pan_right < 0:
68             pan_right = 0
69
70         print "setting %s pan left to %d" % (self.PanControls[sender][0], -pan_left)
71         self.hw.setContignuous(self.PanControls[sender][0], -pan_left, 1)
72         print "setting %s pan right to %d" % (self.PanControls[sender][0], -pan_right)
73         self.hw.setContignuous(self.PanControls[sender][0], -pan_right, 2)
74
75     def initValues(self):
76         for ctrl, info in self.VolumeControls.iteritems():
77             vol = self.hw.getContignuous(self.VolumeControls[ctrl][0], self.VolumeControls[ctrl][1])
78             val = -vol
79             print "%s volume is %d, set to %d" % (ctrl.objectName(), vol, val)
80             ctrl.setValue(val)
81
82             # connect the UI element
83             QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateVolume)
84
85         for ctrl, info in self.PanControls.iteritems():
86             pan_left = self.hw.getContignuous(self.PanControls[ctrl][0], 1)
87             pan_right = self.hw.getContignuous(self.PanControls[ctrl][0], 2)
88
89             print "%s pan left is %d" % (ctrl.objectName() , pan_left)
90             print "%s pan right is %d" % (ctrl.objectName() , pan_right)
91
92             if pan_left == 0:
93                 val = pan_right
94             else:
95                 val = -pan_left
96            
97             ctrl.setValue(val)
98             # connect the UI element
99             QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updatePan)
100
Note: See TracBrowser for help on using the browser.