1 |
# |
---|
2 |
# Copyright (C) 2009-2010 by Arnold Krille |
---|
3 |
# |
---|
4 |
# This file is part of FFADO |
---|
5 |
# FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
# |
---|
7 |
# This program is free software: you can redistribute it and/or modify |
---|
8 |
# it under the terms of the GNU General Public License as published by |
---|
9 |
# the Free Software Foundation, either version 2 of the License, or |
---|
10 |
# (at your option) version 3 of the License. |
---|
11 |
# |
---|
12 |
# This program is distributed in the hope that it will be useful, |
---|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 |
# GNU General Public License for more details. |
---|
16 |
# |
---|
17 |
# You should have received a copy of the GNU General Public License |
---|
18 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 |
# |
---|
20 |
|
---|
21 |
# from PyQt4 import QtGui, QtCore, Qt |
---|
22 |
# from PyQt4.QtGui import QWidget, QScrollArea |
---|
23 |
from ffado.import_pyqt import * |
---|
24 |
|
---|
25 |
import dbus |
---|
26 |
|
---|
27 |
import ffado.config |
---|
28 |
from ffado.widgets.matrixmixer import MatrixMixer |
---|
29 |
from ffado.widgets.crossbarrouter import * |
---|
30 |
from ffado.mixer.generic_dice_eap import * |
---|
31 |
|
---|
32 |
from ffado.config import * |
---|
33 |
|
---|
34 |
class BooleanControl: |
---|
35 |
def __init__(self, hw, path): |
---|
36 |
if ffado.config.bypassdbus: |
---|
37 |
self.value = False |
---|
38 |
return |
---|
39 |
self.iface = dbus.Interface( |
---|
40 |
hw.bus.get_object(hw.servername, path), |
---|
41 |
dbus_interface="org.ffado.Control.Element.Boolean") |
---|
42 |
self.value = self.iface.selected() |
---|
43 |
|
---|
44 |
def selected(self): |
---|
45 |
return self.value |
---|
46 |
|
---|
47 |
def select(self, n): |
---|
48 |
if self.iface.select(n): |
---|
49 |
self.value = n |
---|
50 |
return True |
---|
51 |
return False |
---|
52 |
|
---|
53 |
class DiscreteControl: |
---|
54 |
def __init__(self, hw, path): |
---|
55 |
if ffado.config.bypassdbus: |
---|
56 |
self.value = 0 |
---|
57 |
return |
---|
58 |
self.iface = dbus.Interface( |
---|
59 |
hw.bus.get_object(hw.servername, path), |
---|
60 |
dbus_interface="org.ffado.Control.Element.Discrete") |
---|
61 |
self.value = self.iface.getValue() |
---|
62 |
|
---|
63 |
def getvalue(self): |
---|
64 |
return self.value |
---|
65 |
|
---|
66 |
def setvalue(self, v): |
---|
67 |
if v != self.value: |
---|
68 |
self.iface.setValue(v) |
---|
69 |
self.value = v |
---|
70 |
|
---|
71 |
class Profire2626(Generic_Dice_EAP): |
---|
72 |
def __init__(self, parent=None): |
---|
73 |
Generic_Dice_EAP.__init__(self, parent) |
---|
74 |
|
---|
75 |
def buildMixer(self): |
---|
76 |
#print( self.hw ) |
---|
77 |
#print( self.hw.getText("/Generic/Nickname") ) |
---|
78 |
Generic_Dice_EAP.buildMixer(self) |
---|
79 |
|
---|
80 |
widget = QWidget() |
---|
81 |
uicLoad("ffado/mixer/profire2626_settings.ui", widget) |
---|
82 |
|
---|
83 |
# Add Settings to ffado-mixer panels |
---|
84 |
scrollarea = QScrollArea(self.tabs) |
---|
85 |
scrollarea.setWidgetResizable(False) |
---|
86 |
scrollarea.setWidget(widget) |
---|
87 |
self.tabs.addTab(scrollarea, "Settings") |
---|
88 |
|
---|
89 |
# Master volume knob |
---|
90 |
from collections import namedtuple |
---|
91 |
LineInfo = namedtuple('LineInfo', ['widget','Interface']) |
---|
92 |
|
---|
93 |
# Volume Unactivating |
---|
94 |
self.LineUnActivates = [] |
---|
95 |
p = LineInfo(widget.line1line2, BooleanControl(self.hw, self.hw.basepath+"/EAP/Settings/VolumeKnob/Line1Line2")) |
---|
96 |
self.LineUnActivates.append(p) |
---|
97 |
p = LineInfo(widget.line3line4, BooleanControl(self.hw, self.hw.basepath+"/EAP/Settings/VolumeKnob/Line3Line4")) |
---|
98 |
self.LineUnActivates.append(p) |
---|
99 |
p = LineInfo(widget.line5line6, BooleanControl(self.hw, self.hw.basepath+"/EAP/Settings/VolumeKnob/Line5Line6")) |
---|
100 |
self.LineUnActivates.append(p) |
---|
101 |
p = LineInfo(widget.line7line8, BooleanControl(self.hw, self.hw.basepath+"/EAP/Settings/VolumeKnob/Line7Line8")) |
---|
102 |
self.LineUnActivates.append(p) |
---|
103 |
|
---|
104 |
for l in self.LineUnActivates: |
---|
105 |
l.widget.setChecked(l.Interface.selected()) |
---|
106 |
l.widget.toggled.connect(l.Interface.select) |
---|
107 |
|
---|
108 |
def getDisplayTitle(self): |
---|
109 |
return "M-Audio Profire 2626 Mixer" |
---|
110 |
|
---|
111 |
# |
---|
112 |
# vim: et ts=4 sw=4 |
---|