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

SoundPlayer: Optionally allow playback to loop indefinitely

This commit is contained in:
Brendan Coles 2020-11-01 06:19:49 +00:00 committed by Andreas Kling
parent 75dec15b43
commit 90a30f694d
3 changed files with 19 additions and 1 deletions

View file

@ -73,6 +73,11 @@ void PlaybackManager::play()
set_paused(false);
}
void PlaybackManager::loop(bool loop)
{
m_loop = loop;
}
void PlaybackManager::seek(const int position)
{
if (!m_loader)
@ -166,7 +171,10 @@ void PlaybackManager::next_buffer()
if (!m_next_buffer) {
if (!m_connection->get_remaining_samples() && !m_paused) {
dbgln("Exhausted samples :^)");
stop();
if (m_loop)
seek(0);
else
stop();
}
return;