qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: digit@google.com
To: av1474@comtv.ru
Cc: David 'Digit' Turner <digit@google.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] audio: Fix support for multiple soft output voices.
Date: Tue, 11 Jan 2011 15:47:46 +0100	[thread overview]
Message-ID: <1294757266-1415-1-git-send-email-digit@google.com> (raw)

From: David 'Digit' Turner <digit@google.com>

This patch fixes a minor bug that prevent audio emulation from working
properly when several soft output voices are opened. The symptom was that
as long as one active soft voice was empty, it prevented any output from
any other voice.

More precisely, audio_pcm_hw_find_min_out always returns 0 with a value
of nb_livep > 0, which later forced the playback of exactly 0 hardware
samples to the audio backend (which of course didn't do anything).

By ignoring empty voices, we can let the active samples of other voices
pass through normally.
---
 audio/audio.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index ad51077..c7888c0 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -968,7 +968,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;
         }
@@ -1411,7 +1411,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;
             }
 
@@ -1514,7 +1514,7 @@ static void audio_run_capture (AudioState *s)
         hw->rpos = rpos;
 
         for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
-            if (!sw->active && sw->empty) {
+            if (!sw->active || sw->empty) {
                 continue;
             }
 
-- 
1.7.3.1

                 reply	other threads:[~2011-01-11 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294757266-1415-1-git-send-email-digit@google.com \
    --to=digit@google.com \
    --cc=av1474@comtv.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).