Skip to content

Commit

Permalink
Merge PR #6251: Backport "Merge PR #6134: FEAT(client): Positional au…
Browse files Browse the repository at this point in the history
…dio improvements"
  • Loading branch information
Krzmbrzl authored Nov 4, 2023
2 parents e095233 + 2ef5112 commit 76cdc16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/mumble/AudioConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,11 @@ AudioOutputDialog::AudioOutputDialog(Settings &st) : ConfigWidget(st) {
// Distance in cm
qsMinDistance->setRange(0, 200);
// Distance in m
qsbMinimumDistance->setRange(0.0, 50.0);
qsbMinimumDistance->setRange(0.0, 1000.0);
// Distance in cm
qsMaxDistance->setRange(10, 2000);
// Distance in m
qsbMaximumDistance->setRange(1.0, 1000.0);
qsbMaximumDistance->setRange(1.0, 10000.0);
qsMinimumVolume->setRange(0, 100);
qsbMinimumVolume->setRange(qsMinimumVolume->minimum(), qsMinimumVolume->maximum());
qsBloom->setRange(0, 75);
Expand Down Expand Up @@ -844,20 +844,32 @@ void AudioOutputDialog::on_qcbLoopback_currentIndexChanged(int v) {
void AudioOutputDialog::on_qsMinDistance_valueChanged(int value) {
QSignalBlocker blocker(qsbMinimumDistance);
qsbMinimumDistance->setValue(value / 10.0f);

// Ensure that max distance is always a least 1m larger than min distance
qsbMaximumDistance->setValue(std::max(qsbMaximumDistance->value(), (value / 10.0) + 1));
}

void AudioOutputDialog::on_qsbMinimumDistance_valueChanged(double value) {
QSignalBlocker blocker(qsMinDistance);
qsMinDistance->setValue(value * 10);

// Ensure that max distance is always a least 1m larger than min distance
qsMaxDistance->setValue(std::max(qsMaxDistance->value(), static_cast< int >(value * 10) + 1));
}

void AudioOutputDialog::on_qsMaxDistance_valueChanged(int value) {
QSignalBlocker blocker(qsbMaximumDistance);
qsbMaximumDistance->setValue(value / 10.0f);

// Ensure that max distance is always a least 1m larger than min distance
qsbMinimumDistance->setValue(std::min(qsbMinimumDistance->value(), (value / 10.0) - 1));
}
void AudioOutputDialog::on_qsbMaximumDistance_valueChanged(double value) {
QSignalBlocker blocker(qsMaxDistance);
qsMaxDistance->setValue(value * 10);

// Ensure that max distance is always a least 1m larger than min distance
qsMinDistance->setValue(std::min(qsMinDistance->value(), static_cast< int >(value * 10) - 1));
}

void AudioOutputDialog::on_qsMinimumVolume_valueChanged(int value) {
Expand Down
2 changes: 1 addition & 1 deletion src/mumble/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ struct Settings {
bool bPositionalHeadphone = false;
float fAudioMinDistance = 1.0f;
float fAudioMaxDistance = 15.0f;
float fAudioMaxDistVolume = 0.25f;
float fAudioMaxDistVolume = 0.0f;
float fAudioBloom = 0.5f;
/// Contains the settings for each individual plugin. The key in this map is the Hex-represented SHA-1
/// hash of the plugin's UTF-8 encoded absolute file-path on the hard-drive.
Expand Down

0 comments on commit 76cdc16

Please sign in to comment.