Added missing changes to the OpenAL-Soft update.

This commit is contained in:
Alex Szpakowski
2015-12-01 13:40:34 -04:00
parent f8dae3ea09
commit e9d77ef766
94 changed files with 9219 additions and 6099 deletions
@@ -1,3 +1,6 @@
#include "config.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
@@ -10,26 +13,92 @@ static const struct {
char backend_name[16];
char menu_string[32];
} backendMenuList[] = {
#ifdef Q_OS_WIN32
{ "mmdevapi", "Add MMDevAPI" },
{ "dsound", "Add DirectSound" },
{ "winmm", "Add Windows Multimedia" },
#ifdef HAVE_JACK
{ "jack", "Add JACK" },
#endif
#ifdef Q_OS_MAC
#ifdef HAVE_PULSEAUDIO
{ "pulse", "Add PulseAudio" },
#endif
#ifdef HAVE_ALSA
{ "alsa", "Add ALSA" },
#endif
#ifdef HAVE_COREAUDIO
{ "core", "Add CoreAudio" },
#endif
{ "pulse", "Add PulseAudio" },
#ifdef Q_OS_UNIX
{ "alsa", "Add ALSA" },
#ifdef HAVE_OSS
{ "oss", "Add OSS" },
#endif
#ifdef HAVE_SOLARIS
{ "solaris", "Add Solaris" },
#endif
#ifdef HAVE_SNDIO
{ "sndio", "Add SndIO" },
#endif
#ifdef HAVE_QSA
{ "qsa", "Add QSA" },
#endif
#ifdef HAVE_MMDEVAPI
{ "mmdevapi", "Add MMDevAPI" },
#endif
#ifdef HAVE_DSOUND
{ "dsound", "Add DirectSound" },
#endif
#ifdef HAVE_WINMM
{ "winmm", "Add Windows Multimedia" },
#endif
#ifdef HAVE_PORTAUDIO
{ "port", "Add PortAudio" },
#endif
#ifdef HAVE_OPENSL
{ "opensl", "Add OpenSL" },
#endif
{ "null", "Add Null Output" },
#ifdef HAVE_WAVE
{ "wave", "Add Wave Writer" },
#endif
{ "", "" }
};
static const struct {
const char name[64];
const char value[16];
} speakerModeList[] = {
{ "Autodetect", "" },
{ "Mono", "mono" },
{ "Stereo", "stereo" },
{ "Quadrophonic", "quad" },
{ "5.1 Surround (Side)", "surround51" },
{ "5.1 Surround (Rear)", "surround51rear" },
{ "6.1 Surround", "surround61" },
{ "7.1 Surround", "surround71" },
{ "", "" }
}, 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" },
{ "", "" }
}, resamplerList[] = {
{ "Default", "" },
{ "Point (low quality, very fast)", "point" },
{ "Linear (basic quality, fast)", "linear" },
{ "4-Point Sinc (good quality)", "sinc4" },
{ "8-Point Sinc (high quality, slow)", "sinc8" },
{ "Band-limited Sinc (very high quality, very slow)", "bsinc" },
{ "", "" }
}, stereoModeList[] = {
{ "Autodetect", "" },
{ "Speakers", "speakers" },
{ "Headphones", "headphones" },
{ "", "" }
};
@@ -104,11 +173,65 @@ MainWindow::MainWindow(QWidget *parent) :
mSourceCountValidator(NULL),
mEffectSlotValidator(NULL),
mSourceSendValidator(NULL),
mSampleRateValidator(NULL),
mReverbBoostValidator(NULL)
mSampleRateValidator(NULL)
{
ui->setupUi(this);
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();
for(int i = 0;resamplerList[i].name[0];i++)
ui->resamplerComboBox->addItem(resamplerList[i].name);
ui->resamplerComboBox->adjustSize();
for(int i = 0;stereoModeList[i].name[0];i++)
ui->stereoModeCombo->addItem(stereoModeList[i].name);
ui->stereoModeCombo->adjustSize();
ui->hrtfStateComboBox->adjustSize();
#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
mPeriodSizeValidator = new QIntValidator(64, 8192, this);
ui->periodSizeEdit->setValidator(mPeriodSizeValidator);
mPeriodCountValidator = new QIntValidator(2, 16, this);
@@ -123,9 +246,6 @@ MainWindow::MainWindow(QWidget *parent) :
mSampleRateValidator = new QIntValidator(8000, 192000, this);
ui->sampleRateCombo->lineEdit()->setValidator(mSampleRateValidator);
mReverbBoostValidator = new QDoubleValidator(-12.0, +12.0, 1, this);
ui->reverbBoostEdit->setValidator(mReverbBoostValidator);
connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadConfigFromFile()));
connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveConfigAsFile()));
@@ -146,9 +266,6 @@ MainWindow::MainWindow(QWidget *parent) :
ui->disabledBackendList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->disabledBackendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDisabledBackendMenu(QPoint)));
connect(ui->reverbBoostSlider, SIGNAL(valueChanged(int)), this, SLOT(updateReverbBoostEdit(int)));
connect(ui->reverbBoostEdit, SIGNAL(textEdited(QString)), this, SLOT(updateReverbBoostSlider(QString)));
loadConfig(getDefaultConfigName());
}
@@ -161,7 +278,6 @@ MainWindow::~MainWindow()
delete mEffectSlotValidator;
delete mSourceSendValidator;
delete mSampleRateValidator;
delete mReverbBoostValidator;
}
void MainWindow::loadConfigFromFile()
@@ -179,12 +295,19 @@ void MainWindow::loadConfig(const QString &fname)
ui->sampleFormatCombo->setCurrentIndex(0);
if(sampletype.isEmpty() == false)
{
for(int i = 1;i < ui->sampleFormatCombo->count();i++)
for(int i = 0;sampleTypeList[i].name[i];i++)
{
QString item = ui->sampleFormatCombo->itemText(i);
if(item.startsWith(sampletype))
if(sampletype == sampleTypeList[i].value)
{
ui->sampleFormatCombo->setCurrentIndex(i);
for(int j = 1;j < ui->sampleFormatCombo->count();j++)
{
QString item = ui->sampleFormatCombo->itemText(j);
if(item == sampleTypeList[i].name)
{
ui->sampleFormatCombo->setCurrentIndex(j);
break;
}
}
break;
}
}
@@ -194,12 +317,19 @@ void MainWindow::loadConfig(const QString &fname)
ui->channelConfigCombo->setCurrentIndex(0);
if(channelconfig.isEmpty() == false)
{
for(int i = 1;i < ui->channelConfigCombo->count();i++)
for(int i = 0;speakerModeList[i].name[i];i++)
{
QString item = ui->channelConfigCombo->itemText(i);
if(item.startsWith(channelconfig))
if(channelconfig == speakerModeList[i].value)
{
ui->channelConfigCombo->setCurrentIndex(i);
for(int j = 1;j < ui->channelConfigCombo->count();j++)
{
QString item = ui->channelConfigCombo->itemText(j);
if(item == speakerModeList[i].name)
{
ui->channelConfigCombo->setCurrentIndex(j);
break;
}
}
break;
}
}
@@ -222,18 +352,49 @@ void MainWindow::loadConfig(const QString &fname)
ui->srcSendLineEdit->insert(settings.value("sends").toString());
QString resampler = settings.value("resampler").toString().trimmed();
if(resampler.isEmpty())
ui->resamplerComboBox->setCurrentIndex(0);
else
ui->resamplerComboBox->setCurrentIndex(0);
if(resampler.isEmpty() == false)
{
for(int i = 1;i < ui->resamplerComboBox->count();i++)
/* 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++)
{
QString item = ui->resamplerComboBox->itemText(i);
int end = item.indexOf(' ');
if(end < 0) end = item.size();
if(resampler.size() == end && resampler.compare(item.leftRef(end), Qt::CaseInsensitive) == 0)
if(resampler == resamplerList[i].value)
{
ui->resamplerComboBox->setCurrentIndex(i);
for(int j = 1;j < ui->resamplerComboBox->count();j++)
{
QString item = ui->resamplerComboBox->itemText(j);
if(item == resamplerList[i].name)
{
ui->resamplerComboBox->setCurrentIndex(j);
break;
}
}
break;
}
}
}
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)
{
for(int j = 1;j < ui->stereoModeCombo->count();j++)
{
QString item = ui->stereoModeCombo->itemText(j);
if(item == stereoModeList[i].name)
{
ui->stereoModeCombo->setCurrentIndex(j);
break;
}
}
break;
}
}
@@ -262,17 +423,18 @@ void MainWindow::loadConfig(const QString &fname)
disabledCpuExts.begin(), std::mem_fun_ref(&QString::trimmed));
ui->enableSSECheckBox->setChecked(!disabledCpuExts.contains("sse", Qt::CaseInsensitive));
ui->enableSSE2CheckBox->setChecked(!disabledCpuExts.contains("sse2", Qt::CaseInsensitive));
ui->enableSSE3CheckBox->setChecked(!disabledCpuExts.contains("sse3", Qt::CaseInsensitive));
ui->enableSSE41CheckBox->setChecked(!disabledCpuExts.contains("sse4.1", Qt::CaseInsensitive));
ui->enableNeonCheckBox->setChecked(!disabledCpuExts.contains("neon", Qt::CaseInsensitive));
if(settings.value("hrtf").toString() == QString())
ui->hrtfEnableButton->setChecked(true);
ui->hrtfStateComboBox->setCurrentIndex(0);
else
{
if(settings.value("hrtf", true).toBool())
ui->hrtfForceButton->setChecked(true);
ui->hrtfStateComboBox->setCurrentIndex(1);
else
ui->hrtfDisableButton->setChecked(true);
ui->hrtfStateComboBox->setCurrentIndex(2);
}
QStringList hrtf_tables = settings.value("hrtf_tables").toStringList();
@@ -323,8 +485,6 @@ void MainWindow::loadConfig(const QString &fname)
}
ui->emulateEaxCheckBox->setChecked(settings.value("reverb/emulate-eax", false).toBool());
ui->reverbBoostEdit->clear();
ui->reverbBoostEdit->insert(settings.value("reverb/boost").toString());
QStringList excludefx = settings.value("excludefx").toStringList();
if(excludefx.size() == 1)
@@ -371,15 +531,27 @@ void MainWindow::saveConfig(const QString &fname) const
}
QString str = ui->sampleFormatCombo->currentText();
str.truncate(str.indexOf('-'));
settings.setValue("sample-type", str.trimmed());
for(int i = 0;sampleTypeList[i].name[0];i++)
{
if(str == sampleTypeList[i].name)
{
settings.setValue("sample-type", sampleTypeList[i].value);
break;
}
}
str = ui->channelConfigCombo->currentText();
str.truncate(str.indexOf('-'));
settings.setValue("channels", str.trimmed());
for(int i = 0;speakerModeList[i].name[0];i++)
{
if(str == speakerModeList[i].name)
{
settings.setValue("channels", speakerModeList[i].value);
break;
}
}
uint rate = ui->sampleRateCombo->currentText().toUInt();
if(rate == 0)
if(!(rate > 0))
settings.setValue("frequency", QString());
else
settings.setValue("frequency", rate);
@@ -390,12 +562,24 @@ void MainWindow::saveConfig(const QString &fname) const
settings.setValue("sources", ui->srcCountLineEdit->text());
settings.setValue("slots", ui->effectSlotLineEdit->text());
if(ui->resamplerComboBox->currentIndex() == 0)
settings.setValue("resampler", QString());
else
str = ui->resamplerComboBox->currentText();
for(int i = 0;resamplerList[i].name[0];i++)
{
str = ui->resamplerComboBox->currentText();
settings.setValue("resampler", str.split(' ').first().toLower());
if(str == resamplerList[i].name)
{
settings.setValue("resampler", resamplerList[i].value);
break;
}
}
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;
}
}
QStringList strlist;
@@ -403,15 +587,17 @@ void MainWindow::saveConfig(const QString &fname) const
strlist.append("sse");
if(!ui->enableSSE2CheckBox->isChecked())
strlist.append("sse2");
if(!ui->enableSSE3CheckBox->isChecked())
strlist.append("sse3");
if(!ui->enableSSE41CheckBox->isChecked())
strlist.append("sse4.1");
if(!ui->enableNeonCheckBox->isChecked())
strlist.append("neon");
settings.setValue("disable-cpu-exts", strlist.join(QChar(',')));
if(ui->hrtfForceButton->isChecked())
if(ui->hrtfStateComboBox->currentIndex() == 1)
settings.setValue("hrtf", "true");
else if(ui->hrtfDisableButton->isChecked())
else if(ui->hrtfStateComboBox->currentIndex() == 2)
settings.setValue("hrtf", "false");
else
settings.setValue("hrtf", QString());
@@ -449,12 +635,6 @@ void MainWindow::saveConfig(const QString &fname) const
else
settings.setValue("reverb/emulate-eax", QString()/*"false"*/);
// TODO: Remove check when we can properly match global values.
if(ui->reverbBoostSlider->sliderPosition() == 0)
settings.setValue("reverb/boost", QString());
else
settings.setValue("reverb/boost", ui->reverbBoostEdit->text());
strlist.clear();
if(!ui->enableEaxReverbCheck->isChecked())
strlist.append("eaxreverb");
@@ -645,16 +825,3 @@ void MainWindow::showDisabledBackendMenu(QPoint pt)
ui->disabledBackendList->addItem(iter.value());
}
}
void MainWindow::updateReverbBoostEdit(int value)
{
ui->reverbBoostEdit->clear();
if(value != 0)
ui->reverbBoostEdit->insert(QString::number(value/10.0, 'f', 1));
}
void MainWindow::updateReverbBoostSlider(QString value)
{
int pos = int(value.toFloat()*10.0f);
ui->reverbBoostSlider->setSliderPosition(pos);
}