From patchwork Tue Jan 11 14:47:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Turner X-Patchwork-Id: 78392 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 83B71B7082 for ; Wed, 12 Jan 2011 01:49:46 +1100 (EST) Received: from localhost ([127.0.0.1]:47394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcfXa-0003O2-FT for incoming@patchwork.ozlabs.org; Tue, 11 Jan 2011 09:49:42 -0500 Received: from [140.186.70.92] (port=45652 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcfWB-0002kU-Eu for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:48:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcfW9-0003RP-LY for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:48:15 -0500 Received: from smtp-out.google.com ([216.239.44.51]:46685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcfW9-0003R2-GW for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:48:13 -0500 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p0BEm8NW026153; Tue, 11 Jan 2011 06:48:08 -0800 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1294757289; bh=xn4ckU7cNzBQhpqLegE7PO7ytUg=; h=From:To:Cc:Subject:Date:Message-Id; b=daXqHDJfsRvIBK68PA3j1c1Gqi+kEyp+QHNNoeBHP1ujlXMV5wQTdxv7ySJyyJVMQ D3am6hZTbvYb7zeB2EbCw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer; b=XO+cUOjpHIXy6ci2DBOUl5+tb6B/oyB9eB9S8uyuSaH5AXp+W2DIpPev/BQ2eKwHx QnE9sFHP0jAnp2mfCyE3A== Received: from lulu.par.corp.google.com (lulu.par.corp.google.com [172.28.228.141]) by hpaq14.eem.corp.google.com with ESMTP id p0BEm60l028972; Tue, 11 Jan 2011 06:48:07 -0800 Received: by lulu.par.corp.google.com (Postfix, from userid 28587) id D0028E1D18; Tue, 11 Jan 2011 15:48:05 +0100 (CET) From: digit@google.com To: av1474@comtv.ru Date: Tue, 11 Jan 2011 15:47:46 +0100 Message-Id: <1294757266-1415-1-git-send-email-digit@google.com> X-Mailer: git-send-email 1.7.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: David 'Digit' Turner , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] audio: Fix support for multiple soft output voices. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David 'Digit' Turner 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; }