diff options
author | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-18 20:44:04 +0000 |
---|---|---|
committer | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-18 20:44:04 +0000 |
commit | 978dd63540b380768a03be400e703f6e67f47e8f (patch) | |
tree | f690d07b96c1eb884b7bf27bc605ad8df28ddd87 /audio/audio.c | |
parent | c6ba7bbc4830b9dba2be4ddd6a5d1b2857dbd5ef (diff) | |
download | qemu-978dd63540b380768a03be400e703f6e67f47e8f.zip qemu-978dd63540b380768a03be400e703f6e67f47e8f.tar.gz qemu-978dd63540b380768a03be400e703f6e67f47e8f.tar.bz2 |
Avoid running audio ctl's when vm is not running
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6627 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'audio/audio.c')
-rw-r--r-- | audio/audio.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/audio/audio.c b/audio/audio.c index b0a5f3b..a2636cb 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1127,6 +1127,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) hw = sw->hw; if (sw->active != on) { + AudioState *s = &glob_audio_state; SWVoiceOut *temp_sw; SWVoiceCap *sc; @@ -1134,7 +1135,9 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) hw->pending_disable = 0; if (!hw->enabled) { hw->enabled = 1; - hw->pcm_ops->ctl_out (hw, VOICE_ENABLE); + if (s->vm_running) { + hw->pcm_ops->ctl_out (hw, VOICE_ENABLE); + } } } else { @@ -1170,12 +1173,15 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) hw = sw->hw; if (sw->active != on) { + AudioState *s = &glob_audio_state; SWVoiceIn *temp_sw; if (on) { if (!hw->enabled) { hw->enabled = 1; - hw->pcm_ops->ctl_in (hw, VOICE_ENABLE); + if (s->vm_running) { + hw->pcm_ops->ctl_in (hw, VOICE_ENABLE); + } } sw->total_hw_samples_acquired = hw->total_samples_captured; } @@ -1623,6 +1629,7 @@ static void audio_vm_change_state_handler (void *opaque, int running, HWVoiceIn *hwi = NULL; int op = running ? VOICE_ENABLE : VOICE_DISABLE; + s->vm_running = running; while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) { hwo->pcm_ops->ctl_out (hwo, op); } |