root/trunk/libffado/support/mixer/mixer_phase24.py

Revision 1361, 5.3 kB (checked in by ppalmers, 14 years ago)

Merge 2.0 branch changes.

svn merge -r1349:HEAD svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0

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