qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] coreaudio: fix coreaudio_test.diff


From: Programmingkid
Subject: Re: [RFC] coreaudio: fix coreaudio_test.diff
Date: Fri, 31 Jan 2020 10:55:36 -0500

> On Jan 29, 2020, at 2:13 AM, Volker Rümelin <address@hidden> wrote:
> 
> 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 <address@hidden>
> ---
> 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);
> -- 
> 2.16.4
> 

I could not apply this patch using 'patch -p1 < <patch file>'. I kept seeing 
the error malformed patch. 

When I applied the patch by hand QEMU was able to play sound normally again. 
Thank you :)

I used qemu-system-i386 at git commit adcd6e93b9519f7fe421d543e3aa646895b32e1a 
to test this patch. 

Both the AC97 and SB16 sound cards with Windows XP and Windows NT 4.0 
respectively. Only the ES1370 sound card used with Windows 2000 failed to play 
anything. This is probably a problem with it and not your patch.

Reviewed-by: John Arbuckle <address@hidden>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]