From 5164d3c53f57dfb468ab11136358b6e3b6cf0513 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 22 Dec 2010 16:55:41 +0100 Subject: Fix upstream audio bug: can't play with two soft voices. This patch fixes a problem where using two SWVoiceOut at the same time would not work, unless the two voices would output sound samples at the same time. Change-Id: Id6c6c93f5fe7be29d73776f62fe03732291fcaf9 --- audio/audio.c | 4 ++-- audio/audio_template.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index e095b1a..3e60c12 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1068,7 +1068,7 @@ static int audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep) int nb_live = 0; for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (sw->active || !sw->empty) { + if (sw->active && !sw->empty) { m = audio_MIN (m, sw->total_hw_samples_mixed); nb_live += 1; } @@ -1540,7 +1540,7 @@ static void audio_run_out (AudioState *s) cleanup_required = 0; for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) { - if (!sw->active && sw->empty) { + if (!sw->active || sw->empty) { continue; } diff --git a/audio/audio_template.h b/audio/audio_template.h index d3764c8..c0d07e5 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -496,6 +496,9 @@ SW *glue (AUD_open_, TYPE) ( sw->vol = nominal_volume; sw->callback.fn = callback_fn; sw->callback.opaque = callback_opaque; +#ifdef DAC + sw->empty = 1; +#endif #ifdef DAC if (live) { -- cgit v1.1