aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi/fluidsynth.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-31 00:49:43 -0800
committerChris Robinson <[email protected]>2013-12-31 00:49:43 -0800
commite699ab8614d1806c8961efa02a947d3e25e0bc67 (patch)
treec01fd320ead71cfe5ef20b9119701dce83eff2e9 /Alc/midi/fluidsynth.c
parent6b2d3c3cfa06485171bd813ce190c0b0ed87410c (diff)
Force all FluidSynth sounds off when changing soundfonts
Selecting soundfonts should only happen when the MIDI engine is stopped or reset. When stopped some notes may be left in a release phase, but we need to ensure all fluid_sample_t objects are finished before unloading since the soundfont (and associated sample memory) may be deleted at any time afterward.
Diffstat (limited to 'Alc/midi/fluidsynth.c')
-rw-r--r--Alc/midi/fluidsynth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c
index 25b367af..f5074d6d 100644
--- a/Alc/midi/fluidsynth.c
+++ b/Alc/midi/fluidsynth.c
@@ -447,6 +447,11 @@ static ALenum FSynth_selectSoundfonts(FSynth *self, ALCdevice *device, ALsizei c
ret = MidiSynth_selectSoundfonts(STATIC_CAST(MidiSynth, self), device, count, ids);
if(ret != AL_NO_ERROR) return ret;
+ ALCdevice_Lock(device);
+ for(i = 0;i < 16;i++)
+ fluid_synth_all_sounds_off(self->Synth, i);
+ ALCdevice_Unlock(device);
+
fontid = malloc(count * sizeof(fontid[0]));
if(fontid)
{
@@ -695,4 +700,4 @@ MidiSynth *FSynth_create(ALCdevice* UNUSED(device))
return NULL;
}
-#endif \ No newline at end of file
+#endif