qemu-devel
[Top][All Lists]
Advanced

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

[RFC] coreaudio: fix coreaudio_test.diff


From: Volker Rümelin
Subject: [RFC] coreaudio: fix coreaudio_test.diff
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

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




reply via email to

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