aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-05 14:01:13 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-05 14:01:13 +0000
commit92653f847492ece39beb91d547434c9a7c5e6978 (patch)
treebd52e1367f684df9a736988acd8080f638408ee9 /src/audio.c
parent7808fea94abf1f0fef48c8891c028c83b2e0fde8 (diff)
downloadmpd-92653f847492ece39beb91d547434c9a7c5e6978.tar.gz
mpd-92653f847492ece39beb91d547434c9a7c5e6978.tar.xz
mpd-92653f847492ece39beb91d547434c9a7c5e6978.zip
implemented dropping of current buffered audio, works for oss, but there seems
to be a "blip" for alsa devices, needs more work git-svn-id: https://svn.musicpd.org/mpd/trunk@3011 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/audio.c22
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;