Skip to content

Commit

Permalink
Implement MSGS-style Drum Note Cut (#1199)
Browse files Browse the repository at this point in the history
Address #1196
  • Loading branch information
derselbst committed Dec 29, 2023
1 parent b3ff02d commit fa5173c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/synth/fluid_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down

0 comments on commit fa5173c

Please sign in to comment.