Hi Akihiko,
On 23/1/25 08:18, Akihiko Odaki wrote:
These functions can be used to re-initialize buffers when hardware
parameters change due to device hotplug, for example.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
audio/audio_int.h | 2 ++
audio/audio.c | 24 ++++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
index
87b4e9b6f2f356b6e5e972eabc100cf270fcbc29..17c6bbd0ae9e6ff810c0989dbfa1710ef674ff0a 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1407,12 +1407,18 @@ void audio_run(AudioState *s, const char *msg)
#endif
}
+void audio_generic_initialize_buffer_in(HWVoiceIn *hw)
+{
+ g_free(hw->buf_emul);
+ hw->size_emul = hw->samples * hw->info.bytes_per_frame;
+ hw->buf_emul = g_malloc(hw->size_emul);
What about using g_realloc()? Otherwise LGTM.