summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authormalc <av1474@comtv.ru>2009-10-15 02:11:25 +0400
committermalc <av1474@comtv.ru>2009-10-15 02:11:25 +0400
commit2a117d401d7f227c5f466834d24c11a2e7cffc00 (patch)
tree5d9ce50a55e6b97097e4e8096fd244d8701ea7af /audio
parentconfigure: clean temporary executable files even on Windows (diff)
downloadqemu-kvm-2a117d401d7f227c5f466834d24c11a2e7cffc00.tar.gz
qemu-kvm-2a117d401d7f227c5f466834d24c11a2e7cffc00.tar.bz2
qemu-kvm-2a117d401d7f227c5f466834d24c11a2e7cffc00.zip
winwave: follow the rules when closing the output device
a. call waveOutReset to drain the queue b. unprepare headers before freeing underlying memory Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'audio')
-rw-r--r--audio/winwaveaudio.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/audio/winwaveaudio.c b/audio/winwaveaudio.c
index f43ae95cf..d467c9d04 100644
--- a/audio/winwaveaudio.c
+++ b/audio/winwaveaudio.c
@@ -68,6 +68,10 @@ static void winwave_log_mmresult (MMRESULT mr)
"hasn't been prepared";
break;
+ case WAVERR_STILLPLAYING:
+ str = "There are still buffers in the queue";
+ break;
+
default:
AUD_log (AUDIO_CAP, "Reason: Unknown (MMRESULT %#x)\n", mr);
return;
@@ -262,8 +266,23 @@ static void winwave_poll_out (void *opaque)
static void winwave_fini_out (HWVoiceOut *hw)
{
+ int i;
+ MMRESULT mr;
WaveVoiceOut *wave = (WaveVoiceOut *) hw;
+ mr = waveOutReset (wave->hwo);
+ if (mr != MMSYSERR_NOERROR) {
+ winwave_logerr (mr, "waveOutReset\n");
+ }
+
+ for (i = 0; i < conf.dac_headers; ++i) {
+ mr = waveOutUnprepareHeader (wave->hwo, &wave->hdrs[i],
+ sizeof (wave->hdrs[i]));
+ if (mr != MMSYSERR_NOERROR) {
+ winwave_logerr (mr, "waveOutUnprepareHeader(%d)\n", i);
+ }
+ }
+
winwave_anal_close_out (wave);
if (wave->event) {