diff options
author | Chris Robinson <[email protected]> | 2016-03-02 23:18:07 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-02 23:18:07 -0800 |
commit | 457c34c18965611b7b33bc62345e3e74142ec0dd (patch) | |
tree | f1ff3f02c4630f5e687a398bfaaf549d2595f52a /utils/alsoft-config | |
parent | d169fd859de5f9545d0b78f385aa6f1320925817 (diff) |
Add a backend tab page for JACK options
Diffstat (limited to 'utils/alsoft-config')
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 39 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.h | 4 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.ui | 82 |
3 files changed, 125 insertions, 0 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 03c1fc5e..4eb5f25a 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -1,6 +1,8 @@ #include "config.h" +#include <cmath> + #include <QFileDialog> #include <QMessageBox> #include <QCloseEvent> @@ -10,6 +12,7 @@ #include "ui_mainwindow.h" namespace { + static const struct { char backend_name[16]; char full_string[32]; @@ -164,6 +167,7 @@ static QStringList getAllDataPaths(QString append=QString()) } return list; } + } MainWindow::MainWindow(QWidget *parent) : @@ -175,6 +179,7 @@ MainWindow::MainWindow(QWidget *parent) : mEffectSlotValidator(NULL), mSourceSendValidator(NULL), mSampleRateValidator(NULL), + mJackBufferValidator(NULL), mNeedsSave(false) { ui->setupUi(this); @@ -250,6 +255,9 @@ MainWindow::MainWindow(QWidget *parent) : mSampleRateValidator = new QIntValidator(8000, 192000, this); ui->sampleRateCombo->lineEdit()->setValidator(mSampleRateValidator); + mJackBufferValidator = new QIntValidator(0, 8192, this); + ui->jackBufferSizeLine->setValidator(mJackBufferValidator); + connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadConfigFromFile())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveConfigAsFile())); @@ -312,6 +320,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->pulseAllowMovesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(ui->pulseFixRateCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); + connect(ui->jackAutospawnCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); + connect(ui->jackBufferSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(updateJackBufferSizeEdit(int))); + connect(ui->jackBufferSizeLine, SIGNAL(editingFinished()), this, SLOT(updateJackBufferSizeSlider())); + connect(ui->alsaDefaultDeviceLine, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(ui->alsaDefaultCaptureLine, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(ui->alsaResamplerCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); @@ -355,6 +367,7 @@ MainWindow::~MainWindow() delete mEffectSlotValidator; delete mSourceSendValidator; delete mSampleRateValidator; + delete mJackBufferValidator; } void MainWindow::closeEvent(QCloseEvent *event) @@ -701,6 +714,10 @@ void MainWindow::loadConfig(const QString &fname) ui->pulseAllowMovesCheckBox->setChecked(settings.value("pulse/allow-moves", false).toBool()); ui->pulseFixRateCheckBox->setChecked(settings.value("pulse/fix-rate", false).toBool()); + ui->jackAutospawnCheckBox->setChecked(settings.value("jack/spawn-server", false).toBool()); + ui->jackBufferSizeLine->setText(settings.value("jack/buffer-size", QString()).toString()); + updateJackBufferSizeSlider(); + ui->alsaDefaultDeviceLine->setText(settings.value("alsa/device", QString()).toString()); ui->alsaDefaultCaptureLine->setText(settings.value("alsa/capture", QString()).toString()); ui->alsaResamplerCheckBox->setChecked(settings.value("alsa/allow-resampler", false).toBool()); @@ -917,6 +934,11 @@ void MainWindow::saveConfig(const QString &fname) const ui->pulseFixRateCheckBox->isChecked() ? QString("true") : QString(/*"false"*/) ); + settings.setValue("jack/spawn-server", + ui->jackAutospawnCheckBox->isChecked() ? QString("true") : QString(/*"false"*/) + ); + settings.setValue("jack/buffer-size", ui->jackBufferSizeLine->text()); + settings.setValue("alsa/device", ui->alsaDefaultDeviceLine->text()); settings.setValue("alsa/capture", ui->alsaDefaultCaptureLine->text()); settings.setValue("alsa/allow-resampler", @@ -1008,6 +1030,23 @@ void MainWindow::updatePeriodCountSlider() } +void MainWindow::updateJackBufferSizeEdit(int size) +{ + ui->jackBufferSizeLine->clear(); + if(size > 0) + ui->jackBufferSizeLine->insert(QString::number(1<<size)); + enableApplyButton(); +} + +void MainWindow::updateJackBufferSizeSlider() +{ + int value = ui->jackBufferSizeLine->text().toInt(); + int pos = (int)floor(log2(value) + 0.5); + ui->jackBufferSizeSlider->setSliderPosition(pos); + enableApplyButton(); +} + + void MainWindow::addHrtfFile() { QString path = QFileDialog::getExistingDirectory(this, tr("Select HRTF Path")); diff --git a/utils/alsoft-config/mainwindow.h b/utils/alsoft-config/mainwindow.h index 27f3c252..0ddb9a92 100644 --- a/utils/alsoft-config/mainwindow.h +++ b/utils/alsoft-config/mainwindow.h @@ -33,6 +33,9 @@ private slots: void updatePeriodCountEdit(int size); void updatePeriodCountSlider(); + void updateJackBufferSizeEdit(int size); + void updateJackBufferSizeSlider(); + void addHrtfFile(); void removeHrtfFile(); @@ -57,6 +60,7 @@ private: QValidator *mEffectSlotValidator; QValidator *mSourceSendValidator; QValidator *mSampleRateValidator; + QValidator *mJackBufferValidator; bool mNeedsSave; diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 28540a73..28c699f3 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -784,6 +784,11 @@ application or system to determine if it should be used.</string> </item> <item> <property name="text"> + <string>JACK</string> + </property> + </item> + <item> + <property name="text"> <string>ALSA</string> </property> </item> @@ -950,6 +955,83 @@ rate to match the PulseAudio device.</string> </property> </widget> </widget> + <widget class="QWidget" name="page_7"> + <widget class="QCheckBox" name="jackAutospawnCheckBox"> + <property name="geometry"> + <rect> + <x>20</x> + <y>10</y> + <width>141</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>AutoSpawn Server</string> + </property> + </widget> + <widget class="QGroupBox" name="groupBox_7"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>401</width> + <height>80</height> + </rect> + </property> + <property name="toolTip"> + <string>The update buffer size, in samples, that the backend +will keep buffered to handle the server's real-time +processing requests. Must be a power of 2.</string> + </property> + <property name="title"> + <string>Buffer Size</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <widget class="QLineEdit" name="jackBufferSizeLine"> + <property name="geometry"> + <rect> + <x>320</x> + <y>30</y> + <width>71</width> + <height>21</height> + </rect> + </property> + <property name="placeholderText"> + <string>0</string> + </property> + </widget> + <widget class="QSlider" name="jackBufferSizeSlider"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>301</width> + <height>23</height> + </rect> + </property> + <property name="maximum"> + <number>13</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="pageStep"> + <number>4</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + <property name="tickInterval"> + <number>1</number> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="page_3"> <widget class="QLabel" name="label_17"> <property name="geometry"> |