From 5eb724fe08d9fb0007f4e9e7c09e607970157a4d Mon Sep 17 00:00:00 2001 From: mocchi Date: Sun, 2 Mar 2014 02:06:31 +0000 Subject: [PATCH] bebob: add a partial support for PreSonus Inspire1394 With Jay Fenlason's help, some specification of PreSonus Inspire1394 is clear. Re: [FFADO-devel] [RFC v3] [PATCH 00/52] Enhancement for support of firewire devices http://sourceforge.net/p/ffado/mailman/message/32030795/ This commit is for a partial support for it. The device uses some vendor specific commands to control mic parameter. This will be done at future work. git-svn-id: svn+ssh://ffado.org/ffado/trunk@2486 2be59082-3212-0410-8809-b0798e1608f0 --- libffado/configuration | 8 + .../mixer-qt4/ffado/mixer/presonus_inspire1394.py | 192 +++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 libffado/support/mixer-qt4/ffado/mixer/presonus_inspire1394.py diff --git a/libffado/configuration b/libffado/configuration index 6f842c7b..e5b21216 100644 --- a/libffado/configuration +++ b/libffado/configuration @@ -83,6 +83,14 @@ device_definitions = ( }, { vendorid = 0x000a92; + modelid = 0x00010001; + vendorname = "PreSonus"; + modelname = "Inspire1394"; + driver = "BEBOB"; + mixer = "Presonus_Inspire1394"; +}, +{ + vendorid = 0x000a92; modelid = 0x00010066; vendorname = "PreSonus"; modelname = "FirePOD"; diff --git a/libffado/support/mixer-qt4/ffado/mixer/presonus_inspire1394.py b/libffado/support/mixer-qt4/ffado/mixer/presonus_inspire1394.py new file mode 100644 index 00000000..f11be924 --- /dev/null +++ b/libffado/support/mixer-qt4/ffado/mixer/presonus_inspire1394.py @@ -0,0 +1,192 @@ +# +# presonus_inspire1394.py - Qt4/FFADO application for Presonus Inspire1394 +# Copyright (C) 2014 Takashi Sakamoto +# +# This file is part of FFADO +# FFADO = Free Firewire (pro-)audio drivers for linux +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +from PyQt4 import QtGui, QtCore +from PyQt4.QtCore import QObject, Qt, SIGNAL +from PyQt4.QtGui import QHBoxLayout, QVBoxLayout, QGridLayout +from PyQt4.QtGui import QGroupBox, QLabel, QSizePolicy, QSlider, QComboBox, QToolButton +from math import log10 +from ffado.config import * + +class Presonus_Inspire1394(QtGui.QWidget): + # feature_id/name + inputs = [[1, "Analog in 1/2"], + [2, "Analog in 3/4"]] + + # feature_id/name + mixer_src = [[3, "Analog in 1/2"], + [4, "Analog in 3/4"], + [5, "Stream in 5/6"]] + + # feature id/name + outputs = [[6, "Analog out 1/2"], + [7, "HP out 1/2"]] + + # selector_id/sources + out_src = [1, ["Mixer out 1/2", "Stream in 1/2"]] + + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + + def getDisplayTitle(self): + return 'Inspire1394' + + def buildMixer(self): + self.Selectors = {} + self.Volumes = {} + + plain_layout = QHBoxLayout(self) + + left = QGroupBox(self) + plain_layout.addWidget(left) + self.addAnalogInputs(left) + + center = QGroupBox(self) + plain_layout.addWidget(center) + self.addInternalMixer(center) + + right = QGroupBox(self) + plain_layout.addWidget(right) + self.addAnalogOutputs(right) + + def addAnalogInputs(self, box): + box_layout = QVBoxLayout() + box.setLayout(box_layout) + box.setTitle("Analog Inputs") + + grid = QGroupBox(box) + box_layout.addWidget(grid) + grid_layout = QGridLayout() + grid.setLayout(grid_layout) + + self.addVolumes(self.inputs, grid, grid_layout) + + def addAnalogOutputs(self, box): + box_layout = QVBoxLayout() + box.setLayout(box_layout) + box.setTitle("Analog Outputs") + + cmb = QComboBox(box) + box_layout.addWidget(cmb) + for i in range(len(self.out_src[1])): + cmb.addItem(self.out_src[1][i], i) + self.Selectors[cmb] = ["/Mixer/Selector_%d" % self.out_src[0]] + + grid = QGroupBox(box) + box_layout.addWidget(grid) + grid_layout = QGridLayout() + grid.setLayout(grid_layout) + + self.addVolumes(self.outputs, grid, grid_layout) + + def addInternalMixer(self, box): + box_layout = QGridLayout() + box.setLayout(box_layout) + box.setTitle("Hardware Mixer") + + self.addVolumes(self.mixer_src, box, box_layout) + + def addVolumes(self, elms, parent, layout): + for col in range(len(elms)): + label = QLabel(parent) + label.setText(elms[col][1]) + layout.addWidget(label, 0, col * 2, 1, 2, Qt.AlignHCenter) + + l_sld = self.getSlider(parent) + r_sld = self.getSlider(parent) + layout.addWidget(l_sld, 1, col * 2, Qt.AlignHCenter) + layout.addWidget(r_sld, 1, col * 2 + 1, Qt.AlignHCenter) + + link = self.getLink(parent) + layout.addWidget(link, 2, col * 2, 1, 2, Qt.AlignHCenter) + + path = "/Mixer/Feature_Volume_%d" % elms[col][0] + self.Volumes[l_sld] = [path, 1, r_sld, link] + self.Volumes[r_sld] = [path, 2, l_sld, link] + + # widget helper functions + def getSlider(self, parent): + sld = QSlider(parent) + sld.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) + sld.setMinimum(0) + sld.setMaximum(99) + sld.setPageStep(10) + sld.setPageStep(10) + sld.setMinimumHeight(50) + sld.setTickInterval(25) + sld.setTickPosition(QSlider.TicksBothSides) + return sld + + def getLink(self, parent): + link = QToolButton(parent) + link.setText("link") + link.setCheckable(True) + link.setMinimumWidth(100) + link.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + return link + + def initValues(self): + for ctl, params in self.Selectors.items(): + path = params[0] + state = self.hw.getDiscrete(path) + ctl.setCurrentIndex(state) + QObject.connect(ctl, SIGNAL('activated(int)'), self.updateSelector) + + for ctl, params in self.Volumes.items(): + path = params[0] + idx = params[1] + pair = params[2] + link = params[3] + + db = self.hw.getContignuous(path, idx) + vol = self.db2vol(db) + ctl.setValue(vol) + QObject.connect(ctl, SIGNAL('valueChanged(int)'), self.updateVolume) + + if idx == 2: + pair_db = self.hw.getContignuous(path, 1) + if pair_db == db: + link.setChecked(True) + + # helper functions + def vol2db(self, vol): + return (log10(vol + 1) - 2) * 16384 + + def db2vol(self, db): + return pow(10, db / 16384 + 2) - 1 + + def updateSelector(self, state): + sender = self.sender() + path = self.Selectors[sender][0] + self.hw.setDiscrete(path, state) + + def updateVolume(self, vol): + sender = self.sender() + path = self.Volumes[sender][0] + idx = self.Volumes[sender][1] + pair = self.Volumes[sender][2] + link = self.Volumes[sender][3] + + db = self.vol2db(vol) + self.hw.setContignuous(path, db, idx) + + if link.isChecked(): + pair.setValue(vol) -- 2.11.4.GIT