[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src engine/AudioDevice.cpp engine/Audi...
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src engine/AudioDevice.cpp engine/Audi... |
Date: |
Mon, 16 Nov 2009 19:50:44 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 09/11/16 19:50:44
Modified files:
src/engine : AudioDevice.cpp AudioDevice.h
src/traverso : CMakeLists.txt Interface.cpp Interface.h
Added files:
src/traverso/dialogs: AudioIODialog.cpp AudioIODialog.h
src/traverso/ui: AudioIODialog.ui
Log message:
* added Input/Output channel configuration (check Sheet->Audio I/O).
TODOs:
- save the configuration in the project file
- allow to create more jack ports
- testing testing testing...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.cpp?cvsroot=traverso&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.h?cvsroot=traverso&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/AudioIODialog.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/AudioIODialog.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ui/AudioIODialog.ui?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/CMakeLists.txt?cvsroot=traverso&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.167&r2=1.168
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.h?cvsroot=traverso&r1=1.61&r2=1.62
Patches:
Index: engine/AudioDevice.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- engine/AudioDevice.cpp 4 Mar 2009 20:54:00 -0000 1.56
+++ engine/AudioDevice.cpp 16 Nov 2009 19:50:43 -0000 1.57
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: AudioDevice.cpp,v 1.56 2009/03/04 20:54:00 r_sijrier Exp $
+$Id: AudioDevice.cpp,v 1.57 2009/11/16 19:50:43 n_doebelin Exp $
*/
#include "AudioDevice.h"
@@ -51,6 +51,7 @@
#include "AudioBus.h"
#include "Tsar.h"
//#include <sys/mman.h>
+#include <QDebug>
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
@@ -356,7 +357,17 @@
driver->attach();
- setup_buses();
+ if (!captureBusConfig.count()) {
+ setup_default_capture_buses();
+ } else {
+ setup_capture_buses();
+ }
+
+ if (!playbackBusConfig.count()) {
+ setup_default_playback_buses();
+ } else {
+ setup_playback_buses();
+ }
emit driverParamsChanged();
@@ -596,7 +607,70 @@
return names;
}
-void AudioDevice::setup_buses( )
+QStringList AudioDevice::get_capture_channel_names() const
+{
+ QStringList names;
+ foreach(AudioChannel* chan, captureChannels) {
+ names.append(chan->get_name());
+ }
+ return names;
+}
+
+QStringList AudioDevice::get_playback_channel_names() const
+{
+ QStringList names;
+ foreach(AudioChannel* chan, playbackChannels) {
+ names.append(chan->get_name());
+ }
+ return names;
+}
+
+QHash<QString, QStringList> AudioDevice::get_capture_bus_configuration()
+{
+ captureBusConfig.clear();
+
+ foreach(AudioBus* bus, captureBuses) {
+ QString name = bus->get_name();
+ QStringList lst;
+
+ for (int i = 0; i < bus->get_channel_count(); ++i) {
+ lst.append(bus->get_channel(i)->get_name());
+ }
+
+ captureBusConfig.insert(name, lst);
+ }
+
+ return captureBusConfig;
+}
+
+QHash<QString, QStringList> AudioDevice::get_playback_bus_configuration()
+{
+ playbackBusConfig.clear();
+
+ foreach(AudioBus* bus, playbackBuses) {
+ QString name = bus->get_name();
+ QStringList lst;
+
+ for (int i = 0; i < bus->get_channel_count(); ++i) {
+ lst.append(bus->get_channel(i)->get_name());
+ }
+
+ playbackBusConfig.insert(name, lst);
+ }
+
+ return playbackBusConfig;
+}
+
+void AudioDevice::set_bus_config(QHash<QString, QStringList> c_capture,
QHash<QString, QStringList> c_playback)
+{
+ captureBusConfig = c_capture;
+ playbackBusConfig = c_playback;
+
+ setup_capture_buses();
+ setup_playback_buses();
+}
+
+void AudioDevice::setup_default_capture_buses( )
{
int number = 1;
QByteArray name;
@@ -617,8 +691,14 @@
captureBuses.insert(name, bus);
}
// PWARN("Capture buses count is: %d", captureBuses.size());
+}
+
+void AudioDevice::setup_default_playback_buses( )
+{
+ int number = 1;
+ QByteArray name;
- number = 1;
+ AudioChannel* channel;
for (int i=1; i <= playbackChannels.size();) {
name = "Playback " + QByteArray::number(number++);
@@ -636,6 +716,56 @@
// PWARN("Playback buses count is: %d", playbackBuses.size());
}
+void AudioDevice::setup_capture_buses()
+{
+ QByteArray name;
+ QStringList list;
+ AudioChannel* channel;
+
+ QHash<QString, QStringList>::const_iterator it =
captureBusConfig.constBegin();
+ while (it != captureBusConfig.constEnd()) {
+ name = it.key().toUtf8();
+ list = it.value();
+
+ AudioBus* bus = new AudioBus(name);
+
+ for (int i = 0; i < list.count(); ++i) {
+ channel = captureChannels.value(list.at(i).toUtf8(), 0);
+ if (channel) {
+ bus->add_channel(channel);
+ }
+ }
+
+ captureBuses.insert(name, bus);
+ ++it;
+ }
+}
+
+void AudioDevice::setup_playback_buses()
+{
+ QByteArray name;
+ QStringList list;
+ AudioChannel* channel;
+
+ QHash<QString, QStringList>::const_iterator it =
playbackBusConfig.constBegin();
+ while (it != playbackBusConfig.constEnd()) {
+ name = it.key().toUtf8();
+ list = it.value();
+
+ AudioBus* bus = new AudioBus(name);
+
+ for (int i = 0; i < list.count(); ++i) {
+ channel = playbackChannels.value(list.at(i).toUtf8(),
0);
+ if (channel) {
+ bus->add_channel(channel);
+ }
+ }
+
+ playbackBuses.insert(name, bus);
+ ++it;
+ }
+}
+
/**
*
* @return The real audiodevices sample rate
Index: engine/AudioDevice.h
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- engine/AudioDevice.h 24 Nov 2008 11:17:28 -0000 1.30
+++ engine/AudioDevice.h 16 Nov 2009 19:50:43 -0000 1.31
@@ -100,9 +100,17 @@
return captureBuses.value(name);
}
+ void set_bus_config(QHash<QString, QStringList> c_capture,
QHash<QString, QStringList> c_playback);
+
QStringList get_capture_buses_names() const;
QStringList get_playback_buses_names() const;
+ QStringList get_capture_channel_names() const;
+ QStringList get_playback_channel_names() const;
+
+ QHash<QString, QStringList> get_capture_bus_configuration();
+ QHash<QString, QStringList> get_playback_bus_configuration();
+
QString get_device_name() const;
QString get_device_longname() const;
QString get_driver_type() const;
@@ -158,6 +166,8 @@
QHash<QByteArray, AudioChannel* > captureChannels;
QHash<QByteArray, AudioBus* > playbackBuses;
QHash<QByteArray, AudioBus* > captureBuses;
+ QHash<QString, QStringList> captureBusConfig;
+ QHash<QString, QStringList> playbackBusConfig;
QStringList availableDrivers;
QTimer m_xrunResetTimer;
#if defined (JACK_SUPPORT)
@@ -182,9 +192,12 @@
int create_driver(QString driverType, bool capture, bool playback,
const QString& cardDevice);
int transport_control(transport_state_t state);
- void setup_buses();
+ void setup_default_capture_buses();
+ void setup_default_playback_buses();
void post_process();
void free_memory();
+ void setup_capture_buses();
+ void setup_playback_buses();
// These are reserved for Driver Objects only!!
AudioChannel* register_capture_channel(const QByteArray& busName, const
QString& audioType, int flags, uint bufferSize, uint channel );
Index: traverso/CMakeLists.txt
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/CMakeLists.txt,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- traverso/CMakeLists.txt 23 Feb 2009 20:12:10 -0000 1.22
+++ traverso/CMakeLists.txt 16 Nov 2009 19:50:43 -0000 1.23
@@ -41,6 +41,7 @@
dialogs/ProjectConverterDialog.cpp
dialogs/ExportDialog.cpp
dialogs/CDWritingDialog.cpp
+dialogs/AudioIODialog.cpp
widgets/BusMonitor.cpp
widgets/CorrelationMeterWidget.cpp
widgets/ExportFormatOptionsWidget.cpp
@@ -81,6 +82,7 @@
ui/ExportDialog.ui
ui/CDWritingDialog.ui
ui/ImportClipsDialog.ui
+ui/AudioIODialog.ui
)
SET(TRAVERSO_GUI_MOC_CLASSES
@@ -102,6 +104,7 @@
dialogs/project/ProjectManagerDialog.h
dialogs/settings/SettingsDialog.h
dialogs/settings/Pages.h
+dialogs/AudioIODialog.h
widgets/BusMonitor.h
widgets/CorrelationMeterWidget.h
widgets/ExportFormatOptionsWidget.h
Index: traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- traverso/Interface.cpp 4 Mar 2009 20:59:54 -0000 1.167
+++ traverso/Interface.cpp 16 Nov 2009 19:50:43 -0000 1.168
@@ -72,6 +72,7 @@
#include "dialogs/ExportDialog.h"
#include "dialogs/CDWritingDialog.h"
#include "dialogs/project/ImportClipsDialog.h"
+#include "dialogs/AudioIODialog.h"
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
@@ -660,6 +661,9 @@
action = m_sheetMenu->addAction(tr("New &Track(s)..."));
connect(action, SIGNAL(triggered()), this,
SLOT(show_newtrack_dialog()));
+ action = m_sheetMenu->addAction(tr("Audio I/O..."));
+ connect(action, SIGNAL(triggered()), this,
SLOT(sheet_audio_io_dialog()));
+
m_sheetMenu->addSeparator();
m_settingsMenu = menuBar()->addMenu(tr("Se&ttings"));
@@ -1682,3 +1686,10 @@
sheet_selector_update_sheets();
}
+void Interface::sheet_audio_io_dialog()
+{
+ AudioIODialog *aiodlg = new AudioIODialog(this);
+ aiodlg->exec();
+ delete aiodlg;
+}
+
Index: traverso/Interface.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- traverso/Interface.h 4 Nov 2008 14:00:46 -0000 1.61
+++ traverso/Interface.h 16 Nov 2009 19:50:43 -0000 1.62
@@ -218,6 +218,7 @@
void sheet_selected();
void sheet_selector_sheet_added(Sheet*);
void sheet_selector_sheet_removed(Sheet*);
+ void sheet_audio_io_dialog();
};
Index: traverso/dialogs/AudioIODialog.cpp
===================================================================
RCS file: traverso/dialogs/AudioIODialog.cpp
diff -N traverso/dialogs/AudioIODialog.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/dialogs/AudioIODialog.cpp 16 Nov 2009 19:50:43 -0000 1.1
@@ -0,0 +1,381 @@
+/*
+ Copyright (C) 2009 Nicola Döbelin
+
+ This file is part of Traverso
+
+ Traverso 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
+ (at your option) any later version.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#include "AudioIODialog.h"
+
+#include <AudioDevice.h>
+#include <AudioBus.h>
+#include <AudioChannel.h>
+
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QHash>
+#include <QString>
+#include <QPushButton>
+#include <QStringList>
+#include <QDebug>
+
+AudioIODialog::AudioIODialog(QWidget* parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ QString str = audiodevice().get_device_longname();
+ labelDeviceName->setText(str);
+
+ initInput();
+ initOutput();
+}
+
+void AudioIODialog::initInput()
+{
+ m_inputChannelList = audiodevice().get_capture_channel_names();
+ const QHash<QString, QStringList> busList =
audiodevice().get_capture_bus_configuration();
+
+ tableWidgetInput->setColumnCount(m_inputChannelList.count() + 2);
+ tableWidgetInput->setRowCount(1);
+
+ for (int i = 0; i < m_inputChannelList.count(); ++i) {
+ tableWidgetInput->setItem(0, i + 2, new
QTableWidgetItem(m_inputChannelList.at(i)));
+ }
+
+ QHash<QString, QStringList>::const_iterator it = busList.constBegin();
+
+ while (it != busList.constEnd()) {
+
+ int span_start = tableWidgetInput->rowCount();
+ int span_end = 0;
+ QString side = "L";
+ QStringList busChannels = it.value();
+ for (int k = 0; k < busChannels.count(); ++k) {
+ if (busChannels.count() <= 1) {
+ side = "M";
+ }
+
+ int j = tableWidgetInput->rowCount();
+ tableWidgetInput->setRowCount(j + 1);
+ tableWidgetInput->setItem(j, 0, new
QTableWidgetItem(it.key()));
+
+ for (int i = 0; i < m_inputChannelList.count(); ++i) {
+ tableWidgetInput->setItem(j, 1, new
QTableWidgetItem(side));
+
+ QTableWidgetItem *itm = new QTableWidgetItem();
+ itm->setFlags(Qt::ItemIsUserCheckable |
Qt::ItemIsEnabled);
+
+ if (busChannels.at(k) ==
m_inputChannelList.at(i)) {
+ itm->setCheckState(Qt::Checked);
+ } else {
+ itm->setCheckState(Qt::Unchecked);
+ }
+
+ tableWidgetInput->setItem(j, i+2, itm);
+ }
+ side = "R";
+ ++span_end;
+ }
+ tableWidgetInput->setSpan(span_start, 0, span_end, 1);
+ ++it;
+ }
+}
+
+void AudioIODialog::initOutput()
+{
+ m_outputChannelList = audiodevice().get_playback_channel_names();
+ const QHash<QString, QStringList> busList =
audiodevice().get_playback_bus_configuration();
+
+ tableWidgetOutput->setColumnCount(m_outputChannelList.count() + 2);
+ tableWidgetOutput->setRowCount(1);
+
+ for (int i = 0; i < m_outputChannelList.count(); ++i) {
+ tableWidgetOutput->setItem(0, i + 2, new
QTableWidgetItem(m_outputChannelList.at(i)));
+ }
+
+ QHash<QString, QStringList>::const_iterator it = busList.constBegin();
+
+ while (it != busList.constEnd()) {
+
+ int span_start = tableWidgetOutput->rowCount();
+ int span_end = 0;
+ QString side = "L";
+ QStringList busChannels = it.value();
+ for (int k = 0; k < busChannels.count(); ++k) {
+ if (busChannels.count() <= 1) {
+ side = "M";
+ }
+
+ int j = tableWidgetOutput->rowCount();
+ tableWidgetOutput->setRowCount(j + 1);
+ tableWidgetOutput->setItem(j, 0, new
QTableWidgetItem(it.key()));
+
+ for (int i = 0; i < m_outputChannelList.count(); ++i) {
+ tableWidgetOutput->setItem(j, 1, new
QTableWidgetItem(side));
+
+ QTableWidgetItem *itm = new QTableWidgetItem();
+ itm->setFlags(Qt::ItemIsUserCheckable |
Qt::ItemIsEnabled);
+
+ if (busChannels.at(k) ==
m_outputChannelList.at(i)) {
+ itm->setCheckState(Qt::Checked);
+ } else {
+ itm->setCheckState(Qt::Unchecked);
+ }
+
+ tableWidgetOutput->setItem(j, i+2, itm);
+ }
+ side = "R";
+ ++span_end;
+ }
+ tableWidgetOutput->setSpan(span_start, 0, span_end, 1);
+ ++it;
+ }
+}
+
+void AudioIODialog::accept()
+{
+ QHash<QString, QStringList> ohash = outputBusConfig();
+ QHash<QString, QStringList> ihash = inputBusConfig();
+
+ audiodevice().set_bus_config(ihash, ohash);
+
+ close();
+}
+
+
+void AudioIODialog::addMonoInput()
+{
+ int rc = tableWidgetInput->rowCount();
+ tableWidgetInput->setRowCount(rc + 1);
+
+ tableWidgetInput->setItem(rc, 0, new QTableWidgetItem(QString(tr("Input
%1")).arg(rc)));
+ tableWidgetInput->setItem(rc, 1, new QTableWidgetItem("M"));
+
+ for (int i = 2; i < tableWidgetInput->columnCount(); ++i) {
+ QTableWidgetItem *itm = new QTableWidgetItem();
+ itm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ itm->setCheckState(Qt::Unchecked);
+ tableWidgetInput->setItem(rc, i, itm);
+ }
+}
+
+
+void AudioIODialog::addMonoOutput()
+{
+ int rc = tableWidgetOutput->rowCount();
+ tableWidgetOutput->setRowCount(rc + 1);
+
+ tableWidgetOutput->setItem(rc, 0, new
QTableWidgetItem(QString(tr("Output %1")).arg(rc)));
+ tableWidgetOutput->setItem(rc, 1, new QTableWidgetItem("M"));
+
+ for (int i = 2; i < tableWidgetOutput->columnCount(); ++i) {
+ QTableWidgetItem *itm = new QTableWidgetItem();
+ itm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ itm->setCheckState(Qt::Unchecked);
+ tableWidgetOutput->setItem(rc, i, itm);
+ }
+}
+
+void AudioIODialog::addStereoInput()
+{
+ int rc = tableWidgetInput->rowCount();
+ tableWidgetInput->setRowCount(rc + 2);
+
+ tableWidgetInput->setItem(rc, 0, new QTableWidgetItem(QString(tr("Input
%1")).arg(rc)));
+ tableWidgetInput->setSpan(rc, 0, 2, 1);
+ tableWidgetInput->setItem(rc, 1, new QTableWidgetItem("L"));
+ tableWidgetInput->setItem(rc+1, 1, new QTableWidgetItem("R"));
+
+ for (int i = 2; i < tableWidgetInput->columnCount(); ++i) {
+ QTableWidgetItem *litm = new QTableWidgetItem();
+ QTableWidgetItem *ritm = new QTableWidgetItem();
+ litm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ ritm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ litm->setCheckState(Qt::Unchecked);
+ ritm->setCheckState(Qt::Unchecked);
+ tableWidgetInput->setItem(rc, i, litm);
+ tableWidgetInput->setItem(rc+1, i, ritm);
+ }
+}
+
+void AudioIODialog::addStereoOutput()
+{
+ int rc = tableWidgetOutput->rowCount();
+ tableWidgetOutput->setRowCount(rc + 2);
+
+ tableWidgetOutput->setItem(rc, 0, new
QTableWidgetItem(QString(tr("Output %1")).arg(rc)));
+ tableWidgetOutput->setSpan(rc, 0, 2, 1);
+ tableWidgetOutput->setItem(rc, 1, new QTableWidgetItem("L"));
+ tableWidgetOutput->setItem(rc+1, 1, new QTableWidgetItem("R"));
+
+ for (int i = 2; i < tableWidgetOutput->columnCount(); ++i) {
+ QTableWidgetItem *litm = new QTableWidgetItem();
+ QTableWidgetItem *ritm = new QTableWidgetItem();
+ litm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ ritm->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ litm->setCheckState(Qt::Unchecked);
+ ritm->setCheckState(Qt::Unchecked);
+ tableWidgetOutput->setItem(rc, i, litm);
+ tableWidgetOutput->setItem(rc+1, i, ritm);
+ }
+}
+
+void AudioIODialog::removeInput()
+{
+ int row = tableWidgetInput->currentItem()->row();
+ int col = tableWidgetInput->currentItem()->column();
+ int rowspan = tableWidgetInput->rowSpan(row, col) - 1;
+
+ // this is a workaround. Shifting spans should be fixed in Qt 4.6
+ if (rowspan) {
+ tableWidgetInput->setSpan(row, col, 1, 1);
+ }
+
+ // remove all rows spanned by the first cell
+ while (rowspan >= 0) {
+ if (row + rowspan < tableWidgetInput->rowCount()) {
+ tableWidgetInput->removeRow(row + rowspan);
+ }
+ --rowspan;
+ }
+}
+
+void AudioIODialog::removeOutput()
+{
+ int row = tableWidgetOutput->currentItem()->row();
+ int col = tableWidgetOutput->currentItem()->column();
+ int rowspan = tableWidgetOutput->rowSpan(row, col) - 1;
+
+ // this is a workaround. Shifting spans should be fixed in Qt 4.6
+ if (rowspan) {
+ tableWidgetOutput->setSpan(row, col, 1, 1);
+ }
+
+ // remove all rows spanned by the first cell
+ while (rowspan >= 0) {
+ if (row + rowspan < tableWidgetOutput->rowCount()) {
+ tableWidgetOutput->removeRow(row + rowspan);
+ }
+ --rowspan;
+ }
+}
+
+void AudioIODialog::inputSelectionChanged(int x, int y)
+{
+ if (y > 0 || x == 0) {
+ buttonRemoveInput->setEnabled(false);
+ } else {
+ buttonRemoveInput->setEnabled(true);
+ }
+}
+
+void AudioIODialog::outputSelectionChanged(int x, int y)
+{
+ if (y > 0 || x == 0) {
+ buttonRemoveOutput->setEnabled(false);
+ } else {
+ buttonRemoveOutput->setEnabled(true);
+ }
+}
+
+QHash<QString, QStringList> AudioIODialog::outputBusConfig()
+{
+ QHash<QString, QStringList> hash;
+ QString bus;
+ QStringList channels;
+ QTableWidgetItem *b_item;
+ QTableWidgetItem *c_item;
+
+ if (tableWidgetOutput->rowCount() <= 1) {
+ return hash;
+ }
+
+ int i = 1;
+ while (i < tableWidgetOutput->rowCount()) {
+ channels.clear();
+ b_item = tableWidgetOutput->item(i, 0);
+
+ if (!b_item) {
+ break;
+ }
+
+ bus = b_item->text();
+
+ for (int j = 0; j < tableWidgetOutput->rowSpan(b_item->row(),
0); ++j) {
+ if (j) {
+ ++i;
+ }
+
+ for (int k = 2; k < tableWidgetOutput->columnCount();
++k) {
+ c_item = tableWidgetOutput->item(i, k);
+ if (c_item->checkState() == Qt::Checked) {
+
channels.append(tableWidgetOutput->item(0, k)->text());
+ }
+ }
+ }
+ hash.insert(bus, channels);
+ ++i;
+ }
+
+ return hash;
+}
+
+QHash<QString, QStringList> AudioIODialog::inputBusConfig()
+{
+ QHash<QString, QStringList> hash;
+ QString bus;
+ QStringList channels;
+ QTableWidgetItem *b_item;
+ QTableWidgetItem *c_item;
+
+ if (tableWidgetInput->rowCount() <= 1) {
+ return hash;
+ }
+
+ int i = 1;
+ while (i < tableWidgetInput->rowCount()) {
+ channels.clear();
+ b_item = tableWidgetInput->item(i, 0);
+
+ if (!b_item) {
+ break;
+ }
+
+ bus = b_item->text();
+
+ for (int j = 0; j < tableWidgetInput->rowSpan(b_item->row(),
0); ++j) {
+ if (j) {
+ ++i;
+ }
+
+ for (int k = 2; k < tableWidgetInput->columnCount();
++k) {
+ c_item = tableWidgetInput->item(i, k);
+ if (c_item->checkState() == Qt::Checked) {
+
channels.append(tableWidgetInput->item(0, k)->text());
+ }
+ }
+ }
+ hash.insert(bus, channels);
+ ++i;
+ }
+
+ return hash;
+}
+
+//eof
+
Index: traverso/dialogs/AudioIODialog.h
===================================================================
RCS file: traverso/dialogs/AudioIODialog.h
diff -N traverso/dialogs/AudioIODialog.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/dialogs/AudioIODialog.h 16 Nov 2009 19:50:43 -0000 1.1
@@ -0,0 +1,64 @@
+/*
+ Copyright (C) 2009 Nicola Döbelin
+
+ This file is part of Traverso
+
+ Traverso 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
+ (at your option) any later version.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#ifndef AUDIO_IO_DIALOG_H
+#define AUDIO_IO_DIALOG_H
+
+#include "ui_AudioIODialog.h"
+
+#include <QDialog>
+
+class AudioIODialog : public QDialog, protected Ui::AudioIODialog
+{
+ Q_OBJECT
+
+public:
+ AudioIODialog(QWidget* parent = 0);
+ ~AudioIODialog() {};
+
+
+private:
+ QStringList m_inputChannelList;
+ QStringList m_outputChannelList;
+
+ void initInput();
+ void initOutput();
+ void accept();
+ QHash<QString, QStringList> outputBusConfig();
+ QHash<QString, QStringList> inputBusConfig();
+
+private slots:
+ void addMonoInput();
+ void addStereoInput();
+ void removeInput();
+ void inputSelectionChanged(int, int);
+
+ void addMonoOutput();
+ void addStereoOutput();
+ void removeOutput();
+ void outputSelectionChanged(int, int);
+};
+
+
+
+#endif
+
+
Index: traverso/ui/AudioIODialog.ui
===================================================================
RCS file: traverso/ui/AudioIODialog.ui
diff -N traverso/ui/AudioIODialog.ui
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/ui/AudioIODialog.ui 16 Nov 2009 19:50:43 -0000 1.1
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AudioIODialog</class>
+ <widget class="QDialog" name="AudioIODialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>525</width>
+ <height>420</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Audio I/O</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="labelDeviceName">
+ <property name="text">
+ <string>Audio Device</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tabInput">
+ <attribute name="title">
+ <string>Input</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTableWidget" name="tableWidgetInput">
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="buttonAddMonoInput">
+ <property name="text">
+ <string>Add &Mono Bus</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonAddStereoInput">
+ <property name="text">
+ <string>Add &Stereo Bus</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonRemoveInput">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&Remove Bus</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabOutput">
+ <attribute name="title">
+ <string>Output</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTableWidget" name="tableWidgetOutput">
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="buttonAddMonoOutput">
+ <property name="text">
+ <string>Add &Mono Bus</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonAddStereoOutput">
+ <property name="text">
+ <string>Add &Stereo Bus</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonRemoveOutput">
+ <property name="text">
+ <string>&Remove Bus</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>257</x>
+ <y>410</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>325</x>
+ <y>410</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonRemoveOutput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>removeOutput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>455</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonAddStereoInput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>addStereoInput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>262</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonAddMonoInput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>addMonoInput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>99</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonRemoveInput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>removeInput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>425</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>tableWidgetInput</sender>
+ <signal>cellClicked(int,int)</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>inputSelectionChanged(int,int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>181</x>
+ <y>127</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>230</x>
+ <y>6</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonAddStereoOutput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>addStereoOutput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>196</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonAddMonoOutput</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>addMonoOutput()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>76</x>
+ <y>350</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>tableWidgetOutput</sender>
+ <signal>cellClicked(int,int)</signal>
+ <receiver>AudioIODialog</receiver>
+ <slot>outputSelectionChanged(int,int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>262</x>
+ <y>199</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>262</x>
+ <y>209</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>addMonoInput()</slot>
+ <slot>addStereoInput()</slot>
+ <slot>removeInput()</slot>
+ <slot>inputSelectionChanged(int,int)</slot>
+ <slot>addMonoOutput()</slot>
+ <slot>addStereoOutput()</slot>
+ <slot>removeOutput()</slot>
+ <slot>outputSelectionChanged(int,int)</slot>
+ </slots>
+</ui>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src engine/AudioDevice.cpp engine/Audi...,
Nicola Doebelin <=