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

Revision 837, 2.3 kB (checked in by ppalmers, 16 years ago)

add generic mackie mixer control

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_mackie_genericui import *
25
26 class MackieGenericControl(MackieGenericControlUI):
27     def __init__(self,parent = None,name = None,modal = 0,fl = 0):
28         MackieGenericControlUI.__init__(self,parent,name,modal,fl)
29
30     # public slot
31     def setFB1(self,a0):
32         self.setVolume('FB1', a0)
33
34     # public slot
35     def setFB2(self,a0):
36         self.setVolume('FB2', a0)
37
38     def setVolume(self,a0,a1):
39             name=a0
40             vol = -a1
41             print "setting %s volume to %d" % (name, vol)
42             self.hw.setContignuous(self.VolumeControls[name][0], vol)
43
44     def setSelector(self,a0,a1):
45             name=a0
46             state = a1
47             print "setting %s state to %d" % (name, state)
48             self.hw.setDiscrete(self.SelectorControls[name][0], state)
49
50     def init(self):
51             print "Init Mackie Generic mixer window"
52
53             self.VolumeControls={
54                 'FB1':    ['/Mixer/Feature_1', self.sldFB1],
55                 'FB2' :   ['/Mixer/Feature_2', self.sldFB2],
56                 }
57
58             self.SelectorControls={
59
60             }
61
62     def initValues(self):
63             for name, ctrl in self.VolumeControls.iteritems():
64                 vol = self.hw.getContignuous(ctrl[0])
65                 print "%s volume is %d" % (name , vol)
66                 ctrl[1].setValue(-vol)
67
68             for name, ctrl in self.SelectorControls.iteritems():
69                 state = self.hw.getDiscrete(ctrl[0])
70                 print "%s state is %d" % (name , state)
71                 ctrl[1].setCurrentItem(state)   
Note: See TracBrowser for help on using the browser.