From 5eff4e592e95a0ff34a9de8a5228c080f8e12e36 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 16 Apr 2021 18:34:11 +0800 Subject: [PATCH] wasapi: correctly render effects if no custom audio processing is used. I couldn't find a conceivable use case for calling `new_fluid_audio_driver2` with `fluid_synth_process` as its callback in client code... So I took the lazy route. If custom audio processing is indeed used, nothing would be changed by this patch. It still gets no effects buffer (like the vast majority of other drivers). --- src/drivers/fluid_wasapi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/drivers/fluid_wasapi.c b/src/drivers/fluid_wasapi.c index ab469090..e3826f11 100644 --- a/src/drivers/fluid_wasapi.c +++ b/src/drivers/fluid_wasapi.c @@ -635,6 +635,8 @@ static int fluid_wasapi_write_processed_channels(void *data, int len, fluid_wasapi_audio_driver_t *drv = (fluid_wasapi_audio_driver_t *) data; float *optr[FLUID_WASAPI_MAX_OUTPUTS * 2]; int16_t *ioptr[FLUID_WASAPI_MAX_OUTPUTS * 2]; + int efx_nch = 0; + float **efx_buf = NULL; for(ch = 0; ch < drv->channels_count; ++ch) { @@ -643,7 +645,12 @@ static int fluid_wasapi_write_processed_channels(void *data, int len, ioptr[ch] = (int16_t *)channels_out[ch] + channels_off[ch]; } - ret = drv->func(drv->user_pointer, len, 0, NULL, drv->channels_count, drv->drybuf); + if(drv->func == (fluid_audio_func_t)fluid_synth_process) + { + efx_nch = drv->channels_count; + efx_buf = drv->drybuf; + } + ret = drv->func(drv->user_pointer, len, efx_nch, efx_buf, drv->channels_count, drv->drybuf); for(ch = 0; ch < drv->channels_count; ++ch) {