fluidsynth/src
derselbst 44453ff232 Ensure the reverb engine is initialized after synth creation
The parameters (roomsize, level, etc.) of the reverb effects unit are initialized at the very end of `new_fluid_synth()` with `fluid_synth_set_reverb_full_LOCAL()`.
This however only adds an update-event to the `rvoice_mixer` queue.
The call to `fluid_synth_process_event_queue()` in `new_fluid_synth()` should make sure, that this event is dispatched and triggers the actual update.
However, the event is not dispatched immediately, because the rvoice event queue has not been committed yet, that is, a call to `fluid_rvoice_eventhandler_flush()` is missing.

So, although a reverb param initialization event has been queued, the reverb params still are garbage initialized (on Windows to some `-6.2774385622041925e+66`).

The next call to through the synth's public API will flush the queue and finally dispatch the update event, but when will it happen?

1. If the soundfont is specified as command-line argument, this call will happen before the audio driver starts rendering.
2. If the soundfont is loaded via shell command `load`, the audio driver will first start rendering audio, after updating the reverb.

Case 1. is trivial, everything works as it should.
Case 2. is interesting. Since the synth already started rendering audio by using that uninitialized reverb unit, the reverb engine's internal buffer is completely filled up with noise. Before outputting that signal to sound card, the sound is clipped to `1.0f`. That's the click we hear at the beginning. And because the reverb is so loud, the rendered audio signal stays 1.0f for quite a long time (...or always, can't tell).

Why is it not reproducible on Linux? Because GCC and Clang (AFAIK) leave all values uninitialized after allocating memory. And because malloc() often return zero-initialized memory, the reverb params seem to be nicely zero-initialized. MSVC however, always initializes memory with garbage, which is why we "hear" this resonance disaster.

Solution: Just update the reverb params via public API, which implicitly calls `fluid_rvoice_eventhandler_flush()`.

Fixes #563.
2019-09-27 14:01:40 +02:00
..
bindings fix documentation for pitch_bend_range shell command 2019-03-12 18:21:13 +01:00
drivers Fix use-after-free in fluid_player_stop() 2019-08-15 16:18:55 +02:00
gentables Generate pow lookup tables with higher precision 2019-02-16 10:51:53 +01:00
midi Update developer docs 2019-08-17 18:01:01 +02:00
rvoice fix building CoreAudio on OSX 10.4 2019-02-15 17:55:02 +01:00
sfloader use a common function for opening regular files 2019-04-18 19:43:39 +02:00
synth Ensure the reverb engine is initialized after synth creation 2019-09-27 14:01:40 +02:00
utils Add a public wrapper function for free() (#562) 2019-09-24 16:14:34 +02:00
CMakeLists.txt Improve systemd integration 2019-03-02 10:18:32 +01:00
config.cmake Improve systemd integration 2019-03-02 10:18:32 +01:00
fluidsynth.c Fix order of object creation in fluidsynth binary 2019-08-17 16:17:00 +02:00