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