mirror of https://github.com/LIJI32/SameBoy.git
Make sure that audio resumes playing after clearing the queue
This commit is contained in:
parent
7a24073f6d
commit
8fa02e0ea2
|
@ -119,17 +119,6 @@ static bool _audio_is_playing(void)
|
|||
return state == AL_PLAYING;
|
||||
}
|
||||
|
||||
static void _audio_clear_queue(void)
|
||||
{
|
||||
alSourceStop(al_source);
|
||||
if (AL_ERROR(NULL)) {
|
||||
_audio_deinit();
|
||||
return;
|
||||
}
|
||||
|
||||
free_processed_buffers();
|
||||
}
|
||||
|
||||
static void _audio_set_paused(bool paused)
|
||||
{
|
||||
if (paused) {
|
||||
|
@ -144,6 +133,25 @@ static void _audio_set_paused(bool paused)
|
|||
}
|
||||
}
|
||||
|
||||
static void _audio_clear_queue(void)
|
||||
{
|
||||
bool is_playing = _audio_is_playing();
|
||||
|
||||
// Stopping a source clears its queue
|
||||
alSourceStop(al_source);
|
||||
if (AL_ERROR(NULL)) {
|
||||
_audio_deinit();
|
||||
return;
|
||||
}
|
||||
|
||||
free_processed_buffers();
|
||||
buffer_pos = 0;
|
||||
|
||||
if (is_playing) {
|
||||
_audio_set_paused(false);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned _audio_get_frequency(void)
|
||||
{
|
||||
return sample_rate;
|
||||
|
|
Loading…
Reference in New Issue