From patchwork Wed Jan 29 07:13:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 1230738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=t-online.de 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 ozlabs.org (Postfix) with ESMTPS id 486vpj5rZBz9sNT for ; Wed, 29 Jan 2020 18:13:33 +1100 (AEDT) Received: from localhost ([::1]:42096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwhXX-00069R-Pp for incoming@patchwork.ozlabs.org; Wed, 29 Jan 2020 02:13:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54752) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwhXA-00068R-T6 for qemu-devel@nongnu.org; Wed, 29 Jan 2020 02:13:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwhX9-0006FY-Oy for qemu-devel@nongnu.org; Wed, 29 Jan 2020 02:13:08 -0500 Received: from mailout08.t-online.de ([194.25.134.20]:48280) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iwhX9-0006EZ-GA for qemu-devel@nongnu.org; Wed, 29 Jan 2020 02:13:07 -0500 Received: from fwd02.aul.t-online.de (fwd02.aul.t-online.de [172.20.26.148]) by mailout08.t-online.de (Postfix) with SMTP id DF0CB41EA55A; Wed, 29 Jan 2020 08:13:04 +0100 (CET) Received: from [192.168.211.200] (GWsm-QZHrhsf+hH2lX0hYgwLRVqhtUJUMUmiXmSWDkIbHofBJ5xAe4NloGVK8P+gko@[93.236.147.123]) by fwd02.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1iwhX6-2NJXSS0; Wed, 29 Jan 2020 08:13:04 +0100 Subject: [RFC] coreaudio: fix coreaudio_test.diff From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Howard Spoelstra References: <43D423C6-78D4-4DCE-B97C-0658D3D2E3BD@gmail.com> <4021690b-2380-3925-209e-d4cc66928773@gmail.com> <5314e860-dffe-3bc0-209f-bd2b937cd0c6@t-online.de> <54f5ddf3-5ea9-bd6d-8c71-edf4db527463@t-online.de> Message-ID: Date: Wed, 29 Jan 2020 08:13:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <54f5ddf3-5ea9-bd6d-8c71-edf4db527463@t-online.de> Content-Language: en-US X-ID: GWsm-QZHrhsf+hH2lX0hYgwLRVqhtUJUMUmiXmSWDkIbHofBJ5xAe4NloGVK8P+gko X-TOI-MSGID: 7b99df4c-656d-4aca-8b4f-7d04cbee8c79 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.20 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: Programmingkid , Gerd Hoffmann , Mark Cave-Ayland , qemu Developers , =?utf-8?b?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is an untested patch that tries to fix the problems in the patch found at https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg02142.html. Signed-off-by: Volker RĂ¼melin Reviewed-by: John Arbuckle --- audio/audio_template.h | 16 ++++++++-------- audio/coreaudio.c | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index a7b46b8363..e6724c5d68 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -153,13 +153,6 @@ static int glue (audio_pcm_sw_init_, TYPE) ( sw->ratio = ((int64_t) sw->info.freq << 32) / sw->hw->info.freq; #endif -#ifdef FLOAT_MIXENG -#ifdef DAC - sw->conv = mixeng_conv_float; -#else - sw->clip = mixeng_clip_float; -#endif -#else #ifdef DAC sw->conv = mixeng_conv #else @@ -169,7 +162,6 @@ static int glue (audio_pcm_sw_init_, TYPE) ( [sw->info.sign] [sw->info.swap_endianness] [audio_bits_to_index (sw->info.bits)]; -#endif sw->name = g_strdup (name); err = glue (audio_pcm_sw_alloc_resources_, TYPE) (sw); @@ -284,6 +276,13 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, goto err1; } +#ifdef FLOAT_MIXENG +#ifdef DAC + hw->clip = mixeng_clip_float; +#else + hw->conv = mixeng_conv_float; +#endif +#else #ifdef DAC hw->clip = mixeng_clip #else @@ -293,6 +292,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, [hw->info.sign] [hw->info.swap_endianness] [audio_bits_to_index (hw->info.bits)]; +#endif glue(audio_pcm_hw_alloc_resources_, TYPE)(hw); diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 4e7e509ad0..ff0d23fd7d 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -482,6 +482,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, Audiodev *dev = drv_opaque; AudiodevCoreaudioPerDirectionOptions *cpdo = dev->u.coreaudio.out; int frames; + struct audsettings fake_as; /* create mutex */ err = pthread_mutex_init(&core->mutex, NULL); @@ -490,6 +491,10 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as, return -1; } + memcpy(&fake_as, as, sizeof(struct audsettings)); + as = &fake_as; + /* size of float is 32bits */ + as->fmt = AUDIO_FORMAT_S32; audio_pcm_init_info (&hw->info, as); status = coreaudio_get_voice(&core->outputDeviceID);