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_quatafireui import * |
---|
25 |
|
---|
26 |
class QuataFireMixer(QuataFireMixerUI): |
---|
27 |
def __init__(self,parent = None,name = None,modal = 0,fl = 0): |
---|
28 |
QuataFireMixerUI.__init__(self,parent,name,modal,fl) |
---|
29 |
|
---|
30 |
def init(self): |
---|
31 |
print "Init Quatafire mixer window" |
---|
32 |
|
---|
33 |
self.VolumeControls={ |
---|
34 |
self.sldCh1: ['/Mixer/Feature_1', 1], |
---|
35 |
self.sldCh2: ['/Mixer/Feature_1', 2], |
---|
36 |
self.sldCh34: ['/Mixer/Feature_2', 0], |
---|
37 |
self.sldCh56: ['/Mixer/Feature_3', 0], |
---|
38 |
self.sldDawAll: ['/Mixer/Feature_4', 0], |
---|
39 |
self.sldDawCH1: ['/Mixer/Feature_4', 1], |
---|
40 |
self.sldDawCH2: ['/Mixer/Feature_4', 2], |
---|
41 |
self.sldDawCH3: ['/Mixer/Feature_4', 3], |
---|
42 |
self.sldDawCH4: ['/Mixer/Feature_4', 4], |
---|
43 |
self.sldDawCH5: ['/Mixer/Feature_4', 5], |
---|
44 |
self.sldDawCH6: ['/Mixer/Feature_4', 6], |
---|
45 |
self.sldDawCH7: ['/Mixer/Feature_4', 7], |
---|
46 |
self.sldDawCH8: ['/Mixer/Feature_4', 8], |
---|
47 |
} |
---|
48 |
self.PanControls={ |
---|
49 |
#self.dialCh1: ['/Mixer/Feature_1'], |
---|
50 |
#self.dialCh2: ['/Mixer/Feature_1'], |
---|
51 |
self.dialCh34: ['/Mixer/Feature_2'], |
---|
52 |
self.dialCh56: ['/Mixer/Feature_3'], |
---|
53 |
} |
---|
54 |
|
---|
55 |
def updateVolume(self,a0): |
---|
56 |
sender = self.sender() |
---|
57 |
vol = -a0 |
---|
58 |
print "setting %s volume to %d" % (self.VolumeControls[sender][0], vol) |
---|
59 |
self.hw.setContignuous(self.VolumeControls[sender][0], vol, self.VolumeControls[sender][1]) |
---|
60 |
|
---|
61 |
def updatePan(self,a0): |
---|
62 |
sender = self.sender() |
---|
63 |
pan_left = a0 |
---|
64 |
if pan_left < 0: |
---|
65 |
pan_left = 0 |
---|
66 |
|
---|
67 |
pan_right = -a0 |
---|
68 |
if pan_right < 0: |
---|
69 |
pan_right = 0 |
---|
70 |
|
---|
71 |
print "setting %s pan left to %d" % (self.PanControls[sender][0], -pan_left) |
---|
72 |
self.hw.setContignuous(self.PanControls[sender][0], -pan_left, 1) |
---|
73 |
print "setting %s pan right to %d" % (self.PanControls[sender][0], -pan_right) |
---|
74 |
self.hw.setContignuous(self.PanControls[sender][0], -pan_right, 2) |
---|
75 |
|
---|
76 |
def initValues(self): |
---|
77 |
for ctrl, info in self.VolumeControls.iteritems(): |
---|
78 |
vol = self.hw.getContignuous(self.VolumeControls[ctrl][0], self.VolumeControls[ctrl][1]) |
---|
79 |
val = -vol |
---|
80 |
print "%s volume is %d, set to %d" % (ctrl.name(), vol, val) |
---|
81 |
ctrl.setValue(val) |
---|
82 |
|
---|
83 |
# connect the UI element |
---|
84 |
QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateVolume) |
---|
85 |
|
---|
86 |
for ctrl, info in self.PanControls.iteritems(): |
---|
87 |
pan_left = self.hw.getContignuous(self.PanControls[ctrl][0], 1) |
---|
88 |
pan_right = self.hw.getContignuous(self.PanControls[ctrl][0], 2) |
---|
89 |
|
---|
90 |
print "%s pan left is %d" % (ctrl.name() , pan_left) |
---|
91 |
print "%s pan right is %d" % (ctrl.name() , pan_right) |
---|
92 |
|
---|
93 |
if pan_left == 0: |
---|
94 |
val = pan_right |
---|
95 |
else: |
---|
96 |
val = -pan_left |
---|
97 |
|
---|
98 |
ctrl.setValue(val) |
---|
99 |
# connect the UI element |
---|
100 |
QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updatePan) |
---|
101 |
|
---|