diff options
-rw-r--r-- | Alc/ALu.c | 8 | ||||
-rw-r--r-- | Alc/panning.c | 14 | ||||
-rw-r--r-- | alsoftrc.sample | 15 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 24 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.ui | 16 |
5 files changed, 40 insertions, 37 deletions
@@ -683,8 +683,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ ALfloat x = sinf(chans[c].angle) * cosf(chans[c].elevation); coeffs[0] = clampf(-x, -0.5f, 0.5f) + 0.5f; - voice->Direct.Params[c].Gains.Target[0] = coeffs[0] * DryGain; - voice->Direct.Params[c].Gains.Target[1] = (1.0f-coeffs[0]) * DryGain; + voice->Direct.Params[c].Gains.Target[0] = sqrtf(coeffs[0]) * DryGain; + voice->Direct.Params[c].Gains.Target[1] = sqrtf(1.0f-coeffs[0]) * DryGain; for(j = 2;j < MAX_OUTPUT_CHANNELS;j++) voice->Direct.Params[c].Gains.Target[j] = 0.0f; @@ -1176,8 +1176,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ ALfloat x = -dir[0] * (0.5f * (cosf(spread*0.5f) + 1.0f)); x = clampf(x, -0.5f, 0.5f) + 0.5f; - voice->Direct.Params[0].Gains.Target[0] = x * DryGain; - voice->Direct.Params[0].Gains.Target[1] = (1.0f-x) * DryGain; + voice->Direct.Params[0].Gains.Target[0] = sqrtf(x) * DryGain; + voice->Direct.Params[0].Gains.Target[1] = sqrtf(1.0f-x) * DryGain; for(i = 2;i < MAX_OUTPUT_CHANNELS;i++) voice->Direct.Params[0].Gains.Target[i] = 0.0f; diff --git a/Alc/panning.c b/Alc/panning.c index 70355b41..72b55792 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -1143,6 +1143,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf no_hrtf: TRACE("HRTF disabled\n"); + device->Render_Mode = StereoPair; + ambiup_free(device->AmbiUp); device->AmbiUp = NULL; @@ -1154,7 +1156,6 @@ no_hrtf: { device->Bs2b = al_calloc(16, sizeof(*device->Bs2b)); bs2b_set_params(device->Bs2b, bs2blevel, device->Frequency); - device->Render_Mode = StereoPair; TRACE("BS2B enabled\n"); InitPanning(device); return; @@ -1162,13 +1163,12 @@ no_hrtf: TRACE("BS2B disabled\n"); - device->Render_Mode = NormalRender; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-panning", &mode)) + if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-encoding", &mode)) { - if(strcasecmp(mode, "paired") == 0) - device->Render_Mode = StereoPair; - else if(strcasecmp(mode, "uhj") != 0) - ERR("Unexpected stereo-panning: %s\n", mode); + if(strcasecmp(mode, "uhj") == 0) + device->Render_Mode = NormalRender; + else if(strcasecmp(mode, "panpot") != 0) + ERR("Unexpected stereo-encoding: %s\n", mode); } if(device->Render_Mode == NormalRender) { diff --git a/alsoftrc.sample b/alsoftrc.sample index df6bb326..1068e311 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -89,13 +89,14 @@ # Valid settings are auto, speakers, and headphones. #stereo-mode = auto -## stereo-panning: -# Specifies the panning method for non-HRTF stereo output. uhj (default) -# creates stereo-compatible two-channel UHJ output, which encodes some -# surround sound information, while paired uses standard pair-wise panning -# between -30 and +30 degrees. If crossfeed filters are used, uhj panning is -# disabled. -#stereo-panning = uhj +## stereo-encoding: +# Specifies the encoding method for non-HRTF stereo output. 'panpot' (default) +# uses standard amplitude panning (aka pair-wise, stereo pair, etc) between +# -30 and +30 degrees, while 'uhj' creates stereo-compatible two-channel UHJ +# output, which encodes some surround sound information into stereo output +# that can be decoded with a surround sound receiver. If crossfeed filters are +# used, UHJ is disabled. +#stereo-encoding = panpot ## ambi-format: # Specifies the channel order and normalization for the "ambi*" set of channel diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 200f6811..93641e85 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -110,10 +110,10 @@ static const struct NameValuePair { { "Headphones", "headphones" }, { "", "" } -}, stereoPanList[] = { +}, stereoEncList[] = { { "Default", "" }, + { "Pan Pot", "panpot" }, { "UHJ", "uhj" }, - { "Pair-Wise", "paired" }, { "", "" } }, ambiFormatList[] = { @@ -234,9 +234,9 @@ MainWindow::MainWindow(QWidget *parent) : for(int i = 0;stereoModeList[i].name[0];i++) ui->stereoModeCombo->addItem(stereoModeList[i].name); ui->stereoModeCombo->adjustSize(); - for(int i = 0;stereoPanList[i].name[0];i++) - ui->stereoPanningComboBox->addItem(stereoPanList[i].name); - ui->stereoPanningComboBox->adjustSize(); + for(int i = 0;stereoEncList[i].name[0];i++) + ui->stereoEncodingComboBox->addItem(stereoEncList[i].name); + ui->stereoEncodingComboBox->adjustSize(); for(int i = 0;ambiFormatList[i].name[0];i++) ui->ambiFormatComboBox->addItem(ambiFormatList[i].name); ui->ambiFormatComboBox->adjustSize(); @@ -326,7 +326,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->periodCountSlider, SIGNAL(valueChanged(int)), this, SLOT(updatePeriodCountEdit(int))); connect(ui->periodCountEdit, SIGNAL(editingFinished()), this, SLOT(updatePeriodCountSlider())); - connect(ui->stereoPanningComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(enableApplyButton())); + connect(ui->stereoEncodingComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(enableApplyButton())); connect(ui->ambiFormatComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(enableApplyButton())); connect(ui->decoderHQModeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); @@ -637,15 +637,15 @@ void MainWindow::loadConfig(const QString &fname) updatePeriodCountSlider(); } - QString stereopan = settings.value("stereo-panning").toString(); - ui->stereoPanningComboBox->setCurrentIndex(0); + QString stereopan = settings.value("stereo-encoding").toString(); + ui->stereoEncodingComboBox->setCurrentIndex(0); if(stereopan.isEmpty() == false) { - QString str = getNameFromValue(stereoPanList, stereopan); + QString str = getNameFromValue(stereoEncList, stereopan); if(!str.isEmpty()) { - int j = ui->stereoPanningComboBox->findText(str); - if(j > 0) ui->stereoPanningComboBox->setCurrentIndex(j); + int j = ui->stereoEncodingComboBox->findText(str); + if(j > 0) ui->stereoEncodingComboBox->setCurrentIndex(j); } } @@ -885,7 +885,7 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("resampler", resamplerList[ui->resamplerSlider->value()].value); settings.setValue("stereo-mode", getValueFromName(stereoModeList, ui->stereoModeCombo->currentText())); - settings.setValue("stereo-panning", getValueFromName(stereoPanList, ui->stereoPanningComboBox->currentText())); + settings.setValue("stereo-encoding", getValueFromName(stereoEncList, ui->stereoEncodingComboBox->currentText())); settings.setValue("ambi-format", getValueFromName(ambiFormatList, ui->ambiFormatComboBox->currentText())); settings.setValue("decoder/hq-mode", diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index 4db93c36..18392430 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -428,7 +428,7 @@ frames needed for each mixing update.</string> </widget> </widget> </widget> - <widget class="QComboBox" name="stereoPanningComboBox"> + <widget class="QComboBox" name="stereoEncodingComboBox"> <property name="geometry"> <rect> <x>130</x> @@ -438,11 +438,13 @@ frames needed for each mixing update.</string> </rect> </property> <property name="toolTip"> - <string>Selects the panning method for non-HRTF stereo -mixing. UHJ creates stereo-compatible two-channel -output, which encodes some surround information. -Pair-Wise uses standard pair-wise panning between --30 and +30 degrees. The default is UHJ.</string> + <string>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.</string> </property> </widget> <widget class="QLabel" name="label_19"> @@ -455,7 +457,7 @@ Pair-Wise uses standard pair-wise panning between </rect> </property> <property name="text"> - <string>Stereo Panning:</string> + <string>Stereo Encoding:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |