changeset 28883:c3f295ceae51

Do not call waveOutReset in uninit if you should wait till playing finishes, and retry waveOutClose if it fails due to still playing.
author reimar
date Mon, 09 Mar 2009 19:15:20 +0000
parents 15f93fd5cd48
children 304ee75ca7ae
files libao2/ao_win32.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_win32.c	Mon Mar 09 18:21:47 2009 +0000
+++ b/libao2/ao_win32.c	Mon Mar 09 19:15:20 2009 +0000
@@ -243,8 +243,9 @@
 {
     if(!immed)
 	usec_sleep(get_delay() * 1000 * 1000);
+    else
 	waveOutReset(hWaveOut);
-	waveOutClose(hWaveOut);
+    while (waveOutClose(hWaveOut) == WAVERR_STILLPLAYING) usec_sleep(0);
 	mp_msg(MSGT_AO, MSGL_V,"waveOut device closed\n");
     free(waveBlocks);
 	mp_msg(MSGT_AO, MSGL_V,"buffer memory freed\n");