From 4261e0e35ac399b284e708b2f1dc075a34667445 Mon Sep 17 00:00:00 2001 From: nilninull Date: Sat, 8 Apr 2023 17:47:26 +0900 Subject: [PATCH] Fix choppy sound when selecting pipewire output (#1230) Because forgot to set the period size in pipewire. --- src/drivers/fluid_pipewire.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/drivers/fluid_pipewire.c b/src/drivers/fluid_pipewire.c index 0edd87fd4..b96019e87 100644 --- a/src/drivers/fluid_pipewire.c +++ b/src/drivers/fluid_pipewire.c @@ -196,10 +196,15 @@ new_fluid_pipewire_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t goto driver_cleanup; } + struct pw_properties *props = pw_properties_new(PW_KEY_MEDIA_TYPE, media_type, PW_KEY_MEDIA_CATEGORY, media_category, PW_KEY_MEDIA_ROLE, media_role, NULL); + + pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", period_size, (int) sample_rate); + pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", (int) sample_rate); + drv->pw_stream = pw_stream_new_simple( pw_thread_loop_get_loop(drv->pw_loop), "FluidSynth", - pw_properties_new(PW_KEY_MEDIA_TYPE, media_type, PW_KEY_MEDIA_CATEGORY, media_category, PW_KEY_MEDIA_ROLE, media_role, NULL), + props, drv->events, drv);