winwave: pause/restore playing upon seeing VOICE_DISABLE/ENABLE

Signed-off-by: malc <av1474@comtv.ru>
master
malc 2009-10-11 06:52:45 +04:00
parent 875ef647b0
commit 6165a4260b
1 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,7 @@ typedef struct {
int avail; int avail;
int pending; int pending;
int curhdr; int curhdr;
int paused;
CRITICAL_SECTION crit_sect; CRITICAL_SECTION crit_sect;
} WaveVoiceOut; } WaveVoiceOut;
@ -282,6 +283,7 @@ static void winwave_fini_out (HWVoiceOut *hw)
static int winwave_ctl_out (HWVoiceOut *hw, int cmd, ...) static int winwave_ctl_out (HWVoiceOut *hw, int cmd, ...)
{ {
MMRESULT mr;
WaveVoiceOut *wave = (WaveVoiceOut *) hw; WaveVoiceOut *wave = (WaveVoiceOut *) hw;
switch (cmd) { switch (cmd) {
@ -313,10 +315,26 @@ static int winwave_ctl_out (HWVoiceOut *hw, int cmd, ...)
else { else {
hw->poll_mode = 0; hw->poll_mode = 0;
} }
if (wave->paused) {
mr = waveOutRestart (wave->hwo);
if (mr != MMSYSERR_NOERROR) {
winwave_logerr (mr, "waveOutRestart");
}
wave->paused = 0;
}
} }
return 0; return 0;
case VOICE_DISABLE: case VOICE_DISABLE:
if (!wave->paused) {
mr = waveOutPause (wave->hwo);
if (mr != MMSYSERR_NOERROR) {
winwave_logerr (mr, "waveOutPause");
}
else {
wave->paused = 1;
}
}
if (wave->event) { if (wave->event) {
qemu_del_wait_object (wave->event, winwave_poll_out, wave); qemu_del_wait_object (wave->event, winwave_poll_out, wave);
} }