From caeb772894aa538a113d92ac41e59163054db68f Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 17 Jan 2023 12:20:41 +0100 Subject: [PATCH] SoundPlayer: Specify the total sample count in playback device samples The current sample count is already reported like that, so this fixes a mismatch between current and total. In the future, we should look into abstracting this away properly instead of requiring the user to think of converting it manually everywhere. --- Userland/Applications/SoundPlayer/Player.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index 0b3adf1384..2687d58c0d 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -64,7 +64,8 @@ void Player::play_file_path(DeprecatedString const& path) m_loaded_filename = path; - total_samples_changed(loader->total_samples()); + // TODO: The combination of sample count, sample rate, and sample data should be properly abstracted for the source and the playback device. + total_samples_changed(loader->total_samples() * (static_cast(loader->sample_rate()) / m_playback_manager.device_sample_rate())); m_playback_manager.set_loader(move(loader)); file_name_changed(path);