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('phase88') |
---|
29 |
|
---|
30 |
class Phase88Control(QWidget): |
---|
31 |
def __init__(self,parent = None): |
---|
32 |
QWidget.__init__(self,parent) |
---|
33 |
uicLoad("mixer_phase88", self) |
---|
34 |
|
---|
35 |
self.VolumeControls={ |
---|
36 |
'master': ['/Mixer/Feature_Volume_1', self.sldInputMaster], |
---|
37 |
'line12' : ['/Mixer/Feature_Volume_2', self.sldInput12], |
---|
38 |
'line34' : ['/Mixer/Feature_Volume_3', self.sldInput34], |
---|
39 |
'line56' : ['/Mixer/Feature_Volume_4', self.sldInput56], |
---|
40 |
'line78' : ['/Mixer/Feature_Volume_5', self.sldInput78], |
---|
41 |
'spdif' : ['/Mixer/Feature_Volume_6', self.sldInputSPDIF], |
---|
42 |
'waveplay' : ['/Mixer/Feature_Volume_7', self.sldInputWavePlay], |
---|
43 |
} |
---|
44 |
|
---|
45 |
self.SelectorControls={ |
---|
46 |
'outassign': ['/Mixer/Selector_6', self.comboOutAssign], |
---|
47 |
'inassign': ['/Mixer/Selector_7', self.comboInAssign], |
---|
48 |
'externalsync': ['/Mixer/Selector_8', self.comboExtSync], |
---|
49 |
'syncsource': ['/Mixer/Selector_9', self.comboSyncSource], |
---|
50 |
'frontback': ['/Mixer/Selector_10', self.comboFrontBack], |
---|
51 |
} |
---|
52 |
|
---|
53 |
def switchFrontState(self,a0): |
---|
54 |
self.setSelector('frontback', a0) |
---|
55 |
|
---|
56 |
def switchOutAssign(self,a0): |
---|
57 |
self.setSelector('outassign', a0) |
---|
58 |
|
---|
59 |
def switchWaveInAssign(self,a0): |
---|
60 |
self.setSelector('inassign', a0) |
---|
61 |
|
---|
62 |
def switchSyncSource(self,a0): |
---|
63 |
self.setSelector('syncsource', a0) |
---|
64 |
|
---|
65 |
def switchExtSyncSource(self,a0): |
---|
66 |
self.setSelector('externalsync', a0) |
---|
67 |
|
---|
68 |
def setVolume12(self,a0): |
---|
69 |
self.setVolume('line12', a0) |
---|
70 |
|
---|
71 |
def setVolume34(self,a0): |
---|
72 |
self.setVolume('line34', a0) |
---|
73 |
|
---|
74 |
def setVolume56(self,a0): |
---|
75 |
self.setVolume('line56', a0) |
---|
76 |
|
---|
77 |
def setVolume78(self,a0): |
---|
78 |
self.setVolume('line78', a0) |
---|
79 |
|
---|
80 |
def setVolumeSPDIF(self,a0): |
---|
81 |
self.setVolume('spdif', a0) |
---|
82 |
|
---|
83 |
def setVolumeWavePlay(self,a0): |
---|
84 |
self.setVolume('waveplay', a0) |
---|
85 |
|
---|
86 |
def setVolumeMaster(self,a0): |
---|
87 |
self.setVolume('master', a0) |
---|
88 |
|
---|
89 |
def setVolume(self,a0,a1): |
---|
90 |
name=a0 |
---|
91 |
vol = -a1 |
---|
92 |
log.debug("setting %s volume to %d" % (name, vol)) |
---|
93 |
self.hw.setContignuous(self.VolumeControls[name][0], vol) |
---|
94 |
|
---|
95 |
def setSelector(self,a0,a1): |
---|
96 |
name=a0 |
---|
97 |
state = a1 |
---|
98 |
log.debug("setting %s state to %d" % (name, state)) |
---|
99 |
self.hw.setDiscrete(self.SelectorControls[name][0], state) |
---|
100 |
|
---|
101 |
def initValues(self): |
---|
102 |
for name, ctrl in self.VolumeControls.iteritems(): |
---|
103 |
vol = self.hw.getContignuous(ctrl[0]) |
---|
104 |
log.debug("%s volume is %d" % (name , vol)) |
---|
105 |
ctrl[1].setValue(-vol) |
---|
106 |
|
---|
107 |
for name, ctrl in self.SelectorControls.iteritems(): |
---|
108 |
state = self.hw.getDiscrete(ctrl[0]) |
---|
109 |
log.debug("%s state is %d" % (name , state)) |
---|
110 |
ctrl[1].setCurrentIndex(state) |
---|
111 |
|
---|
112 |
# vim: et |
---|