Skip to content

Commit

Permalink
FIX(client,positional-audio): Fix positional minimum and maximum dist…
Browse files Browse the repository at this point in the history
…ance constraints

8d7e1b5 added constraints to the positional distance sliders and spinner
boxes. It was decided that the maximum distance must always be at least
1m larger than the minimum and vice versa.

However, the methods which update the slider value were - incorrectly - using
+1 and -1, which only equates to 0.1m in slide space.
The subsequent update happening in the methods, which update the spinner boxes,
were now using the incorrect 0.1m change in the checks and in turn adding or subtracting 1
in spinner box space (which correctly equates to 1m in spinner box space).

Because of the order of loading operations, only the minimum slider
is affected by the problem: It would reduce by 0.9m everytime the
options dialog was loaded (and saved).

This commit fixes the problem by adding and subtracting 10 in two
of the methods which is 1m in slider space. It also slightly changes
the wording of the comments
  • Loading branch information
Hartmnt committed Oct 24, 2023
1 parent e2161d6 commit eea4dd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mumble/AudioConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,22 +866,22 @@ void AudioOutputDialog::on_qsbMinimumDistance_valueChanged(double value) {
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));
qsMaxDistance->setValue(std::max(qsMaxDistance->value(), static_cast< int >(value * 10) + 10));
}

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

void AudioOutputDialog::on_qsMinimumVolume_valueChanged(int value) {
Expand Down

0 comments on commit eea4dd8

Please sign in to comment.