On Mon Oct 30 09:55:23 2023 +0000, Rémi Bernon wrote:
Maybe we should not use copy_data? Adding a reference to the wave and releasing from a sample->notify callback. I even suspect (but it needs to be confirmed) that we're leaking fluid_samples at the moment, and that we should free them from the callback too.
Correct me if I'm wrong, but it looks like there's no way to set `sample->notify` through FluidSynth API. As an alternative, we could create FluidSynth samples in `synth_download_wave()` and use `GEN_OVERRIDEROOTKEY` and `GEN_FINETUNE` to set region-specific parameters, but we'd need to handle unloading of samples that are still playing.
Note also that according to `fluid_sample_set_sound_data()` docs, when copy_data is `FALSE` we should provide the 8-frame padding ourselves, so the loop point offset will still be necessary.