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

Revision 742, 4.6 kB (checked in by ppalmers, 13 years ago)

- Remove some obsolete support files and dirs

- Clean up the license statements in the source files. Everything is

GPL version 3 now.

- Add license and copyright notices to scons scripts

- Clean up some other text files

Line 
1 #
2 # Copyright (C) 2005-2007 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 3 of the License, or
12 # (at your option) any later version.
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,modal = 0,fl = 0):
28         PhaseX24ControlUI.__init__(self,parent,name,modal,fl)
29
30     # public slot
31     def setVolume12(self,a0):
32         self.setVolume('out12', -a0)
33
34     # public slot
35     def setVolume34(self,a0):
36         self.setVolume('out34', -a0)
37
38     # public slot
39     def setVolumeLineIn(self,a0):
40         self.setVolume('analogin', -a0)
41
42     # public slot
43     def setVolumeSPDIFOut(self,a0):
44         self.setVolume('outspdif', -a0)
45
46     # public slot
47     def setVolumeSPDIFIn(self,a0):
48         self.setVolume('spdifin', -a0)
49
50     # public slot
51     def setVolumeMaster(self,a0):
52         self.setVolume('master', -a0)
53
54     # public slot
55     def setLineLevel(self,a0):
56         print "setting line level to %d" % (a0 * -768)
57         self.hw.setContignuous('/Mixer/Feature_2', a0 * -768)
58
59     # public slot
60     def setFrontLevel(self,a0):
61         if(a0 == 0):
62             print "setting front level to %d" % (0)
63             self.hw.setContignuous('/Mixer/Feature_8', 0)
64         else:
65             print "setting front level to %d" % (1536)
66             self.hw.setContignuous('/Mixer/Feature_8', 1536)
67
68     # public slot
69     def setOutSource12(self,a0):
70         self.setSelector('outsource12', a0)
71
72     # public slot
73     def setOutSource34(self,a0):
74         self.setSelector('outsource34', a0)
75
76     # public slot
77     def setOutSourceSPDIF(self,a0):
78         self.setSelector('outsourcespdif', a0)
79
80     # public slot
81     def setSyncSource(self,a0):
82         self.setSelector('syncsource', a0)
83
84
85     def setVolume(self,a0,a1):
86             name=a0
87             vol = -a1
88             print "setting %s volume to %d" % (name, vol)
89             self.hw.setContignuous(self.VolumeControls[name][0], vol)
90
91     def setSelector(self,a0,a1):
92             name=a0
93             state = a1
94             print "setting %s state to %d" % (name, state)
95             self.hw.setDiscrete(self.SelectorControls[name][0], state)
96
97     def init(self):
98             print "Init PhaseX24 mixer window"
99
100             self.VolumeControls={
101                 'master':         ['/Mixer/Feature_1', self.sldMaster],
102                 'analogin' :      ['/Mixer/Feature_6', self.sldLineIn],
103                 'spdifin' :       ['/Mixer/Feature_7', self.sldSPDIFIn],
104                 'out12' :         ['/Mixer/Feature_3', self.sldInput12],
105                 'out34' :         ['/Mixer/Feature_4', self.sldInput34],
106                 'outspdif' :      ['/Mixer/Feature_5', self.sldInputSPDIF],
107                 }
108
109             self.SelectorControls={
110                 'outsource12':    ['/Mixer/Selector_1', self.cmbOutSource12],
111                 'outsource34':    ['/Mixer/Selector_2', self.cmbOutSource34],
112                 'outsourcespdif': ['/Mixer/Selector_3', self.cmbOutSourceSPDIF],
113                 'syncsource':     ['/Mixer/Selector_4', self.cmbSetSyncSource],
114             }
115
116     def initValues(self):
117             for name, ctrl in self.VolumeControls.iteritems():
118                 vol = self.hw.getContignuous(ctrl[0])
119                 print "%s volume is %d" % (name , vol)
120                 ctrl[1].setValue(-vol)
121
122             for name, ctrl in self.SelectorControls.iteritems():
123                 state = self.hw.getDiscrete(ctrl[0])
124                 print "%s state is %d" % (name , state)
125                 ctrl[1].setCurrentItem(state)   
126
127             val=self.hw.getContignuous('/Mixer/Feature_2')/-768
128             if val>4:
129                 self.cmbFrontLevel.setCurrentItem(4)
130             else:
131                 self.cmbFrontLevel.setCurrentItem(val)
132
133             val=self.hw.getContignuous('/Mixer/Feature_8')
134             if val>0:
135                 self.cmbFrontLevel.setCurrentItem(1)
136             else:
137                 self.cmbFrontLevel.setCurrentItem(0)
138            
Note: See TracBrowser for help on using the browser.