1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:55:08 +00:00

SoundPlayer: Fix glitchy visualization on pause/stop

Previously when pausing or stoping a track in SoundPlayer,
the visualizations would glitch out. This was caused by them
being updated with the same buffer over and over.
With this patch a pause action will freeze the visualization at the
point of the pause and a stop action will reset the visualization
so it displays nothing until a track is started.
This commit is contained in:
Joel Petersson 2023-05-01 19:07:37 +02:00 committed by Jelle Raaijmakers
parent f1d8e55168
commit e98315de6b
2 changed files with 6 additions and 1 deletions

View file

@ -213,6 +213,10 @@ void SoundPlayerWidgetAdvancedView::play_state_changed(Player::PlayState state)
m_stop_action->set_enabled(state != PlayState::Stopped && state != PlayState::NoFileLoaded);
m_playback_progress_slider->set_enabled(state != PlayState::NoFileLoaded);
if (state == PlayState::Stopped) {
m_playback_progress_slider->set_value(m_playback_progress_slider->min(), GUI::AllowCallback::No);
m_visualization->reset_buffer();
}
}
void SoundPlayerWidgetAdvancedView::loop_mode_changed(Player::LoopMode)