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

Revision 2803, 4.0 kB (checked in by jwoithe, 3 years ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

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