commit 41e4af5e47028a3544d69dbaea5ebaa276666daa
parent ebd7c8b9e33ca96f47ad30c8f58cfab44e3e6b9d
Author: Jean Schurger <jean@schurger.org>
Date: Wed, 1 Apr 2026 09:08:53 -0400
Set waveform resolution to 1 sample per 100ms of audio
Each bar in the waveform now represents exactly 0.1 second of music,
scaling with track duration instead of a fixed 600 samples.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/composeApp/src/commonMain/kotlin/ubi2/sonodrill/ui/player/player_view_model.kt b/composeApp/src/commonMain/kotlin/ubi2/sonodrill/ui/player/player_view_model.kt
@@ -41,7 +41,10 @@ class PlayerViewModel(
_marks.value = repo.get_marks(file.id)
if (file.last_position_ms > 0) player.seek(file.last_position_ms)
if (file.last_speed != 1f) player.set_speed(file.last_speed)
- scope.launch { _waveform.value = extract_waveform(file.uri, 600) }
+ scope.launch {
+ val dur = duration.first { it > 0 }
+ _waveform.value = extract_waveform(file.uri, (dur / 100).toInt().coerceAtLeast(1))
+ }
start_auto_save()
}