diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/audio.c b/src/audio.c index cf2b54c20..728f93718 100644 --- a/src/audio.c +++ b/src/audio.c @@ -223,7 +223,10 @@ inline void syncAudioDevicesEnabledArrays() { if(myAudioDevicesEnabled[i]) { openAudioOutput(audioOutputArray[i], &audio_format); } - else closeAudioOutput(audioOutputArray[i]); + else { + dropBufferedAudioOutput(audioOutputArray[i]); + closeAudioOutput(audioOutputArray[i]); + } } } @@ -312,6 +315,23 @@ int isAudioDeviceOpen() { return audioOpened; } +void dropBufferedAudio() { + int i; + + if(0 != memcmp(pdAudioDevicesEnabled, myAudioDevicesEnabled, + AUDIO_MAX_DEVICES)) + { + syncAudioDevicesEnabledArrays(); + } + + audioBufferPos = 0; + + for(i = 0; i < audioOutputArraySize; i++) { + if(!myAudioDevicesEnabled[i]) continue; + dropBufferedAudioOutput(audioOutputArray[i]); + } +} + void closeAudioDevice() { int i; |