2015-10-11 23:56:45 -07:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMessageBox>
|
2016-02-22 07:56:05 -08:00
|
|
|
#include <QCloseEvent>
|
2013-06-23 22:47:51 -07:00
|
|
|
#include <QSettings>
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
static const struct {
|
|
|
|
char backend_name[16];
|
2016-02-27 19:37:42 -08:00
|
|
|
char full_string[32];
|
|
|
|
} backendList[] = {
|
2015-10-11 23:56:45 -07:00
|
|
|
#ifdef HAVE_JACK
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "jack", "JACK" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PULSEAUDIO
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "pulse", "PulseAudio" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ALSA
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "alsa", "ALSA" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_COREAUDIO
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "core", "CoreAudio" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_OSS
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "oss", "OSS" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SOLARIS
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "solaris", "Solaris" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SNDIO
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "sndio", "SoundIO" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_QSA
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "qsa", "QSA" },
|
2013-06-23 22:47:51 -07:00
|
|
|
#endif
|
2015-10-11 23:56:45 -07:00
|
|
|
#ifdef HAVE_MMDEVAPI
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "mmdevapi", "MMDevAPI" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_DSOUND
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "dsound", "DirectSound" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_WINMM
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "winmm", "Windows Multimedia" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PORTAUDIO
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "port", "PortAudio" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_OPENSL
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "opensl", "OpenSL" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
|
|
|
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "null", "Null Output" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#ifdef HAVE_WAVE
|
2016-02-27 19:37:42 -08:00
|
|
|
{ "wave", "Wave Writer" },
|
2015-10-11 23:56:45 -07:00
|
|
|
#endif
|
2013-06-23 22:47:51 -07:00
|
|
|
{ "", "" }
|
|
|
|
};
|
|
|
|
|
2014-09-13 23:12:40 -07:00
|
|
|
static const struct {
|
2015-11-05 09:42:08 -08:00
|
|
|
const char name[64];
|
2014-09-13 23:12:40 -07:00
|
|
|
const char value[16];
|
|
|
|
} speakerModeList[] = {
|
|
|
|
{ "Autodetect", "" },
|
|
|
|
{ "Mono", "mono" },
|
|
|
|
{ "Stereo", "stereo" },
|
|
|
|
{ "Quadrophonic", "quad" },
|
2014-11-08 05:53:17 -08:00
|
|
|
{ "5.1 Surround (Side)", "surround51" },
|
|
|
|
{ "5.1 Surround (Rear)", "surround51rear" },
|
2014-11-07 01:13:20 -08:00
|
|
|
{ "6.1 Surround", "surround61" },
|
|
|
|
{ "7.1 Surround", "surround71" },
|
2014-09-13 23:12:40 -07:00
|
|
|
|
|
|
|
{ "", "" }
|
|
|
|
}, sampleTypeList[] = {
|
|
|
|
{ "Autodetect", "" },
|
|
|
|
{ "8-bit int", "int8" },
|
|
|
|
{ "8-bit uint", "uint8" },
|
|
|
|
{ "16-bit int", "int16" },
|
|
|
|
{ "16-bit uint", "uint16" },
|
|
|
|
{ "32-bit int", "int32" },
|
|
|
|
{ "32-bit uint", "uint32" },
|
|
|
|
{ "32-bit float", "float32" },
|
|
|
|
|
2014-09-26 20:45:46 -07:00
|
|
|
{ "", "" }
|
|
|
|
}, resamplerList[] = {
|
2016-02-22 03:05:13 -08:00
|
|
|
{ "Point", "point" },
|
|
|
|
{ "Linear", "linear" },
|
|
|
|
{ "Default (Linear)", "" },
|
|
|
|
{ "4-Point Sinc", "sinc4" },
|
|
|
|
{ "8-Point Sinc", "sinc8" },
|
|
|
|
{ "Band-limited Sinc", "bsinc" },
|
2014-09-26 20:45:46 -07:00
|
|
|
|
2015-08-28 22:09:07 -07:00
|
|
|
{ "", "" }
|
|
|
|
}, stereoModeList[] = {
|
|
|
|
{ "Autodetect", "" },
|
|
|
|
{ "Speakers", "speakers" },
|
|
|
|
{ "Headphones", "headphones" },
|
|
|
|
|
2014-09-13 23:12:40 -07:00
|
|
|
{ "", "" }
|
|
|
|
};
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
static QString getDefaultConfigName()
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
static const char fname[] = "alsoft.ini";
|
|
|
|
QByteArray base = qgetenv("AppData");
|
|
|
|
#else
|
|
|
|
static const char fname[] = "alsoft.conf";
|
|
|
|
QByteArray base = qgetenv("XDG_CONFIG_HOME");
|
|
|
|
if(base.isEmpty())
|
|
|
|
{
|
|
|
|
base = qgetenv("HOME");
|
|
|
|
if(base.isEmpty() == false)
|
|
|
|
base += "/.config";
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if(base.isEmpty() == false)
|
|
|
|
return base +'/'+ fname;
|
|
|
|
return fname;
|
|
|
|
}
|
2014-08-05 04:56:51 -07:00
|
|
|
|
|
|
|
static QString getBaseDataPath()
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
QByteArray base = qgetenv("AppData");
|
|
|
|
#else
|
|
|
|
QByteArray base = qgetenv("XDG_DATA_HOME");
|
|
|
|
if(base.isEmpty())
|
|
|
|
{
|
|
|
|
base = qgetenv("HOME");
|
|
|
|
if(!base.isEmpty())
|
|
|
|
base += "/.local/share";
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static QStringList getAllDataPaths(QString append=QString())
|
|
|
|
{
|
|
|
|
QStringList list;
|
|
|
|
list.append(getBaseDataPath());
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
// TODO: Common AppData path
|
|
|
|
#else
|
|
|
|
QString paths = qgetenv("XDG_DATA_DIRS");
|
|
|
|
if(paths.isEmpty())
|
|
|
|
paths = "/usr/local/share/:/usr/share/";
|
|
|
|
list += paths.split(QChar(':'), QString::SkipEmptyParts);
|
|
|
|
#endif
|
|
|
|
QStringList::iterator iter = list.begin();
|
|
|
|
while(iter != list.end())
|
|
|
|
{
|
|
|
|
if(iter->isEmpty())
|
|
|
|
iter = list.erase(iter);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iter->append(append);
|
|
|
|
iter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
QMainWindow(parent),
|
|
|
|
ui(new Ui::MainWindow),
|
|
|
|
mPeriodSizeValidator(NULL),
|
|
|
|
mPeriodCountValidator(NULL),
|
|
|
|
mSourceCountValidator(NULL),
|
|
|
|
mEffectSlotValidator(NULL),
|
|
|
|
mSourceSendValidator(NULL),
|
2016-02-22 07:56:05 -08:00
|
|
|
mSampleRateValidator(NULL),
|
|
|
|
mNeedsSave(false)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2014-09-13 23:12:40 -07:00
|
|
|
for(int i = 0;speakerModeList[i].name[0];i++)
|
|
|
|
ui->channelConfigCombo->addItem(speakerModeList[i].name);
|
|
|
|
ui->channelConfigCombo->adjustSize();
|
|
|
|
for(int i = 0;sampleTypeList[i].name[0];i++)
|
|
|
|
ui->sampleFormatCombo->addItem(sampleTypeList[i].name);
|
|
|
|
ui->sampleFormatCombo->adjustSize();
|
2015-08-28 22:09:07 -07:00
|
|
|
for(int i = 0;stereoModeList[i].name[0];i++)
|
|
|
|
ui->stereoModeCombo->addItem(stereoModeList[i].name);
|
|
|
|
ui->stereoModeCombo->adjustSize();
|
2014-09-13 23:12:40 -07:00
|
|
|
|
2016-02-22 03:05:13 -08:00
|
|
|
int count;
|
|
|
|
for(count = 0;resamplerList[count].name[0];count++) {
|
|
|
|
}
|
|
|
|
ui->resamplerSlider->setRange(0, count-1);
|
|
|
|
|
2015-10-12 05:52:34 -07:00
|
|
|
ui->hrtfStateComboBox->adjustSize();
|
|
|
|
|
2015-10-11 23:56:45 -07:00
|
|
|
#if !defined(HAVE_NEON) && !defined(HAVE_SSE)
|
|
|
|
ui->cpuExtDisabledLabel->move(ui->cpuExtDisabledLabel->x(), ui->cpuExtDisabledLabel->y() - 60);
|
|
|
|
#else
|
|
|
|
ui->cpuExtDisabledLabel->setVisible(false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_NEON
|
|
|
|
|
|
|
|
#ifndef HAVE_SSE4_1
|
|
|
|
#ifndef HAVE_SSE3
|
|
|
|
#ifndef HAVE_SSE2
|
|
|
|
#ifndef HAVE_SSE
|
|
|
|
ui->enableSSECheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE */
|
|
|
|
ui->enableSSE2CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE2 */
|
|
|
|
ui->enableSSE3CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE3 */
|
|
|
|
ui->enableSSE41CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE4.1 */
|
|
|
|
ui->enableNeonCheckBox->setVisible(false);
|
|
|
|
|
|
|
|
#else /* !Neon */
|
|
|
|
|
|
|
|
#ifndef HAVE_SSE4_1
|
|
|
|
#ifndef HAVE_SSE3
|
|
|
|
#ifndef HAVE_SSE2
|
|
|
|
#ifndef HAVE_SSE
|
|
|
|
ui->enableNeonCheckBox->move(ui->enableNeonCheckBox->x(), ui->enableNeonCheckBox->y() - 30);
|
|
|
|
ui->enableSSECheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE */
|
|
|
|
ui->enableSSE2CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE2 */
|
|
|
|
ui->enableSSE3CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE3 */
|
|
|
|
ui->enableSSE41CheckBox->setVisible(false);
|
|
|
|
#endif /* !SSE4.1 */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
mPeriodSizeValidator = new QIntValidator(64, 8192, this);
|
|
|
|
ui->periodSizeEdit->setValidator(mPeriodSizeValidator);
|
|
|
|
mPeriodCountValidator = new QIntValidator(2, 16, this);
|
|
|
|
ui->periodCountEdit->setValidator(mPeriodCountValidator);
|
|
|
|
|
|
|
|
mSourceCountValidator = new QIntValidator(0, 256, this);
|
|
|
|
ui->srcCountLineEdit->setValidator(mSourceCountValidator);
|
|
|
|
mEffectSlotValidator = new QIntValidator(0, 16, this);
|
|
|
|
ui->effectSlotLineEdit->setValidator(mEffectSlotValidator);
|
|
|
|
mSourceSendValidator = new QIntValidator(0, 4, this);
|
|
|
|
ui->srcSendLineEdit->setValidator(mSourceSendValidator);
|
|
|
|
mSampleRateValidator = new QIntValidator(8000, 192000, this);
|
|
|
|
ui->sampleRateCombo->lineEdit()->setValidator(mSampleRateValidator);
|
|
|
|
|
|
|
|
connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadConfigFromFile()));
|
|
|
|
connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveConfigAsFile()));
|
|
|
|
|
2016-02-22 07:56:05 -08:00
|
|
|
connect(ui->closeCancelButton, SIGNAL(clicked()), this, SLOT(cancelCloseAction()));
|
2013-06-23 22:47:51 -07:00
|
|
|
connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(saveCurrentConfig()));
|
|
|
|
|
2016-02-22 07:56:05 -08:00
|
|
|
connect(ui->channelConfigCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->sampleFormatCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->stereoModeCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->sampleRateCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->sampleRateCombo, SIGNAL(editTextChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
|
2016-02-22 03:05:13 -08:00
|
|
|
connect(ui->resamplerSlider, SIGNAL(valueChanged(int)), this, SLOT(updateResamplerLabel(int)));
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
connect(ui->periodSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(updatePeriodSizeEdit(int)));
|
|
|
|
connect(ui->periodSizeEdit, SIGNAL(editingFinished()), this, SLOT(updatePeriodSizeSlider()));
|
|
|
|
connect(ui->periodCountSlider, SIGNAL(valueChanged(int)), this, SLOT(updatePeriodCountEdit(int)));
|
|
|
|
connect(ui->periodCountEdit, SIGNAL(editingFinished()), this, SLOT(updatePeriodCountSlider()));
|
|
|
|
|
2016-02-23 06:52:13 -08:00
|
|
|
connect(ui->preferredHrtfComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
2016-02-22 07:56:05 -08:00
|
|
|
connect(ui->hrtfStateComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
2013-06-23 22:47:51 -07:00
|
|
|
connect(ui->hrtfAddButton, SIGNAL(clicked()), this, SLOT(addHrtfFile()));
|
|
|
|
connect(ui->hrtfRemoveButton, SIGNAL(clicked()), this, SLOT(removeHrtfFile()));
|
2013-06-28 00:08:57 -07:00
|
|
|
connect(ui->hrtfFileList, SIGNAL(itemSelectionChanged()), this, SLOT(updateHrtfRemoveButton()));
|
2016-02-22 07:56:05 -08:00
|
|
|
connect(ui->defaultHrtfPathsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
|
|
|
|
connect(ui->srcCountLineEdit, SIGNAL(editingFinished()), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->srcSendLineEdit, SIGNAL(editingFinished()), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->effectSlotLineEdit, SIGNAL(editingFinished()), this, SLOT(enableApplyButton()));
|
|
|
|
|
|
|
|
connect(ui->enableSSECheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableSSE2CheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableSSE3CheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableSSE41CheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableNeonCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
ui->enabledBackendList->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
connect(ui->enabledBackendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showEnabledBackendMenu(QPoint)));
|
|
|
|
|
|
|
|
ui->disabledBackendList->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
connect(ui->disabledBackendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDisabledBackendMenu(QPoint)));
|
2016-02-22 07:56:05 -08:00
|
|
|
connect(ui->backendCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
|
|
|
|
connect(ui->defaultReverbComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->emulateEaxCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableEaxReverbCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableStdReverbCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableChorusCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableCompressorCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableDistortionCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableEchoCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableEqualizerCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableFlangerCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableModulatorCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->enableDedicatedCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
2013-06-23 22:47:51 -07:00
|
|
|
|
2016-02-27 19:18:57 -08:00
|
|
|
connect(ui->pulseAutospawnCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->pulseAllowMovesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
connect(ui->pulseFixRateCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
|
|
|
|
|
|
|
ui->backendListWidget->setCurrentRow(0);
|
|
|
|
ui->tabWidget->setCurrentIndex(0);
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
loadConfig(getDefaultConfigName());
|
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
delete mPeriodSizeValidator;
|
|
|
|
delete mPeriodCountValidator;
|
|
|
|
delete mSourceCountValidator;
|
|
|
|
delete mEffectSlotValidator;
|
|
|
|
delete mSourceSendValidator;
|
|
|
|
delete mSampleRateValidator;
|
|
|
|
}
|
|
|
|
|
2016-02-22 07:56:05 -08:00
|
|
|
void MainWindow::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
if(!mNeedsSave)
|
|
|
|
event->accept();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QMessageBox::StandardButton btn = QMessageBox::warning(this,
|
|
|
|
tr("Apply changes?"), tr("Save changes before quitting?"),
|
|
|
|
QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel
|
|
|
|
);
|
|
|
|
if(btn == QMessageBox::Save)
|
|
|
|
saveCurrentConfig();
|
|
|
|
if(btn == QMessageBox::Cancel)
|
|
|
|
event->ignore();
|
|
|
|
else
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::cancelCloseAction()
|
|
|
|
{
|
|
|
|
mNeedsSave = false;
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-23 11:03:58 -08:00
|
|
|
QStringList MainWindow::collectHrtfs()
|
2016-02-23 06:52:13 -08:00
|
|
|
{
|
|
|
|
QStringList ret;
|
2016-02-23 11:03:58 -08:00
|
|
|
|
|
|
|
for(int i = 0;i < ui->hrtfFileList->count();i++)
|
2016-02-23 06:52:13 -08:00
|
|
|
{
|
2016-02-23 11:03:58 -08:00
|
|
|
QDir dir(ui->hrtfFileList->item(i)->text());
|
2016-02-24 05:08:39 -08:00
|
|
|
QStringList fnames = dir.entryList(QDir::Files | QDir::Readable, QDir::Name);
|
2016-02-23 06:52:13 -08:00
|
|
|
foreach(const QString &fname, fnames)
|
|
|
|
{
|
|
|
|
if(fname.endsWith(".mhr", Qt::CaseInsensitive))
|
2016-02-23 07:29:07 -08:00
|
|
|
{
|
|
|
|
if(!ret.contains(fname))
|
2016-02-24 04:21:03 -08:00
|
|
|
ret.push_back(fname.left(fname.length()-4));
|
2016-02-23 07:29:07 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t i = 1;
|
|
|
|
do {
|
2016-02-24 04:21:03 -08:00
|
|
|
QString s = fname.left(fname.length()-4)+" #"+QString::number(i);
|
2016-02-23 07:29:07 -08:00
|
|
|
if(!ret.contains(s))
|
|
|
|
{
|
|
|
|
ret.push_back(s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
} while(1);
|
|
|
|
}
|
|
|
|
}
|
2016-02-23 06:52:13 -08:00
|
|
|
}
|
|
|
|
}
|
2016-02-23 11:03:58 -08:00
|
|
|
|
|
|
|
if(ui->defaultHrtfPathsCheckBox->isChecked())
|
|
|
|
{
|
|
|
|
QStringList paths = getAllDataPaths("/openal/hrtf");
|
|
|
|
foreach(const QString &name, paths)
|
|
|
|
{
|
|
|
|
QDir dir(name);
|
2016-02-24 05:08:39 -08:00
|
|
|
QStringList fnames = dir.entryList(QDir::Files | QDir::Readable, QDir::Name);
|
2016-02-23 11:03:58 -08:00
|
|
|
foreach(const QString &fname, fnames)
|
|
|
|
{
|
|
|
|
if(fname.endsWith(".mhr", Qt::CaseInsensitive))
|
|
|
|
{
|
|
|
|
if(!ret.contains(fname))
|
2016-02-24 04:21:03 -08:00
|
|
|
ret.push_back(fname.left(fname.length()-4));
|
2016-02-23 11:03:58 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t i = 1;
|
|
|
|
do {
|
2016-02-24 04:21:03 -08:00
|
|
|
QString s = fname.left(fname.length()-4)+" #"+QString::number(i);
|
2016-02-23 11:03:58 -08:00
|
|
|
if(!ret.contains(s))
|
|
|
|
{
|
|
|
|
ret.push_back(s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
} while(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-02-23 06:52:13 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
void MainWindow::loadConfigFromFile()
|
|
|
|
{
|
|
|
|
QString fname = QFileDialog::getOpenFileName(this, tr("Select Files"));
|
|
|
|
if(fname.isEmpty() == false)
|
|
|
|
loadConfig(fname);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::loadConfig(const QString &fname)
|
|
|
|
{
|
|
|
|
QSettings settings(fname, QSettings::IniFormat);
|
|
|
|
|
|
|
|
QString sampletype = settings.value("sample-type").toString();
|
|
|
|
ui->sampleFormatCombo->setCurrentIndex(0);
|
|
|
|
if(sampletype.isEmpty() == false)
|
|
|
|
{
|
2014-09-13 23:12:40 -07:00
|
|
|
for(int i = 0;sampleTypeList[i].name[i];i++)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2014-09-13 23:12:40 -07:00
|
|
|
if(sampletype == sampleTypeList[i].value)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-23 06:52:13 -08:00
|
|
|
int j = ui->sampleFormatCombo->findText(sampleTypeList[i].name);
|
|
|
|
if(j > 0) ui->sampleFormatCombo->setCurrentIndex(j);
|
2013-06-23 22:47:51 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString channelconfig = settings.value("channels").toString();
|
|
|
|
ui->channelConfigCombo->setCurrentIndex(0);
|
|
|
|
if(channelconfig.isEmpty() == false)
|
|
|
|
{
|
2014-09-13 23:12:40 -07:00
|
|
|
for(int i = 0;speakerModeList[i].name[i];i++)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2014-09-13 23:12:40 -07:00
|
|
|
if(channelconfig == speakerModeList[i].value)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-23 06:52:13 -08:00
|
|
|
int j = ui->channelConfigCombo->findText(speakerModeList[i].name);
|
|
|
|
if(j > 0) ui->channelConfigCombo->setCurrentIndex(j);
|
2013-06-23 22:47:51 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString srate = settings.value("frequency").toString();
|
|
|
|
if(srate.isEmpty())
|
|
|
|
ui->sampleRateCombo->setCurrentIndex(0);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->sampleRateCombo->lineEdit()->clear();
|
|
|
|
ui->sampleRateCombo->lineEdit()->insert(srate);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->srcCountLineEdit->clear();
|
|
|
|
ui->srcCountLineEdit->insert(settings.value("sources").toString());
|
|
|
|
ui->effectSlotLineEdit->clear();
|
|
|
|
ui->effectSlotLineEdit->insert(settings.value("slots").toString());
|
|
|
|
ui->srcSendLineEdit->clear();
|
|
|
|
ui->srcSendLineEdit->insert(settings.value("sends").toString());
|
|
|
|
|
|
|
|
QString resampler = settings.value("resampler").toString().trimmed();
|
2016-02-22 03:05:13 -08:00
|
|
|
ui->resamplerSlider->setValue(0);
|
|
|
|
/* The "cubic" resampler is no longer supported. It's been replaced by
|
|
|
|
* "sinc4". */
|
|
|
|
if(resampler == "cubic")
|
|
|
|
resampler = "sinc4";
|
|
|
|
for(int i = 0;resamplerList[i].name[i];i++)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-22 03:05:13 -08:00
|
|
|
if(resampler == resamplerList[i].value)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-22 03:05:13 -08:00
|
|
|
ui->resamplerSlider->setValue(i);
|
|
|
|
break;
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-28 22:09:07 -07:00
|
|
|
QString stereomode = settings.value("stereo-mode").toString().trimmed();
|
|
|
|
ui->stereoModeCombo->setCurrentIndex(0);
|
|
|
|
if(stereomode.isEmpty() == false)
|
|
|
|
{
|
|
|
|
for(int i = 0;stereoModeList[i].name[i];i++)
|
|
|
|
{
|
|
|
|
if(stereomode == stereoModeList[i].value)
|
|
|
|
{
|
2016-02-23 06:52:13 -08:00
|
|
|
int j = ui->stereoModeCombo->findText(stereoModeList[i].name);
|
|
|
|
if(j > 0) ui->stereoModeCombo->setCurrentIndex(j);
|
2015-08-28 22:09:07 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
int periodsize = settings.value("period_size").toInt();
|
|
|
|
ui->periodSizeEdit->clear();
|
|
|
|
if(periodsize >= 64)
|
2013-06-27 23:31:51 -07:00
|
|
|
{
|
2013-06-23 22:47:51 -07:00
|
|
|
ui->periodSizeEdit->insert(QString::number(periodsize));
|
2013-06-27 23:31:51 -07:00
|
|
|
updatePeriodSizeSlider();
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
int periodcount = settings.value("periods").toInt();
|
|
|
|
ui->periodCountEdit->clear();
|
|
|
|
if(periodcount >= 2)
|
2013-06-27 23:31:51 -07:00
|
|
|
{
|
2013-06-23 22:47:51 -07:00
|
|
|
ui->periodCountEdit->insert(QString::number(periodcount));
|
2013-06-27 23:31:51 -07:00
|
|
|
updatePeriodCountSlider();
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
QStringList disabledCpuExts = settings.value("disable-cpu-exts").toStringList();
|
|
|
|
if(disabledCpuExts.size() == 1)
|
|
|
|
disabledCpuExts = disabledCpuExts[0].split(QChar(','));
|
|
|
|
std::transform(disabledCpuExts.begin(), disabledCpuExts.end(),
|
|
|
|
disabledCpuExts.begin(), std::mem_fun_ref(&QString::trimmed));
|
2014-08-07 05:16:05 -07:00
|
|
|
ui->enableSSECheckBox->setChecked(!disabledCpuExts.contains("sse", Qt::CaseInsensitive));
|
|
|
|
ui->enableSSE2CheckBox->setChecked(!disabledCpuExts.contains("sse2", Qt::CaseInsensitive));
|
2015-10-11 06:38:00 -07:00
|
|
|
ui->enableSSE3CheckBox->setChecked(!disabledCpuExts.contains("sse3", Qt::CaseInsensitive));
|
2014-08-07 05:16:05 -07:00
|
|
|
ui->enableSSE41CheckBox->setChecked(!disabledCpuExts.contains("sse4.1", Qt::CaseInsensitive));
|
|
|
|
ui->enableNeonCheckBox->setChecked(!disabledCpuExts.contains("neon", Qt::CaseInsensitive));
|
2013-06-23 22:47:51 -07:00
|
|
|
|
2016-02-23 10:54:42 -08:00
|
|
|
QStringList hrtf_paths = settings.value("hrtf-paths").toStringList();
|
|
|
|
if(hrtf_paths.size() == 1)
|
|
|
|
hrtf_paths = hrtf_paths[0].split(QChar(','));
|
|
|
|
std::transform(hrtf_paths.begin(), hrtf_paths.end(),
|
|
|
|
hrtf_paths.begin(), std::mem_fun_ref(&QString::trimmed));
|
|
|
|
if(!hrtf_paths.empty() && !hrtf_paths.back().isEmpty())
|
2016-02-22 03:05:13 -08:00
|
|
|
ui->defaultHrtfPathsCheckBox->setCheckState(Qt::Unchecked);
|
|
|
|
else
|
|
|
|
{
|
2016-02-23 10:54:42 -08:00
|
|
|
hrtf_paths.removeAll(QString());
|
2016-02-22 03:05:13 -08:00
|
|
|
ui->defaultHrtfPathsCheckBox->setCheckState(Qt::Checked);
|
|
|
|
}
|
2016-02-23 10:54:42 -08:00
|
|
|
hrtf_paths.removeDuplicates();
|
2013-06-23 22:47:51 -07:00
|
|
|
ui->hrtfFileList->clear();
|
2016-02-23 10:54:42 -08:00
|
|
|
ui->hrtfFileList->addItems(hrtf_paths);
|
2013-06-28 00:08:57 -07:00
|
|
|
updateHrtfRemoveButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
|
2016-02-23 06:52:13 -08:00
|
|
|
QString hrtfstate = settings.value("hrtf").toString().toLower();
|
|
|
|
if(hrtfstate == "true")
|
|
|
|
ui->hrtfStateComboBox->setCurrentIndex(1);
|
|
|
|
else if(hrtfstate == "false")
|
|
|
|
ui->hrtfStateComboBox->setCurrentIndex(2);
|
|
|
|
else
|
|
|
|
ui->hrtfStateComboBox->setCurrentIndex(0);
|
|
|
|
|
|
|
|
ui->preferredHrtfComboBox->clear();
|
|
|
|
ui->preferredHrtfComboBox->addItem("- Any -");
|
|
|
|
if(ui->defaultHrtfPathsCheckBox->isChecked())
|
|
|
|
{
|
2016-02-23 11:03:58 -08:00
|
|
|
QStringList hrtfs = collectHrtfs();
|
2016-02-23 06:52:13 -08:00
|
|
|
foreach(const QString &name, hrtfs)
|
|
|
|
ui->preferredHrtfComboBox->addItem(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString defaulthrtf = settings.value("default-hrtf").toString();
|
|
|
|
ui->preferredHrtfComboBox->setCurrentIndex(0);
|
|
|
|
if(defaulthrtf.isEmpty() == false)
|
|
|
|
{
|
|
|
|
int i = ui->preferredHrtfComboBox->findText(defaulthrtf);
|
|
|
|
if(i > 0)
|
|
|
|
ui->preferredHrtfComboBox->setCurrentIndex(i);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
i = ui->preferredHrtfComboBox->count();
|
|
|
|
ui->preferredHrtfComboBox->addItem(defaulthrtf);
|
|
|
|
ui->preferredHrtfComboBox->setCurrentIndex(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ui->preferredHrtfComboBox->adjustSize();
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
ui->enabledBackendList->clear();
|
|
|
|
ui->disabledBackendList->clear();
|
|
|
|
QStringList drivers = settings.value("drivers").toStringList();
|
|
|
|
if(drivers.size() == 0)
|
|
|
|
ui->backendCheckBox->setChecked(true);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(drivers.size() == 1)
|
|
|
|
drivers = drivers[0].split(QChar(','));
|
|
|
|
std::transform(drivers.begin(), drivers.end(),
|
|
|
|
drivers.begin(), std::mem_fun_ref(&QString::trimmed));
|
|
|
|
|
|
|
|
bool lastWasEmpty = false;
|
|
|
|
foreach(const QString &backend, drivers)
|
|
|
|
{
|
|
|
|
lastWasEmpty = backend.isEmpty();
|
2016-02-27 21:52:36 -08:00
|
|
|
if(lastWasEmpty) continue;
|
|
|
|
|
|
|
|
if(!backend.startsWith(QChar('-')))
|
|
|
|
for(int j = 0;backendList[j].backend_name[0];j++)
|
|
|
|
{
|
|
|
|
if(backend == backendList[j].backend_name)
|
|
|
|
{
|
|
|
|
ui->enabledBackendList->addItem(backendList[j].full_string);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
else if(backend.size() > 1)
|
2016-02-27 21:52:36 -08:00
|
|
|
{
|
|
|
|
QStringRef backendref = backend.rightRef(backend.size()-1);
|
|
|
|
for(int j = 0;backendList[j].backend_name[0];j++)
|
|
|
|
{
|
|
|
|
if(backendref == backendList[j].backend_name)
|
|
|
|
{
|
|
|
|
ui->disabledBackendList->addItem(backendList[j].full_string);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
ui->backendCheckBox->setChecked(lastWasEmpty);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString defaultreverb = settings.value("default-reverb").toString().toLower();
|
|
|
|
ui->defaultReverbComboBox->setCurrentIndex(0);
|
|
|
|
if(defaultreverb.isEmpty() == false)
|
|
|
|
{
|
|
|
|
for(int i = 0;i < ui->defaultReverbComboBox->count();i++)
|
|
|
|
{
|
|
|
|
if(defaultreverb.compare(ui->defaultReverbComboBox->itemText(i).toLower()) == 0)
|
|
|
|
{
|
|
|
|
ui->defaultReverbComboBox->setCurrentIndex(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->emulateEaxCheckBox->setChecked(settings.value("reverb/emulate-eax", false).toBool());
|
|
|
|
|
|
|
|
QStringList excludefx = settings.value("excludefx").toStringList();
|
|
|
|
if(excludefx.size() == 1)
|
|
|
|
excludefx = excludefx[0].split(QChar(','));
|
|
|
|
std::transform(excludefx.begin(), excludefx.end(),
|
|
|
|
excludefx.begin(), std::mem_fun_ref(&QString::trimmed));
|
2014-08-07 05:16:05 -07:00
|
|
|
ui->enableEaxReverbCheck->setChecked(!excludefx.contains("eaxreverb", Qt::CaseInsensitive));
|
|
|
|
ui->enableStdReverbCheck->setChecked(!excludefx.contains("reverb", Qt::CaseInsensitive));
|
|
|
|
ui->enableChorusCheck->setChecked(!excludefx.contains("chorus", Qt::CaseInsensitive));
|
|
|
|
ui->enableCompressorCheck->setChecked(!excludefx.contains("compressor", Qt::CaseInsensitive));
|
|
|
|
ui->enableDistortionCheck->setChecked(!excludefx.contains("distortion", Qt::CaseInsensitive));
|
|
|
|
ui->enableEchoCheck->setChecked(!excludefx.contains("echo", Qt::CaseInsensitive));
|
|
|
|
ui->enableEqualizerCheck->setChecked(!excludefx.contains("equalizer", Qt::CaseInsensitive));
|
|
|
|
ui->enableFlangerCheck->setChecked(!excludefx.contains("flanger", Qt::CaseInsensitive));
|
|
|
|
ui->enableModulatorCheck->setChecked(!excludefx.contains("modulator", Qt::CaseInsensitive));
|
|
|
|
ui->enableDedicatedCheck->setChecked(!excludefx.contains("dedicated", Qt::CaseInsensitive));
|
2016-02-22 07:56:05 -08:00
|
|
|
|
2016-02-27 19:18:57 -08:00
|
|
|
ui->pulseAutospawnCheckBox->setChecked(settings.value("pulse/spawn-server", true).toBool());
|
|
|
|
ui->pulseAllowMovesCheckBox->setChecked(settings.value("pulse/allow-moves", false).toBool());
|
|
|
|
ui->pulseFixRateCheckBox->setChecked(settings.value("pulse/fix-rate", false).toBool());
|
|
|
|
|
2016-02-22 07:56:05 -08:00
|
|
|
ui->applyButton->setEnabled(false);
|
|
|
|
ui->closeCancelButton->setText(tr("Close"));
|
|
|
|
mNeedsSave = false;
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::saveCurrentConfig()
|
|
|
|
{
|
|
|
|
saveConfig(getDefaultConfigName());
|
2016-02-22 07:56:05 -08:00
|
|
|
ui->applyButton->setEnabled(false);
|
|
|
|
ui->closeCancelButton->setText(tr("Close"));
|
|
|
|
mNeedsSave = false;
|
2013-06-23 22:47:51 -07:00
|
|
|
QMessageBox::information(this, tr("Information"),
|
|
|
|
tr("Applications using OpenAL need to be restarted for changes to take effect."));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::saveConfigAsFile()
|
|
|
|
{
|
|
|
|
QString fname = QFileDialog::getOpenFileName(this, tr("Select Files"));
|
|
|
|
if(fname.isEmpty() == false)
|
2016-02-22 07:56:05 -08:00
|
|
|
{
|
2013-06-23 22:47:51 -07:00
|
|
|
saveConfig(fname);
|
2016-02-22 07:56:05 -08:00
|
|
|
ui->applyButton->setEnabled(false);
|
|
|
|
mNeedsSave = false;
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::saveConfig(const QString &fname) const
|
|
|
|
{
|
|
|
|
QSettings settings(fname, QSettings::IniFormat);
|
|
|
|
|
|
|
|
/* HACK: Compound any stringlist values into a comma-separated string. */
|
|
|
|
QStringList allkeys = settings.allKeys();
|
|
|
|
foreach(const QString &key, allkeys)
|
|
|
|
{
|
|
|
|
QStringList vals = settings.value(key).toStringList();
|
|
|
|
if(vals.size() > 1)
|
|
|
|
settings.setValue(key, vals.join(QChar(',')));
|
|
|
|
}
|
|
|
|
|
|
|
|
QString str = ui->sampleFormatCombo->currentText();
|
2014-09-13 23:12:40 -07:00
|
|
|
for(int i = 0;sampleTypeList[i].name[0];i++)
|
|
|
|
{
|
|
|
|
if(str == sampleTypeList[i].name)
|
|
|
|
{
|
|
|
|
settings.setValue("sample-type", sampleTypeList[i].value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
str = ui->channelConfigCombo->currentText();
|
2014-09-13 23:12:40 -07:00
|
|
|
for(int i = 0;speakerModeList[i].name[0];i++)
|
|
|
|
{
|
|
|
|
if(str == speakerModeList[i].name)
|
|
|
|
{
|
|
|
|
settings.setValue("channels", speakerModeList[i].value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
uint rate = ui->sampleRateCombo->currentText().toUInt();
|
2014-09-13 23:12:40 -07:00
|
|
|
if(!(rate > 0))
|
2013-06-23 22:47:51 -07:00
|
|
|
settings.setValue("frequency", QString());
|
|
|
|
else
|
|
|
|
settings.setValue("frequency", rate);
|
|
|
|
|
|
|
|
settings.setValue("period_size", ui->periodSizeEdit->text());
|
|
|
|
settings.setValue("periods", ui->periodCountEdit->text());
|
|
|
|
|
|
|
|
settings.setValue("sources", ui->srcCountLineEdit->text());
|
|
|
|
settings.setValue("slots", ui->effectSlotLineEdit->text());
|
|
|
|
|
2016-02-22 03:05:13 -08:00
|
|
|
settings.setValue("resampler", resamplerList[ui->resamplerSlider->value()].value);
|
2013-06-23 22:47:51 -07:00
|
|
|
|
2015-08-28 22:09:07 -07:00
|
|
|
str = ui->stereoModeCombo->currentText();
|
|
|
|
for(int i = 0;stereoModeList[i].name[0];i++)
|
|
|
|
{
|
|
|
|
if(str == stereoModeList[i].name)
|
|
|
|
{
|
|
|
|
settings.setValue("stereo-mode", stereoModeList[i].value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
QStringList strlist;
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableSSECheckBox->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("sse");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableSSE2CheckBox->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("sse2");
|
2015-10-11 06:38:00 -07:00
|
|
|
if(!ui->enableSSE3CheckBox->isChecked())
|
|
|
|
strlist.append("sse3");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableSSE41CheckBox->isChecked())
|
2014-08-05 02:43:04 -07:00
|
|
|
strlist.append("sse4.1");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableNeonCheckBox->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("neon");
|
|
|
|
settings.setValue("disable-cpu-exts", strlist.join(QChar(',')));
|
|
|
|
|
2015-10-12 05:52:34 -07:00
|
|
|
if(ui->hrtfStateComboBox->currentIndex() == 1)
|
2013-06-23 22:47:51 -07:00
|
|
|
settings.setValue("hrtf", "true");
|
2015-10-12 05:52:34 -07:00
|
|
|
else if(ui->hrtfStateComboBox->currentIndex() == 2)
|
2013-06-23 22:47:51 -07:00
|
|
|
settings.setValue("hrtf", "false");
|
|
|
|
else
|
|
|
|
settings.setValue("hrtf", QString());
|
|
|
|
|
2016-02-23 06:52:13 -08:00
|
|
|
if(ui->preferredHrtfComboBox->currentIndex() == 0)
|
|
|
|
settings.setValue("default-hrtf", QString());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = ui->preferredHrtfComboBox->currentText();
|
|
|
|
settings.setValue("default-hrtf", str);
|
|
|
|
}
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.clear();
|
2016-02-23 10:54:42 -08:00
|
|
|
for(int i = 0;i < ui->hrtfFileList->count();i++)
|
|
|
|
strlist.append(ui->hrtfFileList->item(i)->text());
|
2016-02-22 03:05:13 -08:00
|
|
|
if(!strlist.empty() && ui->defaultHrtfPathsCheckBox->isChecked())
|
2016-02-23 10:54:42 -08:00
|
|
|
strlist.append(QString());
|
|
|
|
settings.setValue("hrtf-paths", strlist.join(QChar(',')));
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
strlist.clear();
|
2016-02-23 10:54:42 -08:00
|
|
|
for(int i = 0;i < ui->enabledBackendList->count();i++)
|
2016-02-27 21:52:36 -08:00
|
|
|
{
|
|
|
|
QString label = ui->enabledBackendList->item(i)->text();
|
|
|
|
for(int j = 0;backendList[j].backend_name[0];j++)
|
|
|
|
{
|
|
|
|
if(label == backendList[j].full_string)
|
|
|
|
{
|
|
|
|
strlist.append(backendList[j].backend_name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-02-23 10:54:42 -08:00
|
|
|
for(int i = 0;i < ui->disabledBackendList->count();i++)
|
2016-02-27 21:52:36 -08:00
|
|
|
{
|
|
|
|
QString label = ui->disabledBackendList->item(i)->text();
|
|
|
|
for(int j = 0;backendList[j].backend_name[0];j++)
|
|
|
|
{
|
|
|
|
if(label == backendList[j].full_string)
|
|
|
|
{
|
|
|
|
strlist.append(QChar('-')+QString(backendList[j].backend_name));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
if(strlist.size() == 0 && !ui->backendCheckBox->isChecked())
|
|
|
|
strlist.append("-all");
|
|
|
|
else if(ui->backendCheckBox->isChecked())
|
|
|
|
strlist.append(QString());
|
|
|
|
settings.setValue("drivers", strlist.join(QChar(',')));
|
|
|
|
|
|
|
|
// TODO: Remove check when we can properly match global values.
|
|
|
|
if(ui->defaultReverbComboBox->currentIndex() == 0)
|
|
|
|
settings.setValue("default-reverb", QString());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = ui->defaultReverbComboBox->currentText().toLower();
|
|
|
|
settings.setValue("default-reverb", str);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ui->emulateEaxCheckBox->isChecked())
|
|
|
|
settings.setValue("reverb/emulate-eax", "true");
|
|
|
|
else
|
2016-02-27 19:18:57 -08:00
|
|
|
settings.remove("reverb/emulate-eax"/*, "false"*/);
|
2013-06-23 22:47:51 -07:00
|
|
|
|
|
|
|
strlist.clear();
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableEaxReverbCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("eaxreverb");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableStdReverbCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("reverb");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableChorusCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("chorus");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableDistortionCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("distortion");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableCompressorCheck->isChecked())
|
2014-08-05 02:43:04 -07:00
|
|
|
strlist.append("compressor");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableEchoCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("echo");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableEqualizerCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("equalizer");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableFlangerCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("flanger");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableModulatorCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("modulator");
|
2014-08-07 05:16:05 -07:00
|
|
|
if(!ui->enableDedicatedCheck->isChecked())
|
2013-06-23 22:47:51 -07:00
|
|
|
strlist.append("dedicated");
|
|
|
|
settings.setValue("excludefx", strlist.join(QChar(',')));
|
|
|
|
|
|
|
|
/* Remove empty keys
|
|
|
|
* FIXME: Should only remove keys whose value matches the globally-specified value.
|
|
|
|
*/
|
|
|
|
allkeys = settings.allKeys();
|
|
|
|
foreach(const QString &key, allkeys)
|
|
|
|
{
|
|
|
|
str = settings.value(key).toString();
|
|
|
|
if(str == QString())
|
|
|
|
settings.remove(key);
|
|
|
|
}
|
2016-02-27 19:18:57 -08:00
|
|
|
|
|
|
|
if(ui->pulseAutospawnCheckBox->isChecked())
|
|
|
|
settings.remove("pulse/spawn-server"/*, "true"*/);
|
|
|
|
else
|
|
|
|
settings.setValue("pulse/spawn-server", "false");
|
|
|
|
if(ui->pulseAllowMovesCheckBox->isChecked())
|
|
|
|
settings.setValue("pulse/allow-moves", "true");
|
|
|
|
else
|
|
|
|
settings.remove("pulse/allow-moves"/*, "false"*/);
|
|
|
|
if(ui->pulseFixRateCheckBox->isChecked())
|
|
|
|
settings.setValue("pulse/fix-rate", "true");
|
|
|
|
else
|
|
|
|
settings.remove("pulse/fix-rate"/*, "false"*/);
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-22 07:56:05 -08:00
|
|
|
void MainWindow::enableApplyButton()
|
|
|
|
{
|
|
|
|
if(!mNeedsSave)
|
|
|
|
ui->applyButton->setEnabled(true);
|
|
|
|
mNeedsSave = true;
|
|
|
|
ui->closeCancelButton->setText(tr("Cancel"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-22 03:05:13 -08:00
|
|
|
void MainWindow::updateResamplerLabel(int num)
|
|
|
|
{
|
|
|
|
ui->resamplerLabel->setText(resamplerList[num].name);
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2016-02-22 03:05:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
void MainWindow::updatePeriodSizeEdit(int size)
|
|
|
|
{
|
|
|
|
ui->periodSizeEdit->clear();
|
|
|
|
if(size >= 64)
|
|
|
|
{
|
|
|
|
size = (size+32)&~0x3f;
|
|
|
|
ui->periodSizeEdit->insert(QString::number(size));
|
|
|
|
}
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::updatePeriodSizeSlider()
|
|
|
|
{
|
|
|
|
int pos = ui->periodSizeEdit->text().toInt();
|
|
|
|
if(pos >= 64)
|
|
|
|
{
|
|
|
|
if(pos > 8192)
|
|
|
|
pos = 8192;
|
|
|
|
ui->periodSizeSlider->setSliderPosition(pos);
|
|
|
|
}
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::updatePeriodCountEdit(int count)
|
|
|
|
{
|
|
|
|
ui->periodCountEdit->clear();
|
|
|
|
if(count >= 2)
|
|
|
|
ui->periodCountEdit->insert(QString::number(count));
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::updatePeriodCountSlider()
|
|
|
|
{
|
|
|
|
int pos = ui->periodCountEdit->text().toInt();
|
|
|
|
if(pos < 2)
|
|
|
|
pos = 0;
|
|
|
|
else if(pos > 16)
|
|
|
|
pos = 16;
|
|
|
|
ui->periodCountSlider->setSliderPosition(pos);
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::addHrtfFile()
|
|
|
|
{
|
2016-02-23 10:54:42 -08:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Select HRTF Path"));
|
|
|
|
if(path.isEmpty() == false && !getAllDataPaths("/openal/hrtf").contains(path))
|
2014-08-05 04:56:51 -07:00
|
|
|
{
|
2016-02-23 10:54:42 -08:00
|
|
|
ui->hrtfFileList->addItem(path);
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2014-08-05 04:56:51 -07:00
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::removeHrtfFile()
|
|
|
|
{
|
|
|
|
QList<QListWidgetItem*> selected = ui->hrtfFileList->selectedItems();
|
2016-02-22 07:56:05 -08:00
|
|
|
if(!selected.isEmpty())
|
|
|
|
{
|
|
|
|
foreach(QListWidgetItem *item, selected)
|
|
|
|
delete item;
|
|
|
|
enableApplyButton();
|
|
|
|
}
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
|
2013-06-28 00:08:57 -07:00
|
|
|
void MainWindow::updateHrtfRemoveButton()
|
|
|
|
{
|
|
|
|
ui->hrtfRemoveButton->setEnabled(ui->hrtfFileList->selectedItems().size() != 0);
|
|
|
|
}
|
|
|
|
|
2013-06-23 22:47:51 -07:00
|
|
|
void MainWindow::showEnabledBackendMenu(QPoint pt)
|
|
|
|
{
|
|
|
|
QMap<QAction*,QString> actionMap;
|
|
|
|
|
|
|
|
pt = ui->enabledBackendList->mapToGlobal(pt);
|
|
|
|
|
|
|
|
QMenu ctxmenu;
|
|
|
|
QAction *removeAction = ctxmenu.addAction(QIcon::fromTheme("list-remove"), "Remove");
|
|
|
|
if(ui->enabledBackendList->selectedItems().size() == 0)
|
|
|
|
removeAction->setEnabled(false);
|
|
|
|
ctxmenu.addSeparator();
|
2016-02-27 19:37:42 -08:00
|
|
|
for(size_t i = 0;backendList[i].backend_name[0];i++)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-27 21:52:36 -08:00
|
|
|
QString backend = backendList[i].full_string;
|
|
|
|
QAction *action = ctxmenu.addAction(QString("Add ")+backend);
|
|
|
|
actionMap[action] = backend;
|
|
|
|
if(ui->enabledBackendList->findItems(backend, Qt::MatchFixedString).size() != 0 ||
|
|
|
|
ui->disabledBackendList->findItems(backend, Qt::MatchFixedString).size() != 0)
|
2013-06-23 22:47:51 -07:00
|
|
|
action->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
QAction *gotAction = ctxmenu.exec(pt);
|
|
|
|
if(gotAction == removeAction)
|
|
|
|
{
|
|
|
|
QList<QListWidgetItem*> selected = ui->enabledBackendList->selectedItems();
|
|
|
|
foreach(QListWidgetItem *item, selected)
|
|
|
|
delete item;
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
else if(gotAction != NULL)
|
|
|
|
{
|
|
|
|
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
|
|
|
if(iter != actionMap.end())
|
|
|
|
ui->enabledBackendList->addItem(iter.value());
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::showDisabledBackendMenu(QPoint pt)
|
|
|
|
{
|
|
|
|
QMap<QAction*,QString> actionMap;
|
|
|
|
|
|
|
|
pt = ui->disabledBackendList->mapToGlobal(pt);
|
|
|
|
|
|
|
|
QMenu ctxmenu;
|
|
|
|
QAction *removeAction = ctxmenu.addAction(QIcon::fromTheme("list-remove"), "Remove");
|
|
|
|
if(ui->disabledBackendList->selectedItems().size() == 0)
|
|
|
|
removeAction->setEnabled(false);
|
|
|
|
ctxmenu.addSeparator();
|
2016-02-27 19:37:42 -08:00
|
|
|
for(size_t i = 0;backendList[i].backend_name[0];i++)
|
2013-06-23 22:47:51 -07:00
|
|
|
{
|
2016-02-27 21:52:36 -08:00
|
|
|
QString backend = backendList[i].full_string;
|
|
|
|
QAction *action = ctxmenu.addAction(QString("Add ")+backend);
|
|
|
|
actionMap[action] = backend;
|
|
|
|
if(ui->disabledBackendList->findItems(backend, Qt::MatchFixedString).size() != 0 ||
|
|
|
|
ui->enabledBackendList->findItems(backend, Qt::MatchFixedString).size() != 0)
|
2013-06-23 22:47:51 -07:00
|
|
|
action->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
QAction *gotAction = ctxmenu.exec(pt);
|
|
|
|
if(gotAction == removeAction)
|
|
|
|
{
|
|
|
|
QList<QListWidgetItem*> selected = ui->disabledBackendList->selectedItems();
|
|
|
|
foreach(QListWidgetItem *item, selected)
|
|
|
|
delete item;
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
else if(gotAction != NULL)
|
|
|
|
{
|
|
|
|
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
|
|
|
if(iter != actionMap.end())
|
|
|
|
ui->disabledBackendList->addItem(iter.value());
|
2016-02-22 07:56:05 -08:00
|
|
|
enableApplyButton();
|
2013-06-23 22:47:51 -07:00
|
|
|
}
|
|
|
|
}
|