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

Revision 1351, 4.2 kB (checked in by wagi, 16 years ago)

merge libffado-2.0-with-panning into libffado-2.0 branch

-r 1337:1339

yeah! I'm 1337!

Line 
1 #
2 # Copyright (C) 2005-2008 by Daniel Wagner
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_bcoaudio5ui import *
25
26 class BCoAudio5Control(BCoAudio5ControlUI):
27     def __init__(self,parent = None,name = None,fl = 0):
28         BCoAudio5ControlUI.__init__(self,parent,name,fl)
29
30     def setComboMixSource(self,a0):
31             self.setSelector('line34source', a0)
32
33     def setVolumeIn12(self,a0):
34             self.setVolume('in_line12', a0)
35
36     def setVolumeIn34(self,a0):
37             self.setVolume('in_line34', a0)
38
39     def setVolumeInSPDIF(self,a0):
40             self.setVolume('in_spdif', a0)
41
42     def setVolumeOut12(self,a0):
43             self.setVolume('out_line12', a0)
44
45     def setVolumeOut34(self,a0):
46             self.setVolume('out_line34', a0)
47
48     def setCrossA(self,a0):
49             self.setVolume('cross_a', a0)
50
51     def setCrossB(self,a0):
52             self.setVolume('cross_b', a0)
53
54     def setVolume(self,a0,a1):
55             name = a0
56             vol = -a1
57             print "setting %s volume to %d" % (name, vol)
58             self.hw.setContignuous(self.VolumeControls[name][0], vol)
59
60     def setSelector(self,a0,a1):
61             name = a0
62             state = a1
63             print "setting %s state to %d" % (name, state)
64             self.hw.setDiscrete(self.SelectorControls[name][0], state)
65
66     def updateClockSelection(self,a0):
67         #disable the combobox
68         self.comboClockSelect.setEnabled(False)
69         #change the clock source
70         self.clockselect.select(a0)
71         #refresh the clock source selection box
72         self.initClockSelector()
73         #make the box available again
74         self.comboClockSelect.setEnabled(True)
75
76     def initClockSelector(self):
77         self.comboClockSelect.clear()
78         nbsources = self.clockselect.count()
79         for idx in range(nbsources):
80             desc = self.clockselect.getEnumLabel(idx)
81             self.comboClockSelect.insertItem(desc)
82         active_idx = self.clockselect.selected();
83         if active_idx >= 0:
84             self.comboClockSelect.setCurrentItem(active_idx)
85
86     def init(self):
87             print "Init BridgeCo Audio 5 window"
88
89             self.VolumeControls={
90                 'in_line12'  :   ['/Mixer/Feature_Volume_1', self.sldInput12],
91                 'in_line34'  :   ['/Mixer/Feature_Volume_2', self.sldInput34],
92                 'in_spdif'   :   ['/Mixer/Feature_Volume_3', self.sldInputSPDIF],
93                 'out_line12' :   ['/Mixer/Feature_Volume_6', self.sldOutput12],
94                 'out_line34' :   ['/Mixer/Feature_Volume_7', self.sldOutput34],
95                 'cross_a'    :   ['/Mixer/Feature_Volume_4', self.sldCrossA],
96                 'cross_b'    :   ['/Mixer/Feature_Volume_5', self.sldCrossB],
97                 }
98
99             self.SelectorControls={
100                 'line34source':   ['/Mixer/Selector_1', self.comboMixSource],
101             }
102
103     def initValues(self):
104             for name, ctrl in self.VolumeControls.iteritems():
105                 vol = self.hw.getContignuous(ctrl[0])
106                 print "%s volume is %d" % (name , vol)
107                 ctrl[1].setValue(-vol)
108
109             for name, ctrl in self.SelectorControls.iteritems():
110                 state = self.hw.getDiscrete(ctrl[0])
111                 print "%s state is %d" % (name , state)
112                 ctrl[1].setCurrentItem(state)
113
114             self.initClockSelector()
115             # connect the clock selector UI element
116             QObject.connect(self.comboClockSelect, SIGNAL('activated(int)'), self.updateClockSelection)
Note: See TracBrowser for help on using the browser.