From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A25C433E0 for ; Sun, 17 Jan 2021 09:42:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0AF9229C7 for ; Sun, 17 Jan 2021 09:42:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0AF9229C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l14aH-0007d5-D6 for qemu-devel@archiver.kernel.org; Sun, 17 Jan 2021 04:42:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l14ZO-0007Cz-PN for qemu-devel@nongnu.org; Sun, 17 Jan 2021 04:42:03 -0500 Received: from mailout05.t-online.de ([194.25.134.82]:42754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l14ZJ-0008JY-7Y for qemu-devel@nongnu.org; Sun, 17 Jan 2021 04:42:02 -0500 Received: from fwd22.aul.t-online.de (fwd22.aul.t-online.de [172.20.26.127]) by mailout05.t-online.de (Postfix) with SMTP id 8A5BC426F1C7; Sun, 17 Jan 2021 10:41:52 +0100 (CET) Received: from [192.168.211.200] (G5WMHgZTQhQKkid6SxW9LIeutxYS-9h7wVssVWz1G0r3wxLAaNpGSIWQE1oQqQ4gfJ@[46.86.56.56]) by fwd22.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1l14ZD-3Zv1840; Sun, 17 Jan 2021 10:41:51 +0100 From: =?UTF-8?Q?Volker_R=c3=bcmelin?= Subject: Re: [PATCH 06/23] sdlaudio: fill remaining sample buffer with silence To: Thomas Huth , Gerd Hoffmann References: <9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de> <20210110100239.27588-6-vr_qemu@t-online.de> <38da0ef3-d48c-2ff6-e1e4-240594dffdfc@redhat.com> Message-ID: <198a071c-6540-1b62-001c-565f5200cff3@t-online.de> Date: Sun, 17 Jan 2021 10:41:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <38da0ef3-d48c-2ff6-e1e4-240594dffdfc@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-ID: G5WMHgZTQhQKkid6SxW9LIeutxYS-9h7wVssVWz1G0r3wxLAaNpGSIWQE1oQqQ4gfJ X-TOI-EXPURGATEID: 150726::1610876511-00011FFC-C0AB03B0/0/0 CLEAN NORMAL X-TOI-MSGID: e7f58034-4073-43b8-97d9-6b7456e7a801 Received-SPF: none client-ip=194.25.134.82; envelope-from=vr_qemu@t-online.de; helo=mailout05.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.039, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU , =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" > On 10/01/2021 11.02, Volker Rümelin wrote: >> Fill the remaining sample buffer with silence. To fill it with >> zeroes is wrong for unsigned samples because this is silence >> with a DC bias. >> >> Signed-off-by: Volker Rümelin >> --- >>   audio/sdlaudio.c | 3 ++- >>   1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c >> index 79eed23849..01ae4c600e 100644 >> --- a/audio/sdlaudio.c >> +++ b/audio/sdlaudio.c >> @@ -235,7 +235,8 @@ static void sdl_callback (void *opaque, Uint8 >> *buf, int len) >>         /* clear remaining buffer that we couldn't fill with data */ >>       if (len) { >> -        memset(buf, 0, len); >> +        audio_pcm_info_clear_buf(&hw->info, buf, >> +                                 len / hw->info.bytes_per_frame); >>       } >>   } >> > > Ignorant question: Is anybody still using unsigned samples in the 21st > century? > Hi Thomas, you are probably right that no one is knowingly using unsigned samples anymore. But qemu emulates audio devices from the last century. For example with the command line options -machine pcspk-audiodev=audio0 -audiodev sdl,id=audio0,out.buffer-length=3750,out.mixing-engine=off you will see 8 bit unsigned samples in the SDL callback buffer. With best regards, Volker > Anyway, > Reviewed-by: Thomas Huth >