changeset 26312:43fe46da690b

AUDIO_DRAIN makes no sense directly after opening the device, but it should be done in uninit.
author reimar
date Mon, 07 Apr 2008 17:32:44 +0000
parents a3d7fc4f186e
children 270df0673cc2
files libao2/ao_sun.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_sun.c	Mon Apr 07 08:28:54 2008 +0000
+++ b/libao2/ao_sun.c	Mon Apr 07 17:32:44 2008 +0000
@@ -478,8 +478,6 @@
 	return 0;
     }
 
-    ioctl(audio_fd, AUDIO_DRAIN, 0);
-
     if (af2sunfmt(format) == AUDIO_ENCODING_NONE)
       format = AF_FORMAT_S16_NE;
 
@@ -583,6 +581,8 @@
     // throw away buffered data in the audio driver's STREAMS queue
     if (immed)
 	flush_audio(audio_fd);
+    else
+	ioctl(audio_fd, AUDIO_DRAIN, 0);
     close(audio_fd);
 }