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

Revision 2803, 5.3 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('phase24')
30
31 class Phase24Control(QWidget):
32     def __init__(self,parent = None):
33         QWidget.__init__(self,parent)
34         uicLoad("ffado/mixer/phase24", self)
35
36         self.VolumeControls={
37             'analogin' :      ['/Mixer/Feature_Volume_6', self.sldLineIn],
38             'spdifin' :       ['/Mixer/Feature_Volume_7', self.sldSPDIFIn],
39             'out12' :         ['/Mixer/Feature_Volume_3', self.sldInput12],
40             'out34' :         ['/Mixer/Feature_Volume_4', self.sldInput34],
41             'outspdif' :      ['/Mixer/Feature_Volume_5', self.sldSPDIFOut],
42             }
43
44         self.SelectorControls={
45             'outsource12':    ['/Mixer/Selector_1', self.cmbOutSource12],
46             'outsource34':    ['/Mixer/Selector_2', self.cmbOutSource34],
47             'outsourcespdif': ['/Mixer/Selector_3', self.cmbOutSourceSPDIF],
48             'syncsource':     ['/Mixer/Selector_4', self.cmbSetSyncSource],
49         }
50
51     # public slot
52     def setVolume12(self,a0):
53         self.setVolume('out12', a0)
54
55     # public slot
56     def setVolume34(self,a0):
57         self.setVolume('out34', a0)
58
59     # public slot
60     def setVolumeLineIn(self,a0):
61         self.setVolume('analogin', a0)
62
63     # public slot
64     def setVolumeSPDIFOut(self,a0):
65         self.setVolume('outspdif', a0)
66
67     # public slot
68     def setVolumeSPDIFIn(self,a0):
69         self.setVolume('spdifin', a0)
70
71     # public slot
72     def setVolumeMaster(self,a0):
73         if self.isPhaseX24:
74             return
75         self.setVolume('master', a0)
76
77     # public slot
78     def setLineLevel(self,a0):
79         log.debug("setting line level to %d" % (a0 * -768))
80         self.hw.setContignuous('/Mixer/Feature_Volume_2', a0 * -768)
81
82     # public slot
83     def setFrontLevel(self,a0):
84         if self.isPhaseX24:
85             return
86         if(a0 == 0):
87             log.debug("setting front level to %d" % (0))
88             self.hw.setContignuous('/Mixer/Feature_Volume_8', 0)
89         else:
90             log.debug("setting front level to %d" % (1536))
91             self.hw.setContignuous('/Mixer/Feature_Volume_8', 1536)
92
93     # public slot
94     def setOutSource12(self,a0):
95         self.setSelector('outsource12', a0)
96
97     # public slot
98     def setOutSource34(self,a0):
99         self.setSelector('outsource34', a0)
100
101     # public slot
102     def setOutSourceSPDIF(self,a0):
103         self.setSelector('outsourcespdif', a0)
104
105     # public slot
106     def setSyncSource(self,a0):
107         self.setSelector('syncsource', a0)
108
109     def setVolume(self,a0,a1):
110             name=a0
111             vol = -a1
112             log.debug("setting %s volume to %d" % (name, vol))
113             self.hw.setContignuous(self.VolumeControls[name][0], vol)
114
115     def setSelector(self,a0,a1):
116             name=a0
117             state = a1
118             log.debug("setting %s state to %d" % (name, state))
119             self.hw.setDiscrete(self.SelectorControls[name][0], state)
120
121     def initValues(self):
122             self.modelId = self.configrom.getModelId()
123             if self.modelId == 0x00000007:
124                 self.isPhaseX24 = True
125             else:
126                 self.isPhaseX24 = False
127
128             if self.isPhaseX24:
129                 self.setWindowTitle("Terratec Phase X24 Control")
130                 self.cmbFrontLevel.setEnabled(False)
131                 self.sldMaster.setEnabled(False)
132             else:
133                 self.setWindowTitle("Terratec Phase 24 Control")
134
135                 self.VolumeControls['master'] = ['/Mixer/Feature_Volume_1', self.sldMaster]
136                 self.sldMaster.setEnabled(True)
137
138                 self.cmbFrontLevel.setEnabled(True)
139                 val = self.hw.getContignuous('/Mixer/Feature_Volume_8')
140                 if val > 0:
141                     self.cmbFrontLevel.setCurrentIndex(1)
142                 else:
143                     self.cmbFrontLevel.setCurrentIndex(0)
144
145             for name, ctrl in self.VolumeControls.items():
146                 vol = self.hw.getContignuous(ctrl[0])
147                 log.debug("%s volume is %d" % (name , vol))
148                 ctrl[1].setValue(-vol)
149
150             for name, ctrl in self.SelectorControls.items():
151                 state = self.hw.getDiscrete(ctrl[0])
152                 log.debug("%s state is %d" % (name , state))
153                 ctrl[1].setCurrentIndex(state)
154
155             val = self.hw.getContignuous('/Mixer/Feature_Volume_2')/-768
156             if val > 4:
157                 self.cmbLineLevel.setCurrentIndex(4)
158             else:
159                 self.cmbLineLevel.setCurrentIndex(val)
160
161 # vim: et
Note: See TracBrowser for help on using the browser.