Hi,
Fluidsynth actualy supports sustain pedal (cc 64) but it seems not
supports sostenuto pedal (cc 66).
As sostenuto pedal effect is great (as FluidSynth is !) I'am currently
working to add sostenuto pedal support.
Before returning this work I need to be confirmation on a function
behavior I disagree ligthly
(see fluid_synth_release_voice_on_same_note_LOCAL() below ) .
On noteOn context, the function , is useful to release previous playing
note (with same channel,key ).
(Note this function is only called on noteOn messages context).
/*
* If the same note is hit twice on the same channel, then the older
* voice process is advanced to the release stage. Using a mechanical
* MIDI controller, the only way this can happen is when the sustain
* pedal is held. In this case the behaviour implemented here is
* natural for many instruments. Note: One noteon event can trigger
* several voice processes, for example a stereo sample. Don't
* release those...
* v 1.1.3
*/
static void
fluid_synth_release_voice_on_same_note_LOCAL(fluid_synth_t* synth, int chan,
int key)
{
int i;
fluid_voice_t* voice;
for (i = 0; i < synth->polyphony; i++) {
voice = synth->voice[i];
if ( _PLAYING(voice) // note is playing on
&& (voice->chan == chan) // same channel and
&& (voice->key == key) // same key
&& (fluid_voice_get_id(voice) != synth->noteid)) // (see point 1
below )
{
fluid_voice_noteoff(voice); // Force the note into release
volume stage. (see point 2 below )
}
}
}
/*
* fluid_voice_noteoff
* v 1.1.3
*/
int
fluid_voice_noteoff(fluid_voice_t* voice)
{
unsigned int at_tick;
fluid_profile(FLUID_PROF_VOICE_NOTE, voice->ref,0);
// Sustain the note if peedal is pressed
if (voice->channel && fluid_channel_sustained(voice->channel)) {
voice->status = FLUID_VOICE_SUSTAINED;
}
else
{ // Force the note into release volume stage
at_tick = fluid_channel_get_min_note_length_ticks (voice->channel);
UPDATE_RVOICE_I1(fluid_rvoice_noteoff, at_tick);
voice->has_noteoff = 1;
}
return FLUID_OK;
}
Point 1) See the (fluid_voice_get_id(voice) != synth->noteid) expression.
As this function need ONLY to be called on noteOn messages context, this
expression is always TRUE,
so it seems superfluous.
Point 2) The goal is to release previous same note. That is to FORCE the
note in the release stage, even
if the sustain pedal is currently pressed.
So fluid_voice_noteoff() does the job but sustain the note if pedal is
pressed . So calling
fluid_voice_noteoff() seems unbecoming.
A better choice would be to call only the part of code in
fluid_voice_noteoff() that force the note to release stage.
Thanks for your expertise on this 2 points.
Regards
jjc
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev