Default to 10 ms min-note-length. Minor refactoring.

This commit is contained in:
David Henningsson 2009-10-14 07:27:30 +00:00
parent 220337916e
commit 76777760ce
4 changed files with 13 additions and 11 deletions

View File

@ -139,5 +139,7 @@ int fluid_channel_get_interp_method(fluid_channel_t* chan);
#define fluid_channel_set_gen(_c, _n, _v, _a) { (_c)->gen[_n] = _v; (_c)->gen_abs[_n] = _a; }
#define fluid_channel_get_gen(_c, _n) ((_c)->gen[_n])
#define fluid_channel_get_gen_abs(_c, _n) ((_c)->gen_abs[_n])
#define fluid_channel_get_min_note_length_ticks(chan) \
((chan)->synth->min_note_length_ticks)
#endif /* _FLUID_CHAN_H */

View File

@ -254,7 +254,7 @@ void fluid_synth_settings(fluid_settings_t* settings)
fluid_settings_add_option(settings, "synth.midi-mode-lock", "no");
fluid_settings_add_option(settings, "synth.midi-mode-lock", "yes");
fluid_settings_register_int(settings, "synth.min-note-length", 0, 0, 65536, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0, NULL, NULL);
}
/*
@ -1411,7 +1411,7 @@ fluid_synth_noteoff_LOCAL(fluid_synth_t* synth, int chan, int key)
used_voices);
} /* if verbose */
fluid_voice_noteoff(voice, synth->min_note_length_ticks);
fluid_voice_noteoff(voice);
status = FLUID_OK;
} /* if voice on */
} /* for all voices */
@ -1429,7 +1429,7 @@ fluid_synth_damp_voices_LOCAL(fluid_synth_t* synth, int chan)
voice = synth->voice[i];
if ((voice->chan == chan) && _SUSTAINED(voice))
fluid_voice_noteoff(voice, synth->min_note_length_ticks);
fluid_voice_noteoff(voice);
}
return FLUID_OK;
@ -2013,7 +2013,7 @@ fluid_synth_all_notes_off_LOCAL(fluid_synth_t* synth, int chan)
voice = synth->voice[i];
if (_PLAYING(voice) && (voice->chan == chan))
fluid_voice_noteoff(voice, synth->min_note_length_ticks);
fluid_voice_noteoff(voice);
}
return FLUID_OK;
}
@ -4692,7 +4692,7 @@ fluid_synth_release_voice_on_same_note_LOCAL(fluid_synth_t* synth, int chan,
&& (voice->chan == chan)
&& (voice->key == key)
&& (fluid_voice_get_id(voice) != synth->noteid)) {
fluid_voice_noteoff(voice, synth->min_note_length_ticks);
fluid_voice_noteoff(voice);
}
}
}
@ -5750,7 +5750,7 @@ fluid_synth_stop_LOCAL (fluid_synth_t *synth, unsigned int id)
voice = synth->voice[i];
if (_ON(voice) && (fluid_voice_get_id (voice) == id))
fluid_voice_noteoff(voice, synth->min_note_length_ticks);
fluid_voice_noteoff(voice);
}
}

View File

@ -266,7 +266,7 @@ fluid_voice_write (fluid_voice_t* voice, fluid_real_t *dsp_buf)
if (voice->noteoff_ticks != 0 && voice->ticks >= voice->noteoff_ticks)
{
fluid_voice_noteoff(voice, 0);
fluid_voice_noteoff(voice);
}
fluid_check_fpe ("voice_write startup");
@ -1557,14 +1557,14 @@ int fluid_voice_modulate_all(fluid_voice_t* voice)
/*
* fluid_voice_noteoff
* @param at_tick minimum amount of ticks (samples) when the note
* is turned off.
*/
int
fluid_voice_noteoff(fluid_voice_t* voice, unsigned int at_tick)
fluid_voice_noteoff(fluid_voice_t* voice)
{
fluid_profile(FLUID_PROF_VOICE_NOTE, voice->ref);
unsigned int at_tick = fluid_channel_get_min_note_length_ticks(voice->channel);
if (at_tick > voice->ticks) {
/* Delay noteoff */
voice->noteoff_ticks = at_tick;

View File

@ -244,7 +244,7 @@ int fluid_voice_set_gain(fluid_voice_t* voice, fluid_real_t gain);
function.*/
void fluid_voice_update_param(fluid_voice_t* voice, int gen);
int fluid_voice_noteoff(fluid_voice_t* voice, unsigned int at_tick);
int fluid_voice_noteoff(fluid_voice_t* voice);
int fluid_voice_off(fluid_voice_t* voice);
void fluid_voice_mix (fluid_voice_t *voice,
fluid_real_t* left_buf, fluid_real_t* right_buf,