From 1a4a3764d14b7cbe73d657522f1dca128a5cd488 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 29 Nov 2019 14:54:29 -0800 Subject: Update built-in HRTF name for alsoft-config --- utils/alsoft-config/mainwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index fed9de59..df4b692e 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -601,8 +601,7 @@ QStringList MainWindow::collectHrtfs() } #ifdef ALSOFT_EMBED_HRTF_DATA - ret.push_back("Built-In 44100hz"); - ret.push_back("Built-In 48000hz"); + ret.push_back("Built-In HRTF"); #endif } return ret; -- cgit v1.2.3 From 7ddd49e16a3ac854eaa88f2e3367575bf6d5b7ec Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 5 Aug 2020 00:43:08 -0700 Subject: Add the jack/connect-ports option to alsoft-config --- utils/alsoft-config/mainwindow.cpp | 3 +++ utils/alsoft-config/mainwindow.ui | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index df4b692e..b67df582 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -446,6 +446,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->pulseAdjLatencyCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackAutospawnCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->jackConnectPortsCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackBufferSizeSlider, &QSlider::valueChanged, this, &MainWindow::updateJackBufferSizeEdit); connect(ui->jackBufferSizeLine, &QLineEdit::editingFinished, this, &MainWindow::updateJackBufferSizeSlider); @@ -918,6 +919,7 @@ void MainWindow::loadConfig(const QString &fname) ui->pulseAdjLatencyCheckBox->setCheckState(getCheckState(settings.value("pulse/adjust-latency"))); ui->jackAutospawnCheckBox->setCheckState(getCheckState(settings.value("jack/spawn-server"))); + ui->jackConnectPortsCheckBox->setCheckState(getCheckState(settings.value("jack/connect-ports"))); ui->jackBufferSizeLine->setText(settings.value("jack/buffer-size", QString()).toString()); updateJackBufferSizeSlider(); @@ -1127,6 +1129,7 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("pulse/adjust-latency", getCheckValue(ui->pulseAdjLatencyCheckBox)); settings.setValue("jack/spawn-server", getCheckValue(ui->jackAutospawnCheckBox)); + settings.setValue("jack/connect-ports", getCheckValue(ui->jackConnectPortsCheckBox)); settings.setValue("jack/buffer-size", ui->jackBufferSizeLine->text()); settings.setValue("alsa/device", ui->alsaDefaultDeviceLine->text()); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 0506304e..77688cf0 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -1442,7 +1442,7 @@ drop-outs. 10 - 40 + 70 401 80 @@ -1500,6 +1500,22 @@ processing requests. Must be a power of 2. + + + + 20 + 40 + 141 + 21 + + + + AutoConnect Ports + + + true + + -- cgit v1.2.3 From 02e51c0525507dd0bc59629851449d4d5ad97223 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 31 Aug 2020 17:48:26 -0700 Subject: Avoid using a deprecated function --- utils/alsoft-config/mainwindow.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index b67df582..547dc300 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -475,10 +475,9 @@ MainWindow::MainWindow(QWidget *parent) : for(int i = 0;backendList[i].backend_name[0];i++) { QList items = ui->backendListWidget->findItems( - backendList[i].full_string, Qt::MatchFixedString - ); - foreach(const QListWidgetItem *item, items) - ui->backendListWidget->setItemHidden(item, false); + backendList[i].full_string, Qt::MatchFixedString); + foreach(QListWidgetItem *item, items) + item->setHidden(false); } loadConfig(getDefaultConfigName()); -- cgit v1.2.3 From 417d8da6f4baf727e1a4b55ff17189bf2d1a3447 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 13 Nov 2020 21:47:48 -0800 Subject: Avoid a deprecated function --- utils/alsoft-config/mainwindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 547dc300..8e6c7bea 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -365,11 +365,11 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->closeCancelButton, &QPushButton::clicked, this, &MainWindow::cancelCloseAction); connect(ui->applyButton, &QPushButton::clicked, this, &MainWindow::saveCurrentConfig); - auto qcb_cicstr = static_cast(&QComboBox::currentIndexChanged); - connect(ui->channelConfigCombo, qcb_cicstr, this, &MainWindow::enableApplyButton); - connect(ui->sampleFormatCombo, qcb_cicstr, this, &MainWindow::enableApplyButton); - connect(ui->stereoModeCombo, qcb_cicstr, this, &MainWindow::enableApplyButton); - connect(ui->sampleRateCombo, qcb_cicstr, this, &MainWindow::enableApplyButton); + auto qcb_cicint = static_cast(&QComboBox::currentIndexChanged); + connect(ui->channelConfigCombo, qcb_cicint, this, &MainWindow::enableApplyButton); + connect(ui->sampleFormatCombo, qcb_cicint, this, &MainWindow::enableApplyButton); + connect(ui->stereoModeCombo, qcb_cicint, this, &MainWindow::enableApplyButton); + connect(ui->sampleRateCombo, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->sampleRateCombo, &QComboBox::editTextChanged, this, &MainWindow::enableApplyButton); connect(ui->resamplerSlider, &QSlider::valueChanged, this, &MainWindow::updateResamplerLabel); @@ -379,8 +379,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->periodCountSlider, &QSlider::valueChanged, this, &MainWindow::updatePeriodCountEdit); connect(ui->periodCountEdit, &QLineEdit::editingFinished, this, &MainWindow::updatePeriodCountSlider); - connect(ui->stereoEncodingComboBox, qcb_cicstr, this, &MainWindow::enableApplyButton); - connect(ui->ambiFormatComboBox, qcb_cicstr, this, &MainWindow::enableApplyButton); + connect(ui->stereoEncodingComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); + connect(ui->ambiFormatComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->outputLimiterCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->outputDitherCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); @@ -398,8 +398,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->decoder71LineEdit, &QLineEdit::textChanged, this, &MainWindow::enableApplyButton); connect(ui->decoder71Button, &QPushButton::clicked, this, &MainWindow::select71DecoderFile); - connect(ui->preferredHrtfComboBox, qcb_cicstr, this, &MainWindow::enableApplyButton); - connect(ui->hrtfStateComboBox, qcb_cicstr, this, &MainWindow::enableApplyButton); + connect(ui->preferredHrtfComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); + connect(ui->hrtfStateComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->hrtfmodeSlider, &QSlider::valueChanged, this, &MainWindow::updateHrtfModeLabel); connect(ui->hrtfAddButton, &QPushButton::clicked, this, &MainWindow::addHrtfFile); @@ -424,7 +424,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->disabledBackendList, &QListWidget::customContextMenuRequested, this, &MainWindow::showDisabledBackendMenu); connect(ui->backendCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); - connect(ui->defaultReverbComboBox, qcb_cicstr, this, &MainWindow::enableApplyButton); + connect(ui->defaultReverbComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->enableEaxReverbCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->enableStdReverbCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->enableAutowahCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); -- cgit v1.2.3 From f963a2c543a35edf4810c5a1c106d6162e51b274 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 21 Oct 2021 07:38:57 -0700 Subject: Remove some lingering mentions of surround51rear --- alc/panning.cpp | 6 ++---- alsoftrc.sample | 8 ++++---- utils/alsoft-config/mainwindow.cpp | 5 +++-- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/alc/panning.cpp b/alc/panning.cpp index 45794454..a8f780b1 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -386,10 +386,8 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf, * CB = Back center * * Additionally, surround51 will acknowledge back speakers for side - * channels, and surround51rear will acknowledge side speakers for - * back channels, to avoid issues with an ambdec expecting 5.1 to - * use the side channels when the device is configured for back, - * and vice-versa. + * channels, to avoid issues with an ambdec expecting 5.1 to use the + * back channels. */ Channel ch{}; if(speaker.Name == "LF") diff --git a/alsoftrc.sample b/alsoftrc.sample index f41b8087..80bab07c 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -48,10 +48,10 @@ ## channels: # Sets the output channel configuration. If left unspecified, one will try to # be detected from the system, and defaulting to stereo. The available values -# are: mono, stereo, quad, surround51, surround51rear, surround61, surround71, -# ambi1, ambi2, ambi3. Note that the ambi* configurations provide ambisonic -# channels of the given order (using ACN ordering and SN3D normalization by -# default), which need to be decoded to play correctly on speakers. +# are: mono, stereo, quad, surround51, surround61, surround71, ambi1, ambi2, +# ambi3. Note that the ambi* configurations provide ambisonic channels of the +# given order (using ACN ordering and SN3D normalization by default), which +# need to be decoded to play correctly on speakers. #channels = ## sample-type: diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 8e6c7bea..7eea93ff 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -80,8 +80,7 @@ static const struct NameValuePair { { "Mono", "mono" }, { "Stereo", "stereo" }, { "Quadraphonic", "quad" }, - { "5.1 Surround (Side)", "surround51" }, - { "5.1 Surround (Rear)", "surround51rear" }, + { "5.1 Surround", "surround51" }, { "6.1 Surround", "surround61" }, { "7.1 Surround", "surround71" }, @@ -635,6 +634,8 @@ void MainWindow::loadConfig(const QString &fname) ui->channelConfigCombo->setCurrentIndex(0); if(channelconfig.isEmpty() == false) { + if(channelconfig == "surround51rear") + channelconfig = "surround51"; QString str{getNameFromValue(speakerModeList, channelconfig)}; if(!str.isEmpty()) { -- cgit v1.2.3 From 5eb93f6c7437a7b08f500a2484f9734499f36976 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 11 Nov 2021 22:40:10 -0800 Subject: Update alsoft-config --- utils/alsoft-config/mainwindow.cpp | 11 ++++---- utils/alsoft-config/mainwindow.ui | 55 +++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 17 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 7eea93ff..75859645 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -121,6 +121,7 @@ static const struct NameValuePair { { "Default", "" }, { "Pan Pot", "panpot" }, { "UHJ", "uhj" }, + { "Binaural", "hrtf" }, { "", "" } }, ambiFormatList[] = { @@ -446,6 +447,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->jackAutospawnCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackConnectPortsCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->jackRtMixCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackBufferSizeSlider, &QSlider::valueChanged, this, &MainWindow::updateJackBufferSizeEdit); connect(ui->jackBufferSizeLine, &QLineEdit::editingFinished, this, &MainWindow::updateJackBufferSizeSlider); @@ -736,8 +738,7 @@ void MainWindow::loadConfig(const QString &fname) } } - bool hqmode{settings.value("decoder/hq-mode", true).toBool()}; - ui->decoderHQModeCheckBox->setChecked(hqmode); + ui->decoderHQModeCheckBox->setChecked(getCheckState(settings.value("decoder/hq-mode"))); ui->decoderDistCompCheckBox->setCheckState(getCheckState(settings.value("decoder/distance-comp"))); ui->decoderNFEffectsCheckBox->setCheckState(getCheckState(settings.value("decoder/nfc"))); double refdelay{settings.value("decoder/nfc-ref-delay", 0.0).toDouble()}; @@ -920,6 +921,7 @@ void MainWindow::loadConfig(const QString &fname) ui->jackAutospawnCheckBox->setCheckState(getCheckState(settings.value("jack/spawn-server"))); ui->jackConnectPortsCheckBox->setCheckState(getCheckState(settings.value("jack/connect-ports"))); + ui->jackRtMixCheckBox->setCheckState(getCheckState(settings.value("jack/rt-mix"))); ui->jackBufferSizeLine->setText(settings.value("jack/buffer-size", QString()).toString()); updateJackBufferSizeSlider(); @@ -999,9 +1001,7 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("output-limiter", getCheckValue(ui->outputLimiterCheckBox)); settings.setValue("dither", getCheckValue(ui->outputDitherCheckBox)); - settings.setValue("decoder/hq-mode", - ui->decoderHQModeCheckBox->isChecked() ? QString{/*"true"*/} : QString{"false"} - ); + settings.setValue("decoder/hq-mode", getCheckValue(ui->decoderHQModeCheckBox)); settings.setValue("decoder/distance-comp", getCheckValue(ui->decoderDistCompCheckBox)); settings.setValue("decoder/nfc", getCheckValue(ui->decoderNFEffectsCheckBox)); double refdelay = ui->decoderNFRefDelaySpinBox->value(); @@ -1130,6 +1130,7 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("jack/spawn-server", getCheckValue(ui->jackAutospawnCheckBox)); settings.setValue("jack/connect-ports", getCheckValue(ui->jackConnectPortsCheckBox)); + settings.setValue("jack/rt-mix", getCheckValue(ui->jackRtMixCheckBox)); settings.setValue("jack/buffer-size", ui->jackBufferSizeLine->text()); settings.setValue("alsa/device", ui->alsaDefaultDeviceLine->text()); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 77688cf0..cfe8d6d2 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -62,7 +62,7 @@ 110 50 - 76 + 80 31 @@ -111,7 +111,7 @@ float and converted to the output sample type as needed. 110 20 - 76 + 80 31 @@ -129,7 +129,7 @@ to stereo output. 380 20 - 96 + 100 31 @@ -437,12 +437,15 @@ frames needed for each mixing update. Pan Pot uses standard amplitude panning (aka -pair-wise, stereo pair, etc) between -30 and +30 -degrees, while UHJ creates a stereo-compatible -two-channel UHJ mix, which encodes some -surround sound information into stereo output -that can be decoded with a surround sound -receiver. +pair-wise, stereo pair, etc). + +UHJ creates a stereo-compatible two-channel +UHJ mix, which encodes some surround sound +information into stereo output that can be +decoded with a surround sound receiver. + +Binaural applies HRTF filters to create a sense +of 3D space with headphones. @@ -632,6 +635,9 @@ appropriate speaker configuration you intend to use. High Quality Mode: + + true + @@ -1442,7 +1448,7 @@ drop-outs. 10 - 70 + 110 401 80 @@ -1450,7 +1456,8 @@ drop-outs. 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. +processing requests. Must be a power of 2. Ignored +when Real-time Mixing is used. Buffer Size @@ -1516,6 +1523,30 @@ processing requests. Must be a power of 2. true + + + + 20 + 70 + 141 + 21 + + + + Renders samples directly in the real-time +processing callback. This allows for lower +latency and less overall CPU utilization, but +can increase the risk of underruns when +increasing the amount of processing the +mixer needs to do. + + + Real-time Mixing + + + true + + @@ -2317,7 +2348,7 @@ added by the ALC_EXT_DEDICATED extension. 160 20 - 131 + 135 31 -- cgit v1.2.3 From bd254c5426748a1a0d64944bc91ab1956241dd1b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 26 Nov 2021 03:05:05 -0800 Subject: Recognize PipeWire in alsoft-config --- utils/alsoft-config/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 75859645..58a86289 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -28,6 +28,9 @@ static const struct { #ifdef HAVE_JACK { "jack", "JACK" }, #endif +#ifdef HAVE_PIPEWIRE + { "pipewire", "PipeWire" }, +#endif #ifdef HAVE_PULSEAUDIO { "pulse", "PulseAudio" }, #endif -- cgit v1.2.3 From 5381527303f7d8d306810e1267828bde1ab44b0c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 25 Dec 2021 20:30:57 -0800 Subject: Add the PipeWire config option to alsoft-config --- utils/alsoft-config/mainwindow.cpp | 8 ++++++++ utils/alsoft-config/mainwindow.ui | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 58a86289..7f21f57b 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -448,6 +448,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->pulseFixRateCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->pulseAdjLatencyCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->pwireAssumeAudioCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->jackAutospawnCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackConnectPortsCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackRtMixCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); @@ -922,6 +924,9 @@ void MainWindow::loadConfig(const QString &fname) ui->pulseFixRateCheckBox->setCheckState(getCheckState(settings.value("pulse/fix-rate"))); ui->pulseAdjLatencyCheckBox->setCheckState(getCheckState(settings.value("pulse/adjust-latency"))); + ui->pwireAssumeAudioCheckBox->setCheckState(settings.value("pipewire/assume-audio").toBool() + ? Qt::Checked : Qt::Unchecked); + ui->jackAutospawnCheckBox->setCheckState(getCheckState(settings.value("jack/spawn-server"))); ui->jackConnectPortsCheckBox->setCheckState(getCheckState(settings.value("jack/connect-ports"))); ui->jackRtMixCheckBox->setCheckState(getCheckState(settings.value("jack/rt-mix"))); @@ -1131,6 +1136,9 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("pulse/fix-rate", getCheckValue(ui->pulseFixRateCheckBox)); settings.setValue("pulse/adjust-latency", getCheckValue(ui->pulseAdjLatencyCheckBox)); + settings.setValue("pipewire/assume-audio", ui->pwireAssumeAudioCheckBox->isChecked() + ? QString{"true"} : QString{/*"false"*/}); + settings.setValue("jack/spawn-server", getCheckValue(ui->jackAutospawnCheckBox)); settings.setValue("jack/connect-ports", getCheckValue(ui->jackConnectPortsCheckBox)); settings.setValue("jack/rt-mix", getCheckValue(ui->jackRtMixCheckBox)); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index cfe8d6d2..ba8f83fb 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -1225,6 +1225,11 @@ application or system to determine if it should be used. PulseAudio + + + PipeWire + + JACK @@ -1427,6 +1432,26 @@ drop-outs. + + + + + 20 + 10 + 161 + 21 + + + + Assumes PipeWire has support for audio, allowing +the backend to initialize even when no audio devices +are reported. + + + Assume audio support + + + -- cgit v1.2.3 From 43ec687ee94fffb90a97841406c36ce08291bf80 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 5 Jan 2022 20:32:03 -0800 Subject: Add a third-order ambisonic decoder for HRTF Using the 20-channel dodecahedron, seems to be good enough to handle 16-channel third-order ambisonics. --- alc/panning.cpp | 61 ++++++++++++++++++++++++++++++++++++-- utils/alsoft-config/mainwindow.cpp | 9 +++--- 2 files changed, 63 insertions(+), 7 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/alc/panning.cpp b/alc/panning.cpp index 17475160..90fbc9d4 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -663,6 +663,9 @@ void InitHrtfPanning(ALCdevice *device) constexpr float Deg_45{Deg_90 / 2.0f /* 45 degrees*/}; constexpr float Deg135{Deg_45 * 3.0f /*135 degrees*/}; constexpr float Deg_35{6.154797087e-01f /* 35~ 36 degrees*/}; + constexpr float Deg_69{1.205932499e+00f /* 69~ 70 degrees*/}; + constexpr float Deg111{1.935660155e+00f /*110~111 degrees*/}; + constexpr float Deg_21{3.648638281e-01f /* 20~ 21 degrees*/}; static const AngularPoint AmbiPoints1O[]{ { EvRadians{ Deg_35}, AzRadians{-Deg_45} }, { EvRadians{ Deg_35}, AzRadians{-Deg135} }, @@ -687,6 +690,27 @@ void InitHrtfPanning(ALCdevice *device) { EvRadians{-Deg_35}, AzRadians{-Deg135} }, { EvRadians{-Deg_35}, AzRadians{ Deg_45} }, { EvRadians{-Deg_35}, AzRadians{ Deg135} }, + }, AmbiPoints3O[]{ + { EvRadians{ Deg_69}, AzRadians{-Deg_90} }, + { EvRadians{ Deg_69}, AzRadians{ Deg_90} }, + { EvRadians{-Deg_69}, AzRadians{-Deg_90} }, + { EvRadians{-Deg_69}, AzRadians{ Deg_90} }, + { EvRadians{ 0.0f}, AzRadians{-Deg_69} }, + { EvRadians{ 0.0f}, AzRadians{-Deg111} }, + { EvRadians{ 0.0f}, AzRadians{ Deg_69} }, + { EvRadians{ 0.0f}, AzRadians{ Deg111} }, + { EvRadians{ Deg_21}, AzRadians{ 0.0f} }, + { EvRadians{ Deg_21}, AzRadians{ Deg180} }, + { EvRadians{-Deg_21}, AzRadians{ 0.0f} }, + { EvRadians{-Deg_21}, AzRadians{ Deg180} }, + { EvRadians{ Deg_35}, AzRadians{-Deg_45} }, + { EvRadians{ Deg_35}, AzRadians{-Deg135} }, + { EvRadians{ Deg_35}, AzRadians{ Deg_45} }, + { EvRadians{ Deg_35}, AzRadians{ Deg135} }, + { EvRadians{-Deg_35}, AzRadians{-Deg_45} }, + { EvRadians{-Deg_35}, AzRadians{-Deg135} }, + { EvRadians{-Deg_35}, AzRadians{ Deg_45} }, + { EvRadians{-Deg_35}, AzRadians{ Deg135} }, }; static const float AmbiMatrix1O[][MaxAmbiChannels]{ { 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f }, @@ -712,6 +736,27 @@ void InitHrtfPanning(ALCdevice *device) { 7.142857143e-02f, 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, -9.682458366e-02f, -9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, }, { 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, 7.142857143e-02f, -9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, -9.682458366e-02f, 0.000000000e+00f, }, { 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, 9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, }, + }, AmbiMatrix3O[][MaxAmbiChannels]{ + { 5.000000000e-02f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, }, + { 5.000000000e-02f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, }, + { 5.000000000e-02f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f, }, + { 5.000000000e-02f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f, }, + { 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f, }, + { 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f, }, + { 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f, }, + { 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f, }, + { 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, -6.779013272e-02f, 1.659481923e-01f, 4.797944664e-02f, }, + { 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, 6.779013272e-02f, 1.659481923e-01f, -4.797944664e-02f, }, + { 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, -6.779013272e-02f, -1.659481923e-01f, 4.797944664e-02f, }, + { 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, 6.779013272e-02f, -1.659481923e-01f, -4.797944664e-02f, }, + { 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f, }, + { 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f, }, + { 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f, }, + { 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f, }, + { 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f, }, + { 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f, }, + { 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f, }, + { 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f, }, }; static const float AmbiOrderHFGain1O[MaxAmbiOrder+1]{ /*ENRGY*/ 2.000000000e+00f, 1.154700538e+00f @@ -719,10 +764,15 @@ void InitHrtfPanning(ALCdevice *device) /*ENRGY 2.357022604e+00f, 1.825741858e+00f, 9.428090416e-01f*/ /*AMP 1.000000000e+00f, 7.745966692e-01f, 4.000000000e-01f*/ /*RMS*/ 9.128709292e-01f, 7.071067812e-01f, 3.651483717e-01f + }, AmbiOrderHFGain3O[MaxAmbiOrder+1]{ + /*ENRGY 1.865086714e+00f, 1.606093894e+00f, 1.142055301e+00f, 5.683795528e-01f*/ + /*AMP 1.000000000e+00f, 8.611363116e-01f, 6.123336207e-01f, 3.047469850e-01f*/ + /*RMS*/ 8.340921354e-01f, 7.182670250e-01f, 5.107426573e-01f, 2.541870634e-01f }; static_assert(al::size(AmbiPoints1O) == al::size(AmbiMatrix1O), "First-Order Ambisonic HRTF mismatch"); static_assert(al::size(AmbiPoints2O) == al::size(AmbiMatrix2O), "Second-Order Ambisonic HRTF mismatch"); + static_assert(al::size(AmbiPoints3O) == al::size(AmbiMatrix3O), "Third-Order Ambisonic HRTF mismatch"); /* A 700hz crossover frequency provides tighter sound imaging at the sweet * spot with ambisonic decoding, as the distance between the ears is closer @@ -753,10 +803,11 @@ void InitHrtfPanning(ALCdevice *device) { "full", RenderMode::Hrtf, 1 }, { "ambi1", RenderMode::Normal, 1 }, { "ambi2", RenderMode::Normal, 2 }, + { "ambi3", RenderMode::Normal, 3 }, }; const char *mode{modeopt->c_str()}; - if(al::strcasecmp(mode, "basic") == 0 || al::strcasecmp(mode, "ambi3") == 0) + if(al::strcasecmp(mode, "basic") == 0) { ERR("HRTF mode \"%s\" deprecated, substituting \"%s\"\n", mode, "ambi2"); mode = "ambi2"; @@ -784,7 +835,13 @@ void InitHrtfPanning(ALCdevice *device) al::span AmbiPoints{AmbiPoints1O}; const float (*AmbiMatrix)[MaxAmbiChannels]{AmbiMatrix1O}; al::span AmbiOrderHFGain{AmbiOrderHFGain1O}; - if(ambi_order >= 2) + if(ambi_order >= 3) + { + AmbiPoints = AmbiPoints3O; + AmbiMatrix = AmbiMatrix3O; + AmbiOrderHFGain = AmbiOrderHFGain3O; + } + else if(ambi_order == 2) { AmbiPoints = AmbiPoints2O; AmbiMatrix = AmbiMatrix2O; diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 7f21f57b..9fb6bd76 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -137,6 +137,7 @@ static const struct NameValuePair { }, hrtfModeList[] = { { "1st Order Ambisonic", "ambi1" }, { "2nd Order Ambisonic", "ambi2" }, + { "3rd Order Ambisonic", "ambi3" }, { "Default (Full)", "" }, { "Full", "full" }, @@ -767,11 +768,9 @@ void MainWindow::loadConfig(const QString &fname) QString hrtfmode{settings.value("hrtf-mode").toString().trimmed()}; ui->hrtfmodeSlider->setValue(2); - ui->hrtfmodeLabel->setText(hrtfModeList[2].name); - /* The "basic" mode name is no longer supported, and "ambi3" is temporarily - * disabled. Use "ambi2" instead. - */ - if(hrtfmode == "basic" || hrtfmode == "ambi3") + ui->hrtfmodeLabel->setText(hrtfModeList[3].name); + /* The "basic" mode name is no longer supported. Use "ambi2" instead. */ + if(hrtfmode == "basic") hrtfmode = "ambi2"; for(int i = 0;hrtfModeList[i].name[0];i++) { -- cgit v1.2.3 From 16ae002d0b0d3d8309677d0a72bd4703fdcac0ae Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 5 Jan 2022 20:39:12 -0800 Subject: Avoid a deprecated QString enum --- utils/alsoft-config/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 9fb6bd76..0e6e2e29 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -204,7 +204,7 @@ static QStringList getAllDataPaths(const QString &append) QString paths = qgetenv("XDG_DATA_DIRS"); if(paths.isEmpty()) paths = "/usr/local/share/:/usr/share/"; - list += paths.split(QChar(':'), QString::SkipEmptyParts); + list += paths.split(QChar(':'), Qt::SkipEmptyParts); #endif QStringList::iterator iter = list.begin(); while(iter != list.end()) -- cgit v1.2.3 From e32c214e9c8f2c1a9aab06ebd2bad8475c12949c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 6 Jan 2022 17:01:26 -0800 Subject: Use the deprecated enum for older Qt versions --- utils/alsoft-config/mainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 0e6e2e29..718752c6 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -204,7 +204,11 @@ static QStringList getAllDataPaths(const QString &append) QString paths = qgetenv("XDG_DATA_DIRS"); if(paths.isEmpty()) paths = "/usr/local/share/:/usr/share/"; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) list += paths.split(QChar(':'), Qt::SkipEmptyParts); +#else + list += paths.split(QChar(':'), QString::SkipEmptyParts); +#endif #endif QStringList::iterator iter = list.begin(); while(iter != list.end()) -- cgit v1.2.3 From 481b115b96608fdd8f3178a2b7d7c0f3d3f06b69 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 12 Jan 2022 03:05:56 -0800 Subject: Add an ambi-format option for ACN ordering and FuMa scaling --- alc/alc.cpp | 15 +++++++++++++++ alsoftrc.sample | 3 ++- utils/alsoft-config/mainwindow.cpp | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/alc/alc.cpp b/alc/alc.cpp index 00757842..04dbcab3 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -3315,6 +3315,21 @@ START_API_FUNC device->mAmbiScale = DevAmbiScaling::FuMa; } } + else if(al::strcasecmp(fmt, "acn+fuma") == 0) + { + if(device->mAmbiOrder > 3) + ERR("FuMa is incompatible with %d%s order ambisonics (up to third-order only)\n", + device->mAmbiOrder, + (((device->mAmbiOrder%100)/10) == 1) ? "th" : + ((device->mAmbiOrder%10) == 1) ? "st" : + ((device->mAmbiOrder%10) == 2) ? "nd" : + ((device->mAmbiOrder%10) == 3) ? "rd" : "th"); + else + { + device->mAmbiLayout = DevAmbiLayout::ACN; + device->mAmbiScale = DevAmbiScaling::FuMa; + } + } else if(al::strcasecmp(fmt, "ambix") == 0 || al::strcasecmp(fmt, "acn+sn3d") == 0) { device->mAmbiLayout = DevAmbiLayout::ACN; diff --git a/alsoftrc.sample b/alsoftrc.sample index 7b94fa35..1664381d 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -102,7 +102,8 @@ ## ambi-format: # Specifies the channel order and normalization for the "ambi*" set of channel -# configurations. Valid settings are: fuma, ambix (or acn+sn3d), acn+n3d +# configurations. Valid settings are: fuma, acn+fuma, ambix (or acn+sn3d), or +# acn+n3d #ambi-format = ambix ## hrtf: diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 718752c6..baecf525 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -130,8 +130,9 @@ static const struct NameValuePair { }, ambiFormatList[] = { { "Default", "" }, { "AmbiX (ACN, SN3D)", "ambix" }, - { "ACN, N3D", "acn+n3d" }, { "Furse-Malham", "fuma" }, + { "ACN, N3D", "acn+n3d" }, + { "ACN, FuMa", "acn+fuma" }, { "", "" } }, hrtfModeList[] = { -- cgit v1.2.3 From 9b330e41279884ced8b4d3ddaa63e023f4eb31e9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 Apr 2022 14:03:24 -0700 Subject: Add an option to alsoft-config for EAX API support --- utils/alsoft-config/mainwindow.cpp | 12 ++++++++++++ utils/alsoft-config/mainwindow.ui | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index baecf525..8a179ada 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -347,6 +347,12 @@ MainWindow::MainWindow(QWidget *parent) : ui->enableSSE41CheckBox->setVisible(false); #endif /* !SSE4.1 */ +#endif + +#ifndef ALSOFT_EAX + ui->enableEaxCheck->setChecked(Qt::Unchecked); + ui->enableEaxCheck->setEnabled(false); + ui->enableEaxCheck->setVisible(false); #endif mPeriodSizeValidator = new QIntValidator{64, 8192, this}; @@ -448,6 +454,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->enableDedicatedCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->enablePitchShifterCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->enableVocalMorpherCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->enableEaxCheck, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->pulseAutospawnCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->pulseAllowMovesCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); @@ -922,6 +929,8 @@ void MainWindow::loadConfig(const QString &fname) ui->enableDedicatedCheck->setChecked(!excludefx.contains("dedicated", Qt::CaseInsensitive)); ui->enablePitchShifterCheck->setChecked(!excludefx.contains("pshifter", Qt::CaseInsensitive)); ui->enableVocalMorpherCheck->setChecked(!excludefx.contains("vmorpher", Qt::CaseInsensitive)); + if(ui->enableEaxCheck->isEnabled()) + ui->enableEaxCheck->setChecked(getCheckState(settings.value("eax/enable")) != Qt::Unchecked); ui->pulseAutospawnCheckBox->setCheckState(getCheckState(settings.value("pulse/spawn-server"))); ui->pulseAllowMovesCheckBox->setCheckState(getCheckState(settings.value("pulse/allow-moves"))); @@ -1134,6 +1143,9 @@ void MainWindow::saveConfig(const QString &fname) const if(!ui->enableVocalMorpherCheck->isChecked()) strlist.append("vmorpher"); settings.setValue("excludefx", strlist.join(QChar{','})); + settings.setValue("eax/enable", + (!ui->enableEaxCheck->isEnabled() || ui->enableEaxCheck->isChecked()) + ? QString{/*"true"*/} : QString{"false"}); settings.setValue("pulse/spawn-server", getCheckValue(ui->pulseAutospawnCheckBox)); settings.setValue("pulse/allow-moves", getCheckValue(ui->pulseAllowMovesCheckBox)); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index ba8f83fb..40a4fdaf 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -2110,7 +2110,7 @@ be useful for preventing those extensions from being used. 10 - 100 + 60 511 241 @@ -2516,6 +2516,22 @@ added by the ALC_EXT_DEDICATED extension. + + + + 30 + 320 + 231 + 21 + + + + Enables legacy EAX API support. + + + Enable EAX API support + + -- cgit v1.2.3 From 593966c8dbdbf2dbcd8768b258a3b22adb548b2f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 Apr 2022 23:32:15 -0700 Subject: Handle 3D7.1 as a separate channel configuration It's treated as 5.1 + 2 aux channels. This allows AL_DIRECT_CHANNELS_SOFT to behave better, not forwarding rear left/right channel inputs to lower front and upper rear, and allows reporting a more appropriate output mode to the app instead of 7.1. --- alc/alc.cpp | 4 ++ alc/backends/base.cpp | 74 +++++++------------------ alc/backends/base.h | 5 -- alc/backends/coreaudio.cpp | 1 + alc/backends/dsound.cpp | 6 +- alc/backends/oboe.cpp | 1 + alc/backends/opensl.cpp | 3 +- alc/backends/pipewire.cpp | 1 + alc/backends/pulseaudio.cpp | 2 + alc/backends/wasapi.cpp | 6 +- alc/backends/wave.cpp | 2 + alc/backends/winmm.cpp | 10 +--- alc/context.cpp | 4 ++ alc/device.cpp | 1 + alc/panning.cpp | 58 ++++++++++++++++++-- core/devformat.cpp | 2 + core/devformat.h | 18 ++++++ docs/3D7.1.txt | 15 ++--- presets/3D7.1.ambdec | 20 ++++--- utils/alsoft-config/mainwindow.cpp | 5 ++ utils/alsoft-config/mainwindow.h | 1 + utils/alsoft-config/mainwindow.ui | 109 +++++++++++++++++++++++++------------ 22 files changed, 219 insertions(+), 129 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/alc/alc.cpp b/alc/alc.cpp index 3bbe43d0..686b794e 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1441,6 +1441,8 @@ ALCenum EnumFromDevFmt(DevFmtChannels channels) case DevFmtX61: return ALC_6POINT1_SOFT; case DevFmtX71: return ALC_7POINT1_SOFT; case DevFmtAmbi3D: return ALC_BFORMAT3D_SOFT; + /* FIXME: Shouldn't happen. */ + case DevFmtX3D71: break; } throw std::runtime_error{"Invalid DevFmtChannels: "+std::to_string(int(channels))}; } @@ -1911,6 +1913,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) { "surround51", DevFmtX51, 0 }, { "surround61", DevFmtX61, 0 }, { "surround71", DevFmtX71, 0 }, + { "surround3d71", DevFmtX3D71, 0 }, { "surround51rear", DevFmtX51, 0 }, { "ambi1", DevFmtAmbi3D, 1 }, { "ambi2", DevFmtAmbi3D, 2 }, @@ -2090,6 +2093,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) case DevFmtX51: device->RealOut.RemixMap = X51Downmix; break; case DevFmtX61: device->RealOut.RemixMap = X61Downmix; break; case DevFmtX71: device->RealOut.RemixMap = X71Downmix; break; + case DevFmtX3D71: device->RealOut.RemixMap = X51Downmix; break; case DevFmtAmbi3D: break; } diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index cd1b76ba..4abd7c03 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -98,6 +98,16 @@ void BackendBase::setDefaultWFXChannelOrder() mDevice->RealOut.ChannelIndex[SideLeft] = 6; mDevice->RealOut.ChannelIndex[SideRight] = 7; break; + case DevFmtX3D71: + mDevice->RealOut.ChannelIndex[FrontLeft] = 0; + mDevice->RealOut.ChannelIndex[FrontRight] = 1; + mDevice->RealOut.ChannelIndex[FrontCenter] = 2; + mDevice->RealOut.ChannelIndex[LFE] = 3; + mDevice->RealOut.ChannelIndex[Aux0] = 4; + mDevice->RealOut.ChannelIndex[Aux1] = 5; + mDevice->RealOut.ChannelIndex[SideLeft] = 6; + mDevice->RealOut.ChannelIndex[SideRight] = 7; + break; case DevFmtAmbi3D: break; } @@ -127,6 +137,16 @@ void BackendBase::setDefaultChannelOrder() mDevice->RealOut.ChannelIndex[SideLeft] = 6; mDevice->RealOut.ChannelIndex[SideRight] = 7; return; + case DevFmtX3D71: + mDevice->RealOut.ChannelIndex[FrontLeft] = 0; + mDevice->RealOut.ChannelIndex[FrontRight] = 1; + mDevice->RealOut.ChannelIndex[Aux0] = 2; + mDevice->RealOut.ChannelIndex[Aux1] = 3; + mDevice->RealOut.ChannelIndex[FrontCenter] = 4; + mDevice->RealOut.ChannelIndex[LFE] = 5; + mDevice->RealOut.ChannelIndex[SideLeft] = 6; + mDevice->RealOut.ChannelIndex[SideRight] = 7; + return; /* Same as WFX order */ case DevFmtMono: @@ -138,57 +158,3 @@ void BackendBase::setDefaultChannelOrder() break; } } - -#ifdef _WIN32 -void BackendBase::setChannelOrderFromWFXMask(uint chanmask) -{ - static constexpr uint x51{SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER - | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT}; - static constexpr uint x51rear{SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER - | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}; - /* Swap a 5.1 mask using the back channels for one with the sides. */ - if(chanmask == x51rear) chanmask = x51; - - auto get_channel = [](const DWORD chanbit) noexcept -> al::optional - { - switch(chanbit) - { - case SPEAKER_FRONT_LEFT: return al::make_optional(FrontLeft); - case SPEAKER_FRONT_RIGHT: return al::make_optional(FrontRight); - case SPEAKER_FRONT_CENTER: return al::make_optional(FrontCenter); - case SPEAKER_LOW_FREQUENCY: return al::make_optional(LFE); - case SPEAKER_BACK_LEFT: return al::make_optional(BackLeft); - case SPEAKER_BACK_RIGHT: return al::make_optional(BackRight); - case SPEAKER_FRONT_LEFT_OF_CENTER: break; - case SPEAKER_FRONT_RIGHT_OF_CENTER: break; - case SPEAKER_BACK_CENTER: return al::make_optional(BackCenter); - case SPEAKER_SIDE_LEFT: return al::make_optional(SideLeft); - case SPEAKER_SIDE_RIGHT: return al::make_optional(SideRight); - case SPEAKER_TOP_CENTER: return al::make_optional(TopCenter); - case SPEAKER_TOP_FRONT_LEFT: return al::make_optional(TopFrontLeft); - case SPEAKER_TOP_FRONT_CENTER: return al::make_optional(TopFrontCenter); - case SPEAKER_TOP_FRONT_RIGHT: return al::make_optional(TopFrontRight); - case SPEAKER_TOP_BACK_LEFT: return al::make_optional(TopBackLeft); - case SPEAKER_TOP_BACK_CENTER: return al::make_optional(TopBackCenter); - case SPEAKER_TOP_BACK_RIGHT: return al::make_optional(TopBackRight); - } - WARN("Unhandled WFX channel bit 0x%lx\n", chanbit); - return al::nullopt; - }; - - const uint numchans{mDevice->channelsFromFmt()}; - uint idx{0}; - while(chanmask) - { - const int bit{al::countr_zero(chanmask)}; - const uint mask{1u << bit}; - chanmask &= ~mask; - - if(auto label = get_channel(mask)) - { - mDevice->RealOut.ChannelIndex[*label] = idx; - if(++idx == numchans) break; - } - } -} -#endif diff --git a/alc/backends/base.h b/alc/backends/base.h index a3562f54..65bc636b 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -41,11 +41,6 @@ protected: void setDefaultChannelOrder(); /** Sets the default channel order used by WaveFormatEx. */ void setDefaultWFXChannelOrder(); - -#ifdef _WIN32 - /** Sets the channel order given the WaveFormatEx mask. */ - void setChannelOrderFromWFXMask(uint chanmask); -#endif }; using BackendPtr = std::unique_ptr; diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index ed85e2a9..b81bd58a 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -764,6 +764,7 @@ void CoreAudioCapture::open(const char *name) case DevFmtX51: case DevFmtX61: case DevFmtX71: + case DevFmtX3D71: case DevFmtAmbi3D: throw al::backend_exception{al::backend_error::DeviceError, "%s not supported", DevFmtChannelsString(mDevice->FmtChans)}; diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index 0edc286f..36c4cd78 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -421,6 +421,7 @@ bool DSoundPlayback::reset() case DevFmtX51: OutputType.dwChannelMask = X5DOT1; break; case DevFmtX61: OutputType.dwChannelMask = X6DOT1; break; case DevFmtX71: OutputType.dwChannelMask = X7DOT1; break; + case DevFmtX3D71: OutputType.dwChannelMask = X7DOT1; break; } retry_open: @@ -514,7 +515,7 @@ retry_open: } ResetEvent(mNotifyEvent); - setChannelOrderFromWFXMask(OutputType.dwChannelMask); + setDefaultWFXChannelOrder(); return true; } @@ -635,6 +636,7 @@ void DSoundCapture::open(const char *name) case DevFmtX51: InputType.dwChannelMask = X5DOT1; break; case DevFmtX61: InputType.dwChannelMask = X6DOT1; break; case DevFmtX71: InputType.dwChannelMask = X7DOT1; break; + case DevFmtX3D71: case DevFmtAmbi3D: WARN("%s capture not supported\n", DevFmtChannelsString(mDevice->FmtChans)); throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported", @@ -689,7 +691,7 @@ void DSoundCapture::open(const char *name) } mBufferBytes = DSCBDescription.dwBufferBytes; - setChannelOrderFromWFXMask(InputType.dwChannelMask); + setDefaultWFXChannelOrder(); mDevice->DeviceName = name; } diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp index 38f048cb..03930ad8 100644 --- a/alc/backends/oboe.cpp +++ b/alc/backends/oboe.cpp @@ -234,6 +234,7 @@ void OboeCapture::open(const char *name) case DevFmtX51: case DevFmtX61: case DevFmtX71: + case DevFmtX3D71: case DevFmtAmbi3D: throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported", DevFmtChannelsString(mDevice->FmtChans)}; diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 85a5f483..76b2095e 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -71,7 +71,8 @@ constexpr SLuint32 GetChannelMask(DevFmtChannels chans) noexcept case DevFmtX61: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_BACK_CENTER | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT; - case DevFmtX71: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | + case DevFmtX71: + case DevFmtX3D71: return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT; case DevFmtAmbi3D: diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index a19dcb61..95845158 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -1181,6 +1181,7 @@ spa_audio_info_raw make_spa_info(DeviceBase *device, bool is51rear, use_f32p_e u break; case DevFmtX61: map = X61Map; break; case DevFmtX71: map = X71Map; break; + case DevFmtX3D71: map = X71Map; break; case DevFmtAmbi3D: info.flags |= SPA_AUDIO_FLAG_UNPOSITIONED; info.channels = device->channelsFromFmt(); diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 67e00234..30f486c7 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -893,6 +893,7 @@ bool PulsePlayback::reset() chanmap = X61ChanMap; break; case DevFmtX71: + case DevFmtX3D71: chanmap = X71ChanMap; break; } @@ -1173,6 +1174,7 @@ void PulseCapture::open(const char *name) case DevFmtX71: chanmap = X71ChanMap; break; + case DevFmtX3D71: case DevFmtAmbi3D: throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported", DevFmtChannelsString(mDevice->FmtChans)}; diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 063fca98..4e0f67a2 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -926,6 +926,7 @@ HRESULT WasapiPlayback::resetProxy() OutputType.dwChannelMask = X6DOT1; break; case DevFmtX71: + case DevFmtX3D71: OutputType.Format.nChannels = 8; OutputType.dwChannelMask = X7DOT1; break; @@ -1021,6 +1022,7 @@ HRESULT WasapiPlayback::resetProxy() chansok = (chancount >= 7 && (chanmask&X61Mask) == X6DOT1); break; case DevFmtX71: + case DevFmtX3D71: chansok = (chancount >= 8 && (chanmask&X71Mask) == X7DOT1); break; case DevFmtAmbi3D: @@ -1087,7 +1089,7 @@ HRESULT WasapiPlayback::resetProxy() const EndpointFormFactor formfactor{get_device_formfactor(mMMDev.get())}; mDevice->Flags.set(DirectEar, (formfactor == Headphones || formfactor == Headset)); - setChannelOrderFromWFXMask(OutputType.dwChannelMask); + setDefaultWFXChannelOrder(); hr = mClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, buf_time.count(), 0, &OutputType.Format, nullptr); @@ -1476,6 +1478,7 @@ HRESULT WasapiCapture::resetProxy() InputType.dwChannelMask = X7DOT1; break; + case DevFmtX3D71: case DevFmtAmbi3D: return E_FAIL; } @@ -1556,6 +1559,7 @@ HRESULT WasapiCapture::resetProxy() case DevFmtX61: return (chancount == 7 && (chanmask == 0 || (chanmask&X61Mask) == X6DOT1)); case DevFmtX71: + case DevFmtX3D71: return (chancount == 8 && (chanmask == 0 || (chanmask&X71Mask) == X7DOT1)); case DevFmtAmbi3D: return (chanmask == 0 && chancount == device->channelsFromFmt()); diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index 6360166c..80e93f69 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -265,6 +265,8 @@ bool WaveBackend::reset() case DevFmtX51: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x200 | 0x400; break; case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break; case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; + /* NOTE: Same as 7.1. */ + case DevFmtX3D71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; case DevFmtAmbi3D: /* .amb output requires FuMa */ mDevice->mAmbiOrder = minu(mDevice->mAmbiOrder, 3); diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index 0fdd8a02..14cc4f9e 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -301,23 +301,16 @@ bool WinMMPlayback::reset() return false; } - uint chanmask{}; if(mFormat.nChannels >= 2) - { mDevice->FmtChans = DevFmtStereo; - chanmask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; - } else if(mFormat.nChannels == 1) - { mDevice->FmtChans = DevFmtMono; - chanmask = SPEAKER_FRONT_CENTER; - } else { ERR("Unhandled channel count: %d\n", mFormat.nChannels); return false; } - setChannelOrderFromWFXMask(chanmask); + setDefaultWFXChannelOrder(); uint BufferSize{mDevice->UpdateSize * mFormat.nChannels * mDevice->bytesFromFmt()}; @@ -476,6 +469,7 @@ void WinMMCapture::open(const char *name) case DevFmtX51: case DevFmtX61: case DevFmtX71: + case DevFmtX3D71: case DevFmtAmbi3D: throw al::backend_exception{al::backend_error::DeviceError, "%s capture not supported", DevFmtChannelsString(mDevice->FmtChans)}; diff --git a/alc/context.cpp b/alc/context.cpp index 456c054e..34da3784 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -558,6 +558,10 @@ unsigned long ALCcontext::eax_detect_speaker_configuration() const case DevFmtX51: return SPEAKERS_5; case DevFmtX61: return SPEAKERS_6; case DevFmtX71: return SPEAKERS_7; + /* 3D7.1 is only compatible with 5.1. This could instead be HEADPHONES to + * suggest full-sphere surround sound (like HRTF). + */ + case DevFmtX3D71: return SPEAKERS_5; /* This could also be HEADPHONES, since headphones-based HRTF and Ambi3D * provide full-sphere surround sound. Depends if apps are more likely to * consider headphones or 7.1 for surround sound support. diff --git a/alc/device.cpp b/alc/device.cpp index e06c0d74..6eeb907e 100644 --- a/alc/device.cpp +++ b/alc/device.cpp @@ -84,6 +84,7 @@ auto ALCdevice::getOutputMode1() const noexcept -> OutputMode1 case DevFmtX51: return OutputMode1::X51; case DevFmtX61: return OutputMode1::X61; case DevFmtX71: return OutputMode1::X71; + case DevFmtX3D71: case DevFmtAmbi3D: break; } return OutputMode1::Any; diff --git a/alc/panning.cpp b/alc/panning.cpp index 00bf5662..d0afd577 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -89,6 +89,23 @@ inline const char *GetLabelFromChannel(Channel channel) case TopBackCenter: return "top-back-center"; case TopBackRight: return "top-back-right"; + case Aux0: return "Aux0"; + case Aux1: return "Aux1"; + case Aux2: return "Aux2"; + case Aux3: return "Aux3"; + case Aux4: return "Aux4"; + case Aux5: return "Aux5"; + case Aux6: return "Aux6"; + case Aux7: return "Aux7"; + case Aux8: return "Aux8"; + case Aux9: return "Aux9"; + case Aux10: return "Aux10"; + case Aux11: return "Aux11"; + case Aux12: return "Aux12"; + case Aux13: return "Aux13"; + case Aux14: return "Aux14"; + case Aux15: return "Aux15"; + case MaxChannels: break; } return "(unknown)"; @@ -202,6 +219,8 @@ struct DecoderConfig { mCoeffsLF = rhs.mCoeffsLF; return *this; } + + explicit operator bool() const noexcept { return mOrder != 0; } }; using DecoderView = DecoderConfig; @@ -412,8 +431,15 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf, ch = BackCenter; else { - ERR("AmbDec speaker label \"%s\" not recognized\n", speaker.Name.c_str()); - continue; + int idx{}; + char c{}; + if(sscanf(speaker.Name.c_str(), "AUX%d%c", &idx, &c) != 1 || idx < 0 + || idx >= MaxChannels-Aux0) + { + ERR("AmbDec speaker label \"%s\" not recognized\n", speaker.Name.c_str()); + continue; + } + ch = static_cast(Aux0+idx); } decoder.mChannels[chan_count] = ch; @@ -537,11 +563,33 @@ constexpr DecoderConfig X71Config{ {{1.66666667e-1f, -9.62250449e-2f, -1.66666667e-1f, 1.49071198e-1f, 8.60662966e-2f, -7.96819073e-2f, 0.00000000e+0f}}, }} }; +constexpr DecoderConfig X3D71Config{ + 1, true, {{Aux0, SideLeft, FrontLeft, FrontRight, SideRight, Aux1}}, + DevAmbiScaling::N3D, + /*HF*/{{1.73205081e+0f, 1.00000000e+0f}}, + {{ + {{1.66669447e-1f, 0.00000000e+0f, 2.36070520e-1f, -1.66153012e-1f}}, + {{1.66669447e-1f, 2.04127551e-1f, -1.17487922e-1f, -1.66927066e-1f}}, + {{1.66669447e-1f, 2.04127551e-1f, 1.17487922e-1f, 1.66927066e-1f}}, + {{1.66669447e-1f, -2.04127551e-1f, 1.17487922e-1f, 1.66927066e-1f}}, + {{1.66669447e-1f, -2.04127551e-1f, -1.17487922e-1f, -1.66927066e-1f}}, + {{1.66669447e-1f, 0.00000000e+0f, -2.36070520e-1f, 1.66153012e-1f}}, + }}, + /*LF*/{{1.00000000e+0f, 1.00000000e+0f}}, + {{ + {{1.66669447e-1f, 0.00000000e+0f, 2.36070520e-1f, -1.66153012e-1f}}, + {{1.66669447e-1f, 2.04127551e-1f, -1.17487922e-1f, -1.66927066e-1f}}, + {{1.66669447e-1f, 2.04127551e-1f, 1.17487922e-1f, 1.66927066e-1f}}, + {{1.66669447e-1f, -2.04127551e-1f, 1.17487922e-1f, 1.66927066e-1f}}, + {{1.66669447e-1f, -2.04127551e-1f, -1.17487922e-1f, -1.66927066e-1f}}, + {{1.66669447e-1f, 0.00000000e+0f, -2.36070520e-1f, 1.66153012e-1f}}, + }} +}; void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=false, DecoderView decoder={}) { - if(!decoder.mOrder) + if(!decoder) { switch(device->FmtChans) { @@ -551,6 +599,7 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize= case DevFmtX51: decoder = X51Config; break; case DevFmtX61: decoder = X61Config; break; case DevFmtX71: decoder = X71Config; break; + case DevFmtX3D71: decoder = X3D71Config; break; case DevFmtAmbi3D: auto&& acnmap = GetAmbiLayout(device->mAmbiLayout); auto&& n3dscale = GetAmbiScales(device->mAmbiScale); @@ -906,6 +955,7 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional> decoder_store; DecoderView decoder{}; - float speakerdists[MaxChannels]{}; + float speakerdists[MAX_OUTPUT_CHANNELS]{}; auto load_config = [device,&decoder_store,&decoder,&speakerdists](const char *config) { AmbDecConf conf{}; diff --git a/core/devformat.cpp b/core/devformat.cpp index c841b634..cbe8eaf3 100644 --- a/core/devformat.cpp +++ b/core/devformat.cpp @@ -28,6 +28,7 @@ uint ChannelsFromDevFmt(DevFmtChannels chans, uint ambiorder) noexcept case DevFmtX51: return 6; case DevFmtX61: return 7; case DevFmtX71: return 8; + case DevFmtX3D71: return 8; case DevFmtAmbi3D: return (ambiorder+1) * (ambiorder+1); } return 0; @@ -57,6 +58,7 @@ const char *DevFmtChannelsString(DevFmtChannels chans) noexcept case DevFmtX51: return "5.1 Surround"; case DevFmtX61: return "6.1 Surround"; case DevFmtX71: return "7.1 Surround"; + case DevFmtX3D71: return "3D7.1 Surround"; case DevFmtAmbi3D: return "Ambisonic 3D"; } return "(unknown channels)"; diff --git a/core/devformat.h b/core/devformat.h index e6d30924..f2a372c1 100644 --- a/core/devformat.h +++ b/core/devformat.h @@ -25,6 +25,23 @@ enum Channel : unsigned char { TopBackCenter, TopBackRight, + Aux0, + Aux1, + Aux2, + Aux3, + Aux4, + Aux5, + Aux6, + Aux7, + Aux8, + Aux9, + Aux10, + Aux11, + Aux12, + Aux13, + Aux14, + Aux15, + MaxChannels }; @@ -48,6 +65,7 @@ enum DevFmtChannels : unsigned char { DevFmtX51, DevFmtX61, DevFmtX71, + DevFmtX3D71, DevFmtAmbi3D, DevFmtChannelsDefault = DevFmtStereo diff --git a/docs/3D7.1.txt b/docs/3D7.1.txt index 1d40bec6..b7249c22 100644 --- a/docs/3D7.1.txt +++ b/docs/3D7.1.txt @@ -58,17 +58,10 @@ Software Setup ============== To enable 3D7.1 on OpenAL Soft, first make sure the audio device is configured -for 7.1 output. Then in the alsoft-config utility, under the Renderer tab, -select the 3D7.1.ambdec preset for the 7.1 Surround decoder configuration. And -that's it. Any applications using OpenAL Soft can take advantage of fully 3D -audio, and multi-channel sounds will be properly remixed for the speaker -layout. - -Playback can be improved by (copying and) modifying the 3D7.1.ambdec preset, -changing the specified speaker distances to match the the real distance (in -meters) from the center of the speaker array, then enable High Quality Mode in -alsoft-config. That will improve the quality when the speakers are not all -equidistant. +for 7.1 output. Then in the alsoft-config utility, for the Channels setting +choose "3D7.1 Surround" from the drop-down list. And that's it. Any application +using OpenAL Soft can take advantage of fully 3D audio, and multi-channel +sounds will be properly remixed for the speaker layout. Note that care must be taken that the audio device is not treated as a "true" 7.1 device by non-3D7.1-capable applications. In particular, the audio server diff --git a/presets/3D7.1.ambdec b/presets/3D7.1.ambdec index 66e56501..8ab0b060 100644 --- a/presets/3D7.1.ambdec +++ b/presets/3D7.1.ambdec @@ -5,6 +5,10 @@ /description 3D7-noCenter_1h1v_pinv_even_energy_rV_max_rE_2_band +# In OpenAL Soft, 3D7.1 is a distinct configuration that uses the standard 5.1 +# channels (FL, FR, FC, SL, SR), plus two auxiliary channels (AUX0, AUX1) in +# place of the rear speakers. + # Similar to the the ITU-5.1-nocenter configuration, the front-center is # declared here so that an appropriate distance may be set (for proper delaying # or attenuating of dialog and such which feed it directly). It otherwise does @@ -25,15 +29,15 @@ /opt/xover_ratio 0.000000 /speakers/{ -# id dist azim elev conn +# id dist azim elev conn #----------------------------------------------------------------------- -add_spkr FL 1.828800 51.000000 24.000000 -add_spkr FR 1.828800 -51.000000 24.000000 -add_spkr FC 1.828800 0.000000 0.000000 -add_spkr BL 1.828800 180.000000 55.000000 -add_spkr BR 1.828800 0.000000 -55.000000 -add_spkr SL 1.828800 129.000000 -24.000000 -add_spkr SR 1.828800 -129.000000 -24.000000 +add_spkr FL 1.828800 51.000000 24.000000 +add_spkr FR 1.828800 -51.000000 24.000000 +add_spkr FC 1.828800 0.000000 0.000000 +add_spkr AUX0 1.828800 180.000000 55.000000 +add_spkr AUX1 1.828800 0.000000 -55.000000 +add_spkr SL 1.828800 129.000000 -24.000000 +add_spkr SR 1.828800 -129.000000 -24.000000 /} /lfmatrix/{ diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 8a179ada..3565493e 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -86,6 +86,7 @@ static const struct NameValuePair { { "5.1 Surround", "surround51" }, { "6.1 Surround", "surround61" }, { "7.1 Surround", "surround71" }, + { "3D7.1 Surround", "surround3d71" }, { "Ambisonic, 1st Order", "ambi1" }, { "Ambisonic, 2nd Order", "ambi2" }, @@ -412,6 +413,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->decoder61Button, &QPushButton::clicked, this, &MainWindow::select61DecoderFile); connect(ui->decoder71LineEdit, &QLineEdit::textChanged, this, &MainWindow::enableApplyButton); connect(ui->decoder71Button, &QPushButton::clicked, this, &MainWindow::select71DecoderFile); + connect(ui->decoder3D71LineEdit, &QLineEdit::textChanged, this, &MainWindow::enableApplyButton); + connect(ui->decoder3D71Button, &QPushButton::clicked, this, &MainWindow::select3D71DecoderFile); connect(ui->preferredHrtfComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->hrtfStateComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); @@ -1252,6 +1255,8 @@ void MainWindow::select61DecoderFile() { selectDecoderFile(ui->decoder61LineEdit, "Select 6.1 Surround Decoder");} void MainWindow::select71DecoderFile() { selectDecoderFile(ui->decoder71LineEdit, "Select 7.1 Surround Decoder");} +void MainWindow::select3D71DecoderFile() +{ selectDecoderFile(ui->decoder3D71LineEdit, "Select 3D7.1 Surround Decoder");} void MainWindow::selectDecoderFile(QLineEdit *line, const char *caption) { QString dir{line->text()}; diff --git a/utils/alsoft-config/mainwindow.h b/utils/alsoft-config/mainwindow.h index ca53582b..f7af8eac 100644 --- a/utils/alsoft-config/mainwindow.h +++ b/utils/alsoft-config/mainwindow.h @@ -39,6 +39,7 @@ private slots: void select51DecoderFile(); void select61DecoderFile(); void select71DecoderFile(); + void select3D71DecoderFile(); void updateJackBufferSizeEdit(int size); void updateJackBufferSizeSlider(); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 84a99385..8d057679 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -668,9 +668,9 @@ configuration file. -10 - 160 + 140 551 - 161 + 231 @@ -682,10 +682,10 @@ configuration file. - 120 + 130 30 - 311 - 21 + 301 + 25 @@ -694,8 +694,8 @@ configuration file. 20 30 - 91 - 21 + 101 + 25 @@ -711,7 +711,7 @@ configuration file. 440 30 91 - 21 + 25 @@ -721,10 +721,10 @@ configuration file. - 120 - 60 - 311 - 21 + 130 + 70 + 301 + 25 @@ -732,9 +732,9 @@ configuration file. 440 - 60 + 70 91 - 21 + 25 @@ -745,9 +745,9 @@ configuration file. 20 - 60 - 91 - 21 + 70 + 101 + 25 @@ -761,9 +761,9 @@ configuration file. 20 - 90 - 91 - 21 + 110 + 101 + 25 @@ -776,10 +776,10 @@ configuration file. - 120 - 90 - 311 - 21 + 130 + 110 + 301 + 25 @@ -787,9 +787,9 @@ configuration file. 440 - 90 + 110 91 - 21 + 25 @@ -800,9 +800,9 @@ configuration file. 440 - 120 + 150 91 - 21 + 25 @@ -812,10 +812,10 @@ configuration file. - 120 - 120 - 311 - 21 + 130 + 150 + 301 + 25 @@ -823,9 +823,9 @@ configuration file. 20 - 120 - 91 - 21 + 150 + 101 + 25 @@ -835,6 +835,45 @@ configuration file. Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + 20 + 190 + 101 + 25 + + + + 3D7.1 Surround: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 130 + 190 + 301 + 25 + + + + + + + 440 + 190 + 91 + 25 + + + + Browse... + + -- cgit v1.2.3 From 201f5cb63ff8fb2781afa8afeda6a0e699f9e6c4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 17 Nov 2022 00:26:10 -0800 Subject: Update alsoft-config for new options --- utils/alsoft-config/mainwindow.cpp | 23 +++++--- utils/alsoft-config/mainwindow.ui | 117 ++++++++++++++++++++++++------------- 2 files changed, 89 insertions(+), 51 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 3565493e..8abde1fd 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -404,7 +404,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->decoderDistCompCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->decoderNFEffectsCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); auto qdsb_vcd = static_cast(&QDoubleSpinBox::valueChanged); - connect(ui->decoderNFRefDelaySpinBox, qdsb_vcd, this, &MainWindow::enableApplyButton); + connect(ui->decoderSpeakerDistSpinBox, qdsb_vcd, this, &MainWindow::enableApplyButton); connect(ui->decoderQuadLineEdit, &QLineEdit::textChanged, this, &MainWindow::enableApplyButton); connect(ui->decoderQuadButton, &QPushButton::clicked, this, &MainWindow::selectQuadDecoderFile); connect(ui->decoder51LineEdit, &QLineEdit::textChanged, this, &MainWindow::enableApplyButton); @@ -762,13 +762,14 @@ void MainWindow::loadConfig(const QString &fname) ui->decoderHQModeCheckBox->setChecked(getCheckState(settings.value("decoder/hq-mode"))); ui->decoderDistCompCheckBox->setCheckState(getCheckState(settings.value("decoder/distance-comp"))); ui->decoderNFEffectsCheckBox->setCheckState(getCheckState(settings.value("decoder/nfc"))); - double refdelay{settings.value("decoder/nfc-ref-delay", 0.0).toDouble()}; - ui->decoderNFRefDelaySpinBox->setValue(refdelay); + double speakerdist{settings.value("decoder/speaker-dist", 1.0).toDouble()}; + ui->decoderSpeakerDistSpinBox->setValue(speakerdist); ui->decoderQuadLineEdit->setText(settings.value("decoder/quad").toString()); ui->decoder51LineEdit->setText(settings.value("decoder/surround51").toString()); ui->decoder61LineEdit->setText(settings.value("decoder/surround61").toString()); ui->decoder71LineEdit->setText(settings.value("decoder/surround71").toString()); + ui->decoder3D71LineEdit->setText(settings.value("decoder/surround3d71").toString()); QStringList disabledCpuExts{settings.value("disable-cpu-exts").toStringList()}; if(disabledCpuExts.size() == 1) @@ -1028,15 +1029,16 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("decoder/hq-mode", getCheckValue(ui->decoderHQModeCheckBox)); settings.setValue("decoder/distance-comp", getCheckValue(ui->decoderDistCompCheckBox)); settings.setValue("decoder/nfc", getCheckValue(ui->decoderNFEffectsCheckBox)); - double refdelay = ui->decoderNFRefDelaySpinBox->value(); - settings.setValue("decoder/nfc-ref-delay", - (refdelay > 0.0) ? QString::number(refdelay) : QString{} + double speakerdist{ui->decoderSpeakerDistSpinBox->value()}; + settings.setValue("decoder/speaker-dist", + (speakerdist != 1.0) ? QString::number(speakerdist) : QString{} ); settings.setValue("decoder/quad", ui->decoderQuadLineEdit->text()); settings.setValue("decoder/surround51", ui->decoder51LineEdit->text()); settings.setValue("decoder/surround61", ui->decoder61LineEdit->text()); settings.setValue("decoder/surround71", ui->decoder71LineEdit->text()); + settings.setValue("decoder/surround3d71", ui->decoder3D71LineEdit->text()); QStringList strlist; if(!ui->enableSSECheckBox->isChecked()) @@ -1150,14 +1152,17 @@ void MainWindow::saveConfig(const QString &fname) const (!ui->enableEaxCheck->isEnabled() || ui->enableEaxCheck->isChecked()) ? QString{/*"true"*/} : QString{"false"}); + settings.setValue("pipewire/assume-audio", ui->pwireAssumeAudioCheckBox->isChecked() + ? QString{"true"} : QString{/*"false"*/}); + + settings.setValue("wasapi/allow-resampler", ui->wasapiResamplerCheckBox->isChecked() + ? QString{/*"true"*/} : QString{"false"}); + settings.setValue("pulse/spawn-server", getCheckValue(ui->pulseAutospawnCheckBox)); settings.setValue("pulse/allow-moves", getCheckValue(ui->pulseAllowMovesCheckBox)); settings.setValue("pulse/fix-rate", getCheckValue(ui->pulseFixRateCheckBox)); settings.setValue("pulse/adjust-latency", getCheckValue(ui->pulseAdjLatencyCheckBox)); - settings.setValue("pipewire/assume-audio", ui->pwireAssumeAudioCheckBox->isChecked() - ? QString{"true"} : QString{/*"false"*/}); - settings.setValue("jack/spawn-server", getCheckValue(ui->jackAutospawnCheckBox)); settings.setValue("jack/connect-ports", getCheckValue(ui->jackConnectPortsCheckBox)); settings.setValue("jack/rt-mix", getCheckValue(ui->jackRtMixCheckBox)); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 8d057679..659807c7 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -906,60 +906,63 @@ are set in the decoder configuration file. - -10 + 30 110 - 281 + 471 21 - The reference delay value for ambisonic output. When -Channels is set to one of the Ambisonic formats, this -option enables NFC-HOA output with the specified -Reference Delay parameter. The specified value can then -be shared with an appropriate NFC-HOA decoder to -reproduce correct near-field effects. Keep in mind that -despite being designed for higher-order ambisonics, this -applies to first-order output all the same. When left unset, -normal output is created with no near-field simulation. + Specifies the speaker distance in meters, used by the near-field control +filters with surround sound output. For ambisonic output modes, this value +is the basis for the NFC-HOA Reference Delay parameter (calculated as +delay_seconds = speaker_dist/343.3). This value is not used when a decoder +configuration is set for the output mode (since they specify the per-speaker +distances, overriding this setting), or when the NFC filters are off. - 20 + 45 0 - 171 + 111 21 - Near-Field Reference Delay: + Speaker Distance: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + - 200 + 165 0 - 81 + 101 21 - sec + meters - 4 + 2 + + + 0.100000000000000 - 1000.000000000000000 + 10.000000000000000 0.010000000000000 + + 1.000000000000000 + @@ -1259,12 +1262,17 @@ application or system to determine if it should be used. - PulseAudio + PipeWire - PipeWire + WASAPI + + + + + PulseAudio @@ -1382,7 +1390,52 @@ duplicated names are ignored. + + + + + 20 + 10 + 161 + 21 + + + + Assumes PipeWire has support for audio, allowing +the backend to initialize even when no audio devices +are reported. + + + Assume audio support + + + + + + + 20 + 10 + 191 + 21 + + + + Specifies whether to allow an extra resampler pass on the output. Enabling +this will allow the playback device to be set to a different sample rate +than the actual output can accept, causing the backend to apply its own +resampling pass after OpenAL Soft mixes the sources and processes effects +for output. + + + Allow Resampler + + + true + + + + @@ -1469,26 +1522,6 @@ drop-outs. - - - - - 20 - 10 - 161 - 21 - - - - Assumes PipeWire has support for audio, allowing -the backend to initialize even when no audio devices -are reported. - - - Assume audio support - - - -- cgit v1.2.3 From 0ed70ec4afd35277a208229aa8009d9fdf68fd3d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 8 Jan 2023 00:20:48 -0800 Subject: Update alsoft-config --- utils/alsoft-config/mainwindow.cpp | 19 +----------- utils/alsoft-config/mainwindow.ui | 60 ++++---------------------------------- 2 files changed, 7 insertions(+), 72 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 8abde1fd..09c7ca72 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -123,7 +123,7 @@ static const struct NameValuePair { { "", "" } }, stereoEncList[] = { { "Default", "" }, - { "Pan Pot", "panpot" }, + { "Basic", "panpot" }, { "UHJ", "uhj" }, { "Binaural", "hrtf" }, @@ -308,7 +308,6 @@ MainWindow::MainWindow(QWidget *parent) : for(count = 0;hrtfModeList[count].name[0];count++) { } ui->hrtfmodeSlider->setRange(0, count-1); - ui->hrtfStateComboBox->adjustSize(); #if !defined(HAVE_NEON) && !defined(HAVE_SSE) ui->cpuExtDisabledLabel->move(ui->cpuExtDisabledLabel->x(), ui->cpuExtDisabledLabel->y() - 60); @@ -417,7 +416,6 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->decoder3D71Button, &QPushButton::clicked, this, &MainWindow::select3D71DecoderFile); connect(ui->preferredHrtfComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); - connect(ui->hrtfStateComboBox, qcb_cicint, this, &MainWindow::enableApplyButton); connect(ui->hrtfmodeSlider, &QSlider::valueChanged, this, &MainWindow::updateHrtfModeLabel); connect(ui->hrtfAddButton, &QPushButton::clicked, this, &MainWindow::addHrtfFile); @@ -815,14 +813,6 @@ void MainWindow::loadConfig(const QString &fname) ui->hrtfFileList->addItems(hrtf_paths); updateHrtfRemoveButton(); - 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()) @@ -1055,13 +1045,6 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("hrtf-mode", hrtfModeList[ui->hrtfmodeSlider->value()].value); - if(ui->hrtfStateComboBox->currentIndex() == 1) - settings.setValue("hrtf", "true"); - else if(ui->hrtfStateComboBox->currentIndex() == 2) - settings.setValue("hrtf", "false"); - else - settings.setValue("hrtf", QString{}); - if(ui->preferredHrtfComboBox->currentIndex() == 0) settings.setValue("default-hrtf", QString{}); else diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 659807c7..2a997995 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -116,9 +116,9 @@ float and converted to the output sample type as needed. - The output channel configuration. Note that not all backends -can properly detect the channel configuration and may default -to stereo output. + The default output channel configuration. Note that not all +backends can properly detect the channel configuration and +may default to stereo output. QComboBox::AdjustToContents @@ -436,7 +436,7 @@ frames needed for each mixing update. - Pan Pot uses standard amplitude panning (aka + Basic uses standard amplitude panning (aka pair-wise, stereo pair, etc). UHJ creates a stereo-compatible two-channel @@ -444,8 +444,8 @@ UHJ mix, which encodes some surround sound information into stereo output that can be decoded with a surround sound receiver. -Binaural applies HRTF filters to create a sense -of 3D space with headphones. +Binaural applies HRTF filters to create an +illusion of 3D placement with headphones. @@ -1090,54 +1090,6 @@ listed above. - - - - 50 - 60 - 71 - 31 - - - - HRTF Mode: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 130 - 60 - 161 - 31 - - - - Forces HRTF processing on or off, or leaves it to the -application or system to determine if it should be used. - - - QComboBox::AdjustToContentsOnFirstShow - - - - Application preference - - - - - Force on - - - - - Force off - - - -- cgit v1.2.3 From 6bd541d02e664505e3aacc643a46ecfb6919612f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 9 Jan 2023 21:30:49 -0800 Subject: Update alsoft-config with the new settings --- utils/alsoft-config/mainwindow.cpp | 16 ++++++++++------ utils/alsoft-config/mainwindow.ui | 29 ++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 09c7ca72..eb4458b2 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -463,6 +463,9 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->pulseAdjLatencyCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->pwireAssumeAudioCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + connect(ui->pwireRtMixCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); + + connect(ui->wasapiResamplerCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackAutospawnCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); connect(ui->jackConnectPortsCheckBox, &QCheckBox::stateChanged, this, &MainWindow::enableApplyButton); @@ -931,8 +934,10 @@ void MainWindow::loadConfig(const QString &fname) ui->pulseFixRateCheckBox->setCheckState(getCheckState(settings.value("pulse/fix-rate"))); ui->pulseAdjLatencyCheckBox->setCheckState(getCheckState(settings.value("pulse/adjust-latency"))); - ui->pwireAssumeAudioCheckBox->setCheckState(settings.value("pipewire/assume-audio").toBool() - ? Qt::Checked : Qt::Unchecked); + ui->pwireAssumeAudioCheckBox->setCheckState(getCheckState(settings.value("pipewire/assume-audio"))); + ui->pwireRtMixCheckBox->setCheckState(getCheckState(settings.value("pipewire/rt-mix"))); + + ui->wasapiResamplerCheckBox->setCheckState(getCheckState(settings.value("wasapi/allow-resampler"))); ui->jackAutospawnCheckBox->setCheckState(getCheckState(settings.value("jack/spawn-server"))); ui->jackConnectPortsCheckBox->setCheckState(getCheckState(settings.value("jack/connect-ports"))); @@ -1135,11 +1140,10 @@ void MainWindow::saveConfig(const QString &fname) const (!ui->enableEaxCheck->isEnabled() || ui->enableEaxCheck->isChecked()) ? QString{/*"true"*/} : QString{"false"}); - settings.setValue("pipewire/assume-audio", ui->pwireAssumeAudioCheckBox->isChecked() - ? QString{"true"} : QString{/*"false"*/}); + settings.setValue("pipewire/assume-audio", getCheckValue(ui->pwireAssumeAudioCheckBox)); + settings.setValue("pipewire/rt-mix", getCheckValue(ui->pwireRtMixCheckBox)); - settings.setValue("wasapi/allow-resampler", ui->wasapiResamplerCheckBox->isChecked() - ? QString{/*"true"*/} : QString{"false"}); + settings.setValue("wasapi/allow-resampler", getCheckValue(ui->wasapiResamplerCheckBox)); settings.setValue("pulse/spawn-server", getCheckValue(ui->pulseAutospawnCheckBox)); settings.setValue("pulse/allow-moves", getCheckValue(ui->pulseAllowMovesCheckBox)); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 2a997995..b959cf74 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -1360,6 +1360,33 @@ are reported. Assume audio support + + true + + + + + + 20 + 40 + 161 + 21 + + + + Renders samples directly in the real-time +processing callback. This allows for lower +latency and less overall CPU utilization, but +can increase the risk of underruns when +increasing the amount of processing the +mixer needs to do. + + + Real-time Mixing + + + true + @@ -1382,7 +1409,7 @@ for output. Allow Resampler - + true -- cgit v1.2.3 From 0526ecd2f95877b167293e50ab8ce0ce614d03f4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 15 Jan 2023 13:43:27 -0800 Subject: clang-tidy cleanups (#800) * clang-tidy: use bool literals Found with modernize-use-bool-literals Signed-off-by: Rosen Penev * clang-tidy: replace std::bind with lambdas Found with modernize-avoid-bind Signed-off-by: Rosen Penev * clang-tidy: use data() instead of pointer stuff Found with readability-container-data-pointe Signed-off-by: Rosen Penev * clang-tidy: use empty() Found with readability-container-size-empty Signed-off-by: Rosen Penev * clang-tidy: remove static in anon namespace Found with readability-static-definition-in-anonymous-namespace Signed-off-by: Rosen Penev * clang-tidy: remove const return Found with readability-const-return-type Signed-off-by: Rosen Penev Signed-off-by: Rosen Penev --- al/effects/chorus.cpp | 2 +- alc/alc.cpp | 2 +- alc/alconfig.cpp | 2 +- alc/alu.cpp | 4 ++-- alc/backends/alsa.cpp | 8 ++++---- alc/backends/jack.cpp | 2 +- alc/backends/pulseaudio.cpp | 10 +++++----- alc/backends/wave.cpp | 2 +- alc/context.cpp | 2 +- alc/panning.cpp | 10 +++++----- common/alcomplex.cpp | 2 +- core/ambdec.cpp | 2 +- core/cpu_caps.cpp | 2 +- core/except.cpp | 2 +- core/hrtf.cpp | 2 +- core/mastering.cpp | 14 +++++++------- core/mixer/mixer_sse.cpp | 22 +++++++++++----------- utils/alsoft-config/mainwindow.cpp | 32 ++++++++++++++++---------------- utils/makemhr/makemhr.cpp | 2 +- utils/uhjencoder.cpp | 4 ++-- 20 files changed, 64 insertions(+), 64 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index a05ec10b..eec67d46 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -149,7 +149,7 @@ void Chorus_getParamf(const EffectProps *props, ALenum param, float *val) void Chorus_getParamfv(const EffectProps *props, ALenum param, float *vals) { Chorus_getParamf(props, param, vals); } -const EffectProps genDefaultChorusProps() noexcept +EffectProps genDefaultChorusProps() noexcept { EffectProps props{}; props.Chorus.Waveform = *WaveformFromEnum(AL_CHORUS_DEFAULT_WAVEFORM); diff --git a/alc/alc.cpp b/alc/alc.cpp index a7c36d5c..bf428e07 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1621,7 +1621,7 @@ std::unique_ptr CreateDeviceLimiter(const ALCdevice *device, const f * to jump forward or back. Must not be called while the device is running/ * mixing. */ -static inline void UpdateClockBase(ALCdevice *device) +inline void UpdateClockBase(ALCdevice *device) { IncrementRef(device->MixCount); device->ClockBase += nanoseconds{seconds{device->SamplesDone}} / device->Frequency; diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp index 14b2580d..b0544b89 100644 --- a/alc/alconfig.cpp +++ b/alc/alconfig.cpp @@ -140,7 +140,7 @@ void LoadConfigFromFile(std::istream &f) if(buffer[0] == '[') { - char *line{&buffer[0]}; + auto line = const_cast(buffer.data()); char *section = line+1; char *endsection; diff --git a/alc/alu.cpp b/alc/alu.cpp index cb732738..a171067a 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -866,7 +866,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * scaling. */ std::transform(coeffs.begin(), coeffs.end(), coeffs.begin(), - std::bind(std::multiplies{}, _1, (1.0f-coverage)*scales[0])); + [coverage, &scales](auto a){ return a * ((1.0f-coverage)*scales[0]); }); if(!(coverage > 0.0f)) { @@ -1966,7 +1966,7 @@ void ApplyDistanceComp(const al::span Samples, const size_t Sam auto delay_start = std::swap_ranges(inout, inout_end, distbuf); std::rotate(distbuf, delay_start, distbuf + base); } - std::transform(inout, inout_end, inout, std::bind(std::multiplies{}, _1, gain)); + std::transform(inout, inout_end, inout, [gain](auto a){ return a * gain; }); } } diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index e495a34d..d620a83c 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -132,7 +132,7 @@ constexpr char alsaDevice[] = "ALSA Default"; MAGIC(snd_card_next); \ MAGIC(snd_config_update_free_global) -static void *alsa_handle; +void *alsa_handle; #define MAKE_FUNC(f) decltype(f) * p##f ALSA_FUNCS(MAKE_FUNC); #undef MAKE_FUNC @@ -330,7 +330,7 @@ al::vector probe_devices(snd_pcm_stream_t stream) ConfigValueStr(nullptr, "alsa", name.c_str()).value_or(main_prefix)}; int dev{-1}; - while(1) + while(true) { if(snd_ctl_pcm_next_device(handle, &dev) < 0) ERR("snd_ctl_pcm_next_device failed\n"); @@ -692,7 +692,7 @@ bool AlsaPlayback::reset() break; } - bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", 1)}; + bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", true)}; uint periodLen{static_cast(mDevice->UpdateSize * 1000000_u64 / mDevice->Frequency)}; uint bufferLen{static_cast(mDevice->BufferSize * 1000000_u64 / mDevice->Frequency)}; uint rate{mDevice->Frequency}; @@ -750,7 +750,7 @@ bool AlsaPlayback::reset() else mDevice->FmtChans = DevFmtStereo; } /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", 0) + if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", false) || !mDevice->Flags.test(FrequencyRequest)) { if(snd_pcm_hw_params_set_rate_resample(mPcmHandle, hp.get(), 0) < 0) diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 419eb7e7..95796862 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -497,7 +497,7 @@ void JackPlayback::open(const char *name) mPortPattern = iter->mPattern; } - mRTMixing = GetConfigValueBool(name, "jack", "rt-mix", 1); + mRTMixing = GetConfigValueBool(name, "jack", "rt-mix", true); jack_set_process_callback(mClient, mRTMixing ? &JackPlayback::processRtC : &JackPlayback::processC, this); diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 3b235c78..9b7e2c08 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -776,7 +776,7 @@ void PulsePlayback::open(const char *name) pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_FIX_FORMAT | PA_STREAM_FIX_RATE | PA_STREAM_FIX_CHANNELS}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; pa_sample_spec spec{}; @@ -834,9 +834,9 @@ bool PulsePlayback::reset() pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_EARLY_REQUESTS}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; - if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "adjust-latency", 0)) + if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "adjust-latency", false)) { /* ADJUST_LATENCY can't be specified with EARLY_REQUESTS, for some * reason. So if the user wants to adjust the overall device latency, @@ -845,7 +845,7 @@ bool PulsePlayback::reset() flags &= ~PA_STREAM_EARLY_REQUESTS; flags |= PA_STREAM_ADJUST_LATENCY; } - if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "fix-rate", 0) + if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "fix-rate", false) || !mDevice->Flags.test(FrequencyRequest)) flags |= PA_STREAM_FIX_RATE; @@ -1190,7 +1190,7 @@ void PulseCapture::open(const char *name) mAttr.fragsize = minu(samples, 50*mDevice->Frequency/1000) * frame_size; pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_ADJUST_LATENCY}; - if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 1)) + if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", true)) flags |= PA_STREAM_DONT_MOVE; TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)"); diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index f97f42f5..1b40640c 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -234,7 +234,7 @@ bool WaveBackend::reset() fseek(mFile, 0, SEEK_SET); clearerr(mFile); - if(GetConfigValueBool(nullptr, "wave", "bformat", 0)) + if(GetConfigValueBool(nullptr, "wave", "bformat", false)) { mDevice->FmtChans = DevFmtAmbi3D; mDevice->mAmbiOrder = 1; diff --git a/alc/context.cpp b/alc/context.cpp index f9aec221..b1b95321 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -230,7 +230,7 @@ bool ALCcontext::deinit() * given context. */ std::copy_if(oldarray->begin(), oldarray->end(), newarray->begin(), - std::bind(std::not_equal_to<>{}, _1, this)); + [this](auto a){ return a != this; }); /* Store the new context array in the device. Wait for any current mix * to finish before deleting the old array. diff --git a/alc/panning.cpp b/alc/panning.cpp index 60b6cbf4..62d745f1 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -232,7 +232,7 @@ void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, uint order, bool is3d static const uint chans_per_order3d[MaxAmbiOrder+1]{ 1, 3, 5, 7 }; /* NFC is only used when AvgSpeakerDist is greater than 0. */ - if(!device->getConfigValueBool("decoder", "nfc", 0) || !(ctrl_dist > 0.0f)) + if(!device->getConfigValueBool("decoder", "nfc", false) || !(ctrl_dist > 0.0f)) return; device->AvgSpeakerDist = clampf(ctrl_dist, 0.1f, 10.0f); @@ -252,7 +252,7 @@ void InitDistanceComp(ALCdevice *device, const al::span channels, { const float maxdist{std::accumulate(std::begin(dists), std::end(dists), 0.0f, maxf)}; - if(!device->getConfigValueBool("decoder", "distance-comp", 1) || !(maxdist > 0.0f)) + if(!device->getConfigValueBool("decoder", "distance-comp", true) || !(maxdist > 0.0f)) return; const auto distSampleScale = static_cast(device->Frequency) / SpeedOfSoundMetersPerSec; @@ -339,7 +339,7 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf, switch(conf->CoeffScale) { - case AmbDecScale::Unset: ASSUME(0); break; + case AmbDecScale::Unset: ASSUME(false); break; case AmbDecScale::N3D: decoder.mScaling = DevAmbiScaling::N3D; break; case AmbDecScale::SN3D: decoder.mScaling = DevAmbiScaling::SN3D; break; case AmbDecScale::FuMa: decoder.mScaling = DevAmbiScaling::FuMa; break; @@ -1007,8 +1007,8 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optionalRealOut.ChannelIndex[FrontCenter] != INVALID_CHANNEL_INDEX && device->RealOut.ChannelIndex[FrontLeft] != INVALID_CHANNEL_INDEX && device->RealOut.ChannelIndex[FrontRight] != INVALID_CHANNEL_INDEX - && device->getConfigValueBool(nullptr, "front-stablizer", 0) != 0}; - const bool hqdec{device->getConfigValueBool("decoder", "hq-mode", 1) != 0}; + && device->getConfigValueBool(nullptr, "front-stablizer", false) != 0}; + const bool hqdec{device->getConfigValueBool("decoder", "hq-mode", true) != 0}; InitPanning(device, hqdec, stablize, decoder); if(decoder) { diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp index c4ff8fd9..2e3e0a60 100644 --- a/common/alcomplex.cpp +++ b/common/alcomplex.cpp @@ -158,7 +158,7 @@ void complex_hilbert(const al::span> buffer) *bufiter *= inverse_size; ++bufiter; bufiter = std::transform(bufiter, halfiter, bufiter, - std::bind(std::multiplies<>{}, _1, 2.0*inverse_size)); + [inverse_size](auto a){ return a * (2.0 * inverse_size); }); *bufiter *= inverse_size; ++bufiter; std::fill(bufiter, buffer.end(), std::complex{}); diff --git a/core/ambdec.cpp b/core/ambdec.cpp index 52a1df05..5e2de6af 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -53,7 +53,7 @@ al::optional make_error(size_t linenum, const char *fmt, ...) auto &str = ret.emplace(); str.resize(256); - int printed{std::snprintf(&str[0], str.length(), "Line %zu: ", linenum)}; + int printed{std::snprintf(const_cast(str.data()), str.length(), "Line %zu: ", linenum)}; if(printed < 0) printed = 0; auto plen = std::min(static_cast(printed), str.length()); diff --git a/core/cpu_caps.cpp b/core/cpu_caps.cpp index 103d2437..d4b4d86c 100644 --- a/core/cpu_caps.cpp +++ b/core/cpu_caps.cpp @@ -32,7 +32,7 @@ using reg_type = unsigned int; inline std::array get_cpuid(unsigned int f) { std::array ret{}; - __get_cpuid(f, &ret[0], &ret[1], &ret[2], &ret[3]); + __get_cpuid(f, ret.data(), &ret[1], &ret[2], &ret[3]); return ret; } #define CAN_GET_CPUID diff --git a/core/except.cpp b/core/except.cpp index f3d80d59..ba4759a3 100644 --- a/core/except.cpp +++ b/core/except.cpp @@ -21,7 +21,7 @@ void base_exception::setMessage(const char* msg, std::va_list args) if(msglen > 0) [[likely]] { mMessage.resize(static_cast(msglen)+1); - std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2); + std::vsnprintf(const_cast(mMessage.data()), mMessage.length(), msg, args2); mMessage.pop_back(); } va_end(args2); diff --git a/core/hrtf.cpp b/core/hrtf.cpp index 28179189..ec42cbf4 100644 --- a/core/hrtf.cpp +++ b/core/hrtf.cpp @@ -257,7 +257,7 @@ void HrtfStore::getCoeffs(float elevation, float azimuth, float distance, float delays[1] = fastf2u(d * float{1.0f/HrirDelayFracOne}); /* Calculate the blended HRIR coefficients. */ - float *coeffout{al::assume_aligned<16>(&coeffs[0][0])}; + float *coeffout{al::assume_aligned<16>(coeffs[0].data())}; coeffout[0] = PassthruCoeff * (1.0f-dirfact); coeffout[1] = PassthruCoeff * (1.0f-dirfact); std::fill_n(coeffout+2, size_t{HrirLength-1}*2, 0.0f); diff --git a/core/mastering.cpp b/core/mastering.cpp index a4f66fbb..88a0b5e0 100644 --- a/core/mastering.cpp +++ b/core/mastering.cpp @@ -66,7 +66,7 @@ float UpdateSlidingHold(SlidingHold *Hold, const uint i, const float in) goto found_place; } while(lowerIndex--); lowerIndex = mask; - } while(1); + } while(true); found_place: lowerIndex = (lowerIndex + 1) & mask; @@ -87,10 +87,10 @@ void ShiftSlidingHold(SlidingHold *Hold, const uint n) if(exp_last-exp_begin < 0) { std::transform(exp_begin, std::end(Hold->mExpiries), exp_begin, - std::bind(std::minus<>{}, _1, n)); + [n](auto a){ return a - n; }); exp_begin = std::begin(Hold->mExpiries); } - std::transform(exp_begin, exp_last+1, exp_begin, std::bind(std::minus<>{}, _1, n)); + std::transform(exp_begin, exp_last+1, exp_begin, [n](auto a){ return a - n; }); } @@ -121,7 +121,7 @@ void LinkChannels(Compressor *Comp, const uint SamplesToDo, const FloatBufferLin * it uses an instantaneous squared peak detector and a squared RMS detector * both with 200ms release times. */ -static void CrestDetector(Compressor *Comp, const uint SamplesToDo) +void CrestDetector(Compressor *Comp, const uint SamplesToDo) { const float a_crest{Comp->mCrestCoeff}; float y2_peak{Comp->mLastPeakSq}; @@ -155,7 +155,7 @@ void PeakDetector(Compressor *Comp, const uint SamplesToDo) /* Clamp the minimum amplitude to near-zero and convert to logarithm. */ auto side_begin = std::begin(Comp->mSideChain) + Comp->mLookAhead; std::transform(side_begin, side_begin+SamplesToDo, side_begin, - [](const float s) -> float { return std::log(maxf(0.000001f, s)); }); + [](auto s) { return std::log(maxf(0.000001f, s)); }); } /* An optional hold can be used to extend the peak detector so it can more @@ -404,7 +404,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer) { float *buffer{al::assume_aligned<16>(input.data())}; std::transform(buffer, buffer+SamplesToDo, buffer, - std::bind(std::multiplies{}, _1, preGain)); + [preGain](auto a){ return a * preGain; }); }; std::for_each(OutBuffer, OutBuffer+numChans, apply_gain); } @@ -430,7 +430,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer) float *buffer{al::assume_aligned<16>(input.data())}; const float *gains{al::assume_aligned<16>(&sideChain[0])}; std::transform(gains, gains+SamplesToDo, buffer, buffer, - std::bind(std::multiplies{}, _1, _2)); + [](auto a, auto b){ return a * b; }); }; std::for_each(OutBuffer, OutBuffer+numChans, apply_comp); diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp index 6baad7fb..1b0d1386 100644 --- a/core/mixer/mixer_sse.cpp +++ b/core/mixer/mixer_sse.cpp @@ -40,36 +40,36 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const size_t IrSize, const Cons { for(size_t i{0};i < IrSize;i += 2) { - const __m128 coeffs{_mm_load_ps(&Coeffs[i][0])}; - __m128 vals{_mm_load_ps(&Values[i][0])}; + const __m128 coeffs{_mm_load_ps(Coeffs[i].data())}; + __m128 vals{_mm_load_ps(Values[i].data())}; vals = MLA4(vals, lrlr, coeffs); - _mm_store_ps(&Values[i][0], vals); + _mm_store_ps(Values[i].data(), vals); } } else { __m128 imp0, imp1; - __m128 coeffs{_mm_load_ps(&Coeffs[0][0])}; - __m128 vals{_mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64*>(&Values[0][0]))}; + __m128 coeffs{_mm_load_ps(Coeffs[0].data())}; + __m128 vals{_mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64*>(Values[0].data()))}; imp0 = _mm_mul_ps(lrlr, coeffs); vals = _mm_add_ps(imp0, vals); - _mm_storel_pi(reinterpret_cast<__m64*>(&Values[0][0]), vals); + _mm_storel_pi(reinterpret_cast<__m64*>(Values[0].data()), vals); size_t td{((IrSize+1)>>1) - 1}; size_t i{1}; do { - coeffs = _mm_load_ps(&Coeffs[i+1][0]); - vals = _mm_load_ps(&Values[i][0]); + coeffs = _mm_load_ps(Coeffs[i+1].data()); + vals = _mm_load_ps(Values[i].data()); imp1 = _mm_mul_ps(lrlr, coeffs); imp0 = _mm_shuffle_ps(imp0, imp1, _MM_SHUFFLE(1, 0, 3, 2)); vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Values[i][0], vals); + _mm_store_ps(Values[i].data(), vals); imp0 = imp1; i += 2; } while(--td); - vals = _mm_loadl_pi(vals, reinterpret_cast<__m64*>(&Values[i][0])); + vals = _mm_loadl_pi(vals, reinterpret_cast<__m64*>(Values[i].data())); imp0 = _mm_movehl_ps(imp0, imp0); vals = _mm_add_ps(imp0, vals); - _mm_storel_pi(reinterpret_cast<__m64*>(&Values[i][0]), vals); + _mm_storel_pi(reinterpret_cast<__m64*>(Values[i].data()), vals); } } diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index eb4458b2..39b773af 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -21,7 +21,7 @@ namespace { -static const struct { +const struct { char backend_name[16]; char full_string[32]; } backendList[] = { @@ -75,7 +75,7 @@ static const struct { { "", "" } }; -static const struct NameValuePair { +const struct NameValuePair { const char name[64]; const char value[16]; } speakerModeList[] = { @@ -146,7 +146,7 @@ static const struct NameValuePair { { "", "" } }; -static QString getDefaultConfigName() +QString getDefaultConfigName() { #ifdef Q_OS_WIN32 static const char fname[] = "alsoft.ini"; @@ -173,7 +173,7 @@ static QString getDefaultConfigName() return fname; } -static QString getBaseDataPath() +QString getBaseDataPath() { #ifdef Q_OS_WIN32 auto get_appdata_path = []() noexcept -> QString @@ -196,7 +196,7 @@ static QString getBaseDataPath() return base; } -static QStringList getAllDataPaths(const QString &append) +QStringList getAllDataPaths(const QString &append) { QStringList list; list.append(getBaseDataPath()); @@ -227,7 +227,7 @@ static QStringList getAllDataPaths(const QString &append) } template -static QString getValueFromName(const NameValuePair (&list)[N], const QString &str) +QString getValueFromName(const NameValuePair (&list)[N], const QString &str) { for(size_t i = 0;i < N-1;i++) { @@ -238,7 +238,7 @@ static QString getValueFromName(const NameValuePair (&list)[N], const QString &s } template -static QString getNameFromValue(const NameValuePair (&list)[N], const QString &str) +QString getNameFromValue(const NameValuePair (&list)[N], const QString &str) { for(size_t i = 0;i < N-1;i++) { @@ -844,7 +844,7 @@ void MainWindow::loadConfig(const QString &fname) ui->enabledBackendList->clear(); ui->disabledBackendList->clear(); QStringList drivers{settings.value("drivers").toStringList()}; - if(drivers.size() == 0) + if(drivers.empty()) ui->backendCheckBox->setChecked(true); else { @@ -1091,7 +1091,7 @@ void MainWindow::saveConfig(const QString &fname) const } } } - if(strlist.size() == 0 && !ui->backendCheckBox->isChecked()) + if(strlist.empty() && !ui->backendCheckBox->isChecked()) strlist.append("-all"); else if(ui->backendCheckBox->isChecked()) strlist.append(QString{}); @@ -1322,7 +1322,7 @@ void MainWindow::removeHrtfFile() void MainWindow::updateHrtfRemoveButton() { - ui->hrtfRemoveButton->setEnabled(ui->hrtfFileList->selectedItems().size() != 0); + ui->hrtfRemoveButton->setEnabled(!ui->hrtfFileList->selectedItems().empty()); } void MainWindow::showEnabledBackendMenu(QPoint pt) @@ -1333,7 +1333,7 @@ void MainWindow::showEnabledBackendMenu(QPoint pt) QMenu ctxmenu; QAction *removeAction{ctxmenu.addAction(QIcon::fromTheme("list-remove"), "Remove")}; - if(ui->enabledBackendList->selectedItems().size() == 0) + if(ui->enabledBackendList->selectedItems().empty()) removeAction->setEnabled(false); ctxmenu.addSeparator(); for(size_t i = 0;backendList[i].backend_name[0];i++) @@ -1341,8 +1341,8 @@ void MainWindow::showEnabledBackendMenu(QPoint pt) 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) + if(!ui->enabledBackendList->findItems(backend, Qt::MatchFixedString).empty() || + !ui->disabledBackendList->findItems(backend, Qt::MatchFixedString).empty()) action->setEnabled(false); } @@ -1371,7 +1371,7 @@ void MainWindow::showDisabledBackendMenu(QPoint pt) QMenu ctxmenu; QAction *removeAction{ctxmenu.addAction(QIcon::fromTheme("list-remove"), "Remove")}; - if(ui->disabledBackendList->selectedItems().size() == 0) + if(ui->disabledBackendList->selectedItems().empty()) removeAction->setEnabled(false); ctxmenu.addSeparator(); for(size_t i = 0;backendList[i].backend_name[0];i++) @@ -1379,8 +1379,8 @@ void MainWindow::showDisabledBackendMenu(QPoint pt) 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) + if(!ui->disabledBackendList->findItems(backend, Qt::MatchFixedString).empty() || + !ui->enabledBackendList->findItems(backend, Qt::MatchFixedString).empty()) action->setEnabled(false); } diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp index e0911438..e3585530 100644 --- a/utils/makemhr/makemhr.cpp +++ b/utils/makemhr/makemhr.cpp @@ -1024,7 +1024,7 @@ static void NormalizeHrirs(HrirDataT *hData) /* Now scale all IRs by the given factor. */ auto proc_channel = [irSize,factor](double *ir) - { std::transform(ir, ir+irSize, ir, std::bind(std::multiplies{}, _1, factor)); }; + { std::transform(ir, ir+irSize, ir, [factor](auto a){ return a * factor; }}; auto proc_azi = [channels,proc_channel](HrirAzT &azi) { std::for_each(azi.mIrs, azi.mIrs+channels, proc_channel); }; auto proc_elev = [proc_azi](HrirEvT &elev) diff --git a/utils/uhjencoder.cpp b/utils/uhjencoder.cpp index 9af1b3cf..34698993 100644 --- a/utils/uhjencoder.cpp +++ b/utils/uhjencoder.cpp @@ -349,7 +349,7 @@ int main(int argc, char **argv) else { std::string mapstr; - if(chanmap.size() > 0) + if(!chanmap.empty()) { mapstr = std::to_string(chanmap[0]); for(int idx : al::span{chanmap}.subspan<1>()) @@ -414,7 +414,7 @@ int main(int argc, char **argv) auto encoder = std::make_unique(); auto splbuf = al::vector(static_cast(9+ininfo.channels)+uhjchans); - auto ambmem = al::span{&splbuf[0], 4}; + auto ambmem = al::span{splbuf.data(), 4}; auto encmem = al::span{&splbuf[4], 4}; auto srcmem = al::span{splbuf[8].data(), BufferLineSize}; auto outmem = al::span{splbuf[9].data(), BufferLineSize*uhjchans}; -- cgit v1.2.3 From dc61e7c59d24fb4422c3ea939eeb32ef2f4038c4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 27 Jan 2023 02:39:42 -0800 Subject: Change the default resampler to cubic This has notably better quality than linear, while still being faster than bsinc. --- alsoftrc.sample | 2 +- core/voice.cpp | 2 +- utils/alsoft-config/mainwindow.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'utils/alsoft-config/mainwindow.cpp') diff --git a/alsoftrc.sample b/alsoftrc.sample index cdff5db5..d894791e 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -188,7 +188,7 @@ # between 24 and 48 points, with anti-aliasing) # fast_bsinc24 - same as bsinc24, except without interpolation between down- # sampling scales -#resampler = linear +#resampler = cubic ## rt-prio: (global) # Sets the real-time priority value for the mixing thread. Not all drivers may diff --git a/core/voice.cpp b/core/voice.cpp index 5fa9f677..972628a5 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -55,7 +55,7 @@ static_assert(!(sizeof(DeviceBase::MixerBufferLine)&15), "DeviceBase::MixerBufferLine must be a multiple of 16 bytes"); static_assert(!(MaxResamplerEdge&3), "MaxResamplerEdge is not a multiple of 4"); -Resampler ResamplerDefault{Resampler::Linear}; +Resampler ResamplerDefault{Resampler::Cubic}; namespace { diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 39b773af..bee7022f 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -107,8 +107,8 @@ const struct NameValuePair { }, resamplerList[] = { { "Point", "point" }, { "Linear", "linear" }, - { "Default (Linear)", "" }, { "Cubic Spline", "cubic" }, + { "Default (Cubic Spline)", "" }, { "11th order Sinc (fast)", "fast_bsinc12" }, { "11th order Sinc", "bsinc12" }, { "23rd order Sinc (fast)", "fast_bsinc24" }, -- cgit v1.2.3