root/branches/libffado-2.0/support/mixer/mixer_phase24.py

Revision 1106, 4.6 kB (checked in by arnonym, 16 years ago)

Not my day. Remove the modal parameter from the arguments.

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 PhaseX24Control(PhaseX24ControlUI):
27     def __init__(self,parent = None,name = None,fl = 0):
28         PhaseX24ControlUI.__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         self.setVolume('master', a0)
54
55     # public slot
56     def setLineLevel(self,a0):
57         print "setting line level to %d" % (a0 * -768)
58         self.hw.setContignuous('/Mixer/Feature_2', a0 * -768)
59
60     # public slot
61     def setFrontLevel(self,a0):
62         if(a0 == 0):
63             print "setting front level to %d" % (0)
64             self.hw.setContignuous('/Mixer/Feature_8', 0)
65         else:
66             print "setting front level to %d" % (1536)
67             self.hw.setContignuous('/Mixer/Feature_8', 1536)
68
69     # public slot
70     def setOutSource12(self,a0):
71         self.setSelector('outsource12', a0)
72
73     # public slot
74     def setOutSource34(self,a0):
75         self.setSelector('outsource34', a0)
76
77     # public slot
78     def setOutSourceSPDIF(self,a0):
79         self.setSelector('outsourcespdif', a0)
80
81     # public slot
82     def setSyncSource(self,a0):
83         self.setSelector('syncsource', a0)
84
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 init(self):
99             print "Init PhaseX24 mixer window"
100
101             self.VolumeControls={
102                 'master':         ['/Mixer/Feature_1', self.sldMaster],
103                 'analogin' :      ['/Mixer/Feature_6', self.sldLineIn],
104                 'spdifin' :       ['/Mixer/Feature_7', self.sldSPDIFIn],
105                 'out12' :         ['/Mixer/Feature_3', self.sldInput12],
106                 'out34' :         ['/Mixer/Feature_4', self.sldInput34],
107                 'outspdif' :      ['/Mixer/Feature_5', self.sldSPDIFOut],
108                 }
109
110             self.SelectorControls={
111                 'outsource12':    ['/Mixer/Selector_1', self.cmbOutSource12],
112                 'outsource34':    ['/Mixer/Selector_2', self.cmbOutSource34],
113                 'outsourcespdif': ['/Mixer/Selector_3', self.cmbOutSourceSPDIF],
114                 'syncsource':     ['/Mixer/Selector_4', self.cmbSetSyncSource],
115             }
116
117     def initValues(self):
118             for name, ctrl in self.VolumeControls.iteritems():
119                 vol = self.hw.getContignuous(ctrl[0])
120                 print "%s volume is %d" % (name , vol)
121                 ctrl[1].setValue(-vol)
122
123             for name, ctrl in self.SelectorControls.iteritems():
124                 state = self.hw.getDiscrete(ctrl[0])
125                 print "%s state is %d" % (name , state)
126                 ctrl[1].setCurrentItem(state)   
127
128             val=self.hw.getContignuous('/Mixer/Feature_2')/-768
129             if val>4:
130                 self.cmbFrontLevel.setCurrentItem(4)
131             else:
132                 self.cmbFrontLevel.setCurrentItem(val)
133
134             val=self.hw.getContignuous('/Mixer/Feature_8')
135             if val>0:
136                 self.cmbFrontLevel.setCurrentItem(1)
137             else:
138                 self.cmbFrontLevel.setCurrentItem(0)
Note: See TracBrowser for help on using the browser.