Skip to content

Commit 9cfa1f7

Browse files
eriedclaude
andcommitted
fix(automation): auto-volume is boost-only, never lowers below baseline
Auto-volume is meant to raise the music as speed climbs, not pull it down. The multiplier curve allowed values below 1x (down to 0x), so a curve that dipped at low speed dragged the media volume toward zero at standstill. Clamp the multiplier to >= 1x so it can only boost the rider's baseline, never attenuate below it. Pairs with the previous restore-on-stop fix (which un-boosts back to baseline on disconnect / Stop All / disable). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GHUZZ33sT9FYS6sXiMogJc
1 parent a9b1086 commit 9cfa1f7

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

app/src/main/java/com/eried/eucplanet/service/AutomationManager.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,12 @@ class AutomationManager @Inject constructor(
145145
}
146146

147147
/**
148-
* Speed-based volume control. Multiplier curve maps speed → 0×–2×, applied to a remembered
149-
* "baseline" volume the user picks naturally. Manual slider movements rebase the baseline
150-
* so the user-visible volume is always exactly what they set, while the curve continues to
151-
* track speed from there.
148+
* Speed-based volume control. BOOST-ONLY: the multiplier is clamped to >= 1×
149+
* so it can raise the media volume as speed climbs but never pull it BELOW
150+
* the rider's own baseline (a curve dipping under 1× used to drag the volume
151+
* toward zero at standstill and leave it there - not what auto-volume is for).
152+
* Applied to a remembered baseline the rider picks naturally; manual slider
153+
* movements rebase the baseline so what they set is always the floor.
152154
*/
153155
private suspend fun evaluateVolume(settings: AppSettings) {
154156
val maxVol = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
@@ -159,7 +161,9 @@ class AutomationManager @Inject constructor(
159161

160162
val curve = parseVolumeCurve(settings.autoVolumeCurve)
161163
val speed = wheelRepository.wheelData.value.speed.absoluteValue
162-
val multiplier = pchipInterpolate(curve, speed)
164+
// Boost-only: never below 1x, so auto-volume can only raise the rider's
165+
// baseline with speed, never lower it (that was the volume-sinking bug).
166+
val multiplier = pchipInterpolate(curve, speed).coerceAtLeast(1f)
163167

164168
// Initialize baseline from the user's current volume on first tick after enable.
165169
var baseline = settings.autoVolumeBaselinePercent

0 commit comments

Comments
 (0)