fix(volume): make the volume control fully fluid (de-quantize)
Volume snapped between 1% steps from two integer quantizers. UI: the volume sliders now use a 0..1000 scale so the shared int slider's round() lands on 0.1% (imperceptible). Runtime: the player volume atomic widened from integer-percent AtomicU64 to f32-bits AtomicU32 (same idiom as normalization_gain) so a continuous value no longer re-snaps on track restart / device switch / gapless. Bit-perfect untouched: 1.0f32 round-trips its bits, no gain multiply or ramp added to the protected ALSA-direct / DoP / JACK paths. cc
This commit is contained in:
4 files changed
+33
-22
No files matched your search
@@ -846,19 +846,22 @@ export component PlayerBar inherits Rectangle {
|
||||
// Large (this slider is outside any npb-mode conditional).
|
||||
// 90 -> 81.
|
||||
width: 81px;
|
||||
// 0..1000 scale: the shared int slider rounds to whole
|
||||
// steps, so a 0..100 range quantized volume to 1%.
|
||||
// 0.1% steps are imperceptible -> fluid drag.
|
||||
minimum: 0;
|
||||
maximum: 100;
|
||||
value: NowPlayingState.volume * 100;
|
||||
maximum: 1000;
|
||||
value: NowPlayingState.volume * 1000;
|
||||
changed(v) => {
|
||||
if (!root.vol-locked) {
|
||||
NowPlayingState.set-volume(v / 100.0);
|
||||
NowPlayingState.set-volume(v / 1000.0);
|
||||
}
|
||||
}
|
||||
// Persist only the final value on drag-end (avoids a
|
||||
// ui_prefs write per drag tick).
|
||||
released(v) => {
|
||||
if (!root.vol-locked) {
|
||||
NowPlayingState.persist-volume(v / 100.0);
|
||||
NowPlayingState.persist-volume(v / 1000.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user