From fa5173cbaefed60121db057bad7be7686165f7cc Mon Sep 17 00:00:00 2001 From: Tom M Date: Fri, 29 Dec 2023 13:06:53 +0100 Subject: [PATCH] Implement MSGS-style Drum Note Cut (#1199) Address #1196 --- src/synth/fluid_synth.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index e635983ac..84960619d 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -6846,15 +6846,30 @@ fluid_synth_release_voice_on_same_note_LOCAL(fluid_synth_t *synth, int chan, && (fluid_voice_get_key(voice) == key) && (fluid_voice_get_id(voice) != synth->noteid)) { + enum fluid_midi_channel_type type = synth->channel[chan]->channel_type; + /* Id of voices that was sustained by sostenuto */ if(fluid_voice_is_sostenuto(voice)) { synth->storeid = fluid_voice_get_id(voice); } - /* Force the voice into release stage except if pedaling - (sostenuto or sustain) is active */ - fluid_voice_noteoff(voice); + switch(type) + { + case CHANNEL_TYPE_DRUM: + /* release the voice, this should make riding hi-hats or snares sound more + * realistic (Discussion #1196) */ + fluid_voice_off(voice); + break; + case CHANNEL_TYPE_MELODIC: + /* Force the voice into release stage except if pedaling (sostenuto or sustain) is active. + * This gives a more realistic sound to pianos and possibly other instruments (see PR #905). */ + fluid_voice_noteoff(voice); + break; + default: + FLUID_LOG(FLUID_ERR, "This should never happen: unknown channel type %d", (int)type); + break; + } } } }