Deprecate usage of the system timer for the sequencer (#599)

Deprecate usage of the system timer for the sequencer and print a warning if the system timer is used.
This commit is contained in:
Tom M 2020-01-19 15:37:42 +01:00 committed by GitHub
parent 3610372ae5
commit c85ad53d60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 8 deletions

View file

@ -21,6 +21,7 @@ All the source code examples in this document are in the public domain; you can
- \ref Disclaimer
- \ref Introduction
- \ref NewIn2_1_1
- \ref NewIn2_1_0
- \ref NewIn2_0_8
- \ref NewIn2_0_7
@ -67,6 +68,10 @@ What is FluidSynth?
- FluidSynth is open source, in active development. For more details, take a look at http://www.fluidsynth.org
\section NewIn2_1_1 What's new in 2.1.1?
- using the sequencer with the system timer as timing source has been deprecated
\section NewIn2_1_0 What's new in 2.1.0?
- <span style="color:red">refrain from using fluid_synth_set_sample_rate()</span>

View file

@ -57,7 +57,7 @@ schedule_noteoff(int chan, short key, unsigned int ticks)
/* schedule a timer event (shall trigger the callback) */
void
schedule_timer_event()
schedule_timer_event(void)
{
fluid_event_t *ev = new_fluid_event();
fluid_event_set_source(ev, -1);
@ -69,7 +69,7 @@ schedule_timer_event()
/* schedule the arpeggio's notes */
void
schedule_pattern()
schedule_pattern(void)
{
int i, note_time, note_duration;
note_time = time_marker;
@ -124,7 +124,7 @@ main(int argc, char *argv[])
if(n != -1)
{
sequencer = new_fluid_sequencer();
sequencer = new_fluid_sequencer2(0);
/* register the synth with the sequencer */
synth_destination = fluid_sequencer_register_fluidsynth(sequencer,
synth);

View file

@ -47,7 +47,7 @@ schedule_noteon(int chan, short key, unsigned int ticks)
/* schedule a timer event (shall trigger the callback) */
void
schedule_timer_event()
schedule_timer_event(void)
{
fluid_event_t *ev = new_fluid_event();
fluid_event_set_source(ev, -1);
@ -59,7 +59,7 @@ schedule_timer_event()
/* schedule the metronome pattern */
void
schedule_pattern()
schedule_pattern(void)
{
int i, note_time;
note_time = time_marker;
@ -111,7 +111,7 @@ main(int argc, char *argv[])
if(n != -1)
{
sequencer = new_fluid_sequencer();
sequencer = new_fluid_sequencer2(0);
/* register the synth with the sequencer */
synth_destination = fluid_sequencer_register_fluidsynth(sequencer,
synth);

View file

@ -41,7 +41,7 @@ typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t *event,
fluid_sequencer_t *seq, void *data);
FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer(void);
FLUID_DEPRECATED FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer(void);
FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer2(int use_system_timer);
FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t *seq);
FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t *seq);

View file

@ -88,6 +88,7 @@ static void _fluid_free_evt_queue(fluid_evt_entry **first, fluid_evt_entry **las
* new_fluid_sequencer2() to specify whether the system timer or
* fluid_sequencer_process() is used to advance the sequencer.
* @return New sequencer instance
* @deprecated As of fluidsynth 2.1.1 the use of the system timer has been deprecated.
*/
fluid_sequencer_t *
new_fluid_sequencer(void)
@ -102,12 +103,18 @@ new_fluid_sequencer(void)
* the sequencer.
* @return New sequencer instance
* @since 1.1.0
* @note As of fluidsynth 2.1.1 the use of the system timer has been deprecated.
*/
fluid_sequencer_t *
new_fluid_sequencer2(int use_system_timer)
{
fluid_sequencer_t *seq;
if(use_system_timer)
{
FLUID_LOG(FLUID_WARN, "sequencer: Usage of the system timer has been deprecated!");
}
seq = FLUID_NEW(fluid_sequencer_t);
if(seq == NULL)
@ -172,6 +179,7 @@ delete_fluid_sequencer(fluid_sequencer_t *seq)
* @param seq Sequencer object
* @return TRUE if system timer is being used, FALSE otherwise.
* @since 1.1.0
* @deprecated As of fluidsynth 2.1.1 the usage of the system timer has been deprecated.
*/
int
fluid_sequencer_get_use_system_timer(fluid_sequencer_t *seq)
@ -830,7 +838,11 @@ _fluid_seq_queue_process(void *data, unsigned int msec)
}
/**
* Advance a sequencer that isn't using the system timer.
* Advance a sequencer.
*
* If you have registered the synthesizer as client (fluid_sequencer_register_fluidsynth()), the synth
* will take care of calling fluid_sequencer_process(). Otherwise it is up to the user to
* advance the sequencer manually.
* @param seq Sequencer object
* @param msec Time to advance sequencer to (absolute time since sequencer start).
* @since 1.1.0