libfluidsynth 1.1.5
Typedefs | Functions
seq.h File Reference

MIDI event sequencer. More...

Typedefs

typedef void(* fluid_event_callback_t )(unsigned int time, fluid_event_t *event, fluid_sequencer_t *seq, void *data)
 Event callback prototype for destination clients.

Functions

FLUIDSYNTH_API fluid_sequencer_tnew_fluid_sequencer (void)
 Create a new sequencer object which uses the system timer.
FLUIDSYNTH_API fluid_sequencer_tnew_fluid_sequencer2 (int use_system_timer)
 Create a new sequencer object.
FLUIDSYNTH_API void delete_fluid_sequencer (fluid_sequencer_t *seq)
 Free a sequencer object.
FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer (fluid_sequencer_t *seq)
 Check if a sequencer is using the system timer or not.
FLUIDSYNTH_API short fluid_sequencer_register_client (fluid_sequencer_t *seq, const char *name, fluid_event_callback_t callback, void *data)
 Register a sequencer client.
FLUIDSYNTH_API void fluid_sequencer_unregister_client (fluid_sequencer_t *seq, short id)
 Unregister a previously registered client.
FLUIDSYNTH_API int fluid_sequencer_count_clients (fluid_sequencer_t *seq)
 Count a sequencers registered clients.
FLUIDSYNTH_API short fluid_sequencer_get_client_id (fluid_sequencer_t *seq, int index)
 Get a client ID from its index (order in which it was registered).
FLUIDSYNTH_API char * fluid_sequencer_get_client_name (fluid_sequencer_t *seq, int id)
 Get the name of a registered client.
FLUIDSYNTH_API int fluid_sequencer_client_is_dest (fluid_sequencer_t *seq, int id)
 Check if a client is a destination client.
FLUIDSYNTH_API void fluid_sequencer_process (fluid_sequencer_t *seq, unsigned int msec)
 Advance a sequencer that isn't using the system timer.
FLUIDSYNTH_API void fluid_sequencer_send_now (fluid_sequencer_t *seq, fluid_event_t *evt)
 Send an event immediately.
FLUIDSYNTH_API int fluid_sequencer_send_at (fluid_sequencer_t *seq, fluid_event_t *evt, unsigned int time, int absolute)
 Schedule an event for sending at a later time.
FLUIDSYNTH_API void fluid_sequencer_remove_events (fluid_sequencer_t *seq, short source, short dest, int type)
 Remove events from the event queue.
FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick (fluid_sequencer_t *seq)
 Get the current tick of a sequencer.
FLUIDSYNTH_API void fluid_sequencer_set_time_scale (fluid_sequencer_t *seq, double scale)
 Set the time scale of a sequencer.
FLUIDSYNTH_API double fluid_sequencer_get_time_scale (fluid_sequencer_t *seq)
 Get a sequencer's time scale.

Detailed Description

MIDI event sequencer.


Typedef Documentation

typedef void(* fluid_event_callback_t)(unsigned int time, fluid_event_t *event, fluid_sequencer_t *seq, void *data)

Event callback prototype for destination clients.

Parameters:
timeCurrent sequencer tick value (see fluid_sequencer_get_tick()).
eventThe event being received
seqThe sequencer instance
dataUser defined data registered with the client

Function Documentation

FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer ( void  )

Create a new sequencer object which uses the system timer.

Use new_fluid_sequencer2() to specify whether the system timer or fluid_sequencer_process() is used to advance the sequencer.

Returns:
New sequencer instance
Examples:
fluidsynth_arpeggio.c, and fluidsynth_metronome.c.

References new_fluid_sequencer(), and new_fluid_sequencer2().

Referenced by new_fluid_sequencer().

FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer2 ( int  use_system_timer)

Create a new sequencer object.

Parameters:
use_system_timerIf TRUE, sequencer will advance at the rate of the system clock. If FALSE, call fluid_sequencer_process() to advance the sequencer.
Returns:
New sequencer instance
Since:
1.1.0

References fluid_log(), FLUID_PANIC, and new_fluid_sequencer2().

Referenced by new_fluid_sequencer(), and new_fluid_sequencer2().

FLUIDSYNTH_API void delete_fluid_sequencer ( fluid_sequencer_t seq)

Free a sequencer object.

Parameters:
seqSequencer to delete
Examples:
fluidsynth_arpeggio.c, and fluidsynth_metronome.c.

References delete_fluid_sequencer(), and fluid_sequencer_unregister_client().

Referenced by delete_fluid_sequencer().

FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer ( fluid_sequencer_t seq)

Check if a sequencer is using the system timer or not.

Parameters:
seqSequencer object
Returns:
TRUE if system timer is being used, FALSE otherwise.
Since:
1.1.0

References fluid_sequencer_get_use_system_timer().

Referenced by fluid_sequencer_get_use_system_timer(), and fluid_sequencer_register_fluidsynth().

FLUIDSYNTH_API short fluid_sequencer_register_client ( fluid_sequencer_t seq,
const char *  name,
fluid_event_callback_t  callback,
void *  data 
)

Register a sequencer client.

Parameters:
seqSequencer object
nameName of sequencer client
callbackSequencer client callback or NULL for a source client.
dataUser data to pass to the callback
Returns:
Unique sequencer ID or FLUID_FAILED on error

Clients can be sources or destinations of events. Sources don't need to register a callback.

Examples:
fluidsynth_arpeggio.c, and fluidsynth_metronome.c.

References FLUID_FAILED, fluid_log(), FLUID_PANIC, and fluid_sequencer_register_client().

Referenced by fluid_sequencer_register_client(), and fluid_sequencer_register_fluidsynth().

FLUIDSYNTH_API void fluid_sequencer_unregister_client ( fluid_sequencer_t seq,
short  id 
)
FLUIDSYNTH_API int fluid_sequencer_count_clients ( fluid_sequencer_t seq)

Count a sequencers registered clients.

Parameters:
seqSequencer object
Returns:
Count of sequencer clients.

References fluid_sequencer_count_clients().

Referenced by fluid_sequencer_count_clients().

FLUIDSYNTH_API short fluid_sequencer_get_client_id ( fluid_sequencer_t seq,
int  index 
)

Get a client ID from its index (order in which it was registered).

Parameters:
seqSequencer object
indexIndex of register client
Returns:
Client ID or FLUID_FAILED if not found

References FLUID_FAILED, and fluid_sequencer_get_client_id().

Referenced by fluid_sequencer_get_client_id().

FLUIDSYNTH_API char* fluid_sequencer_get_client_name ( fluid_sequencer_t seq,
int  id 
)

Get the name of a registered client.

Parameters:
seqSequencer object
idClient ID
Returns:
Client name or NULL if not found. String is internal and should not be modified or freed.

References fluid_sequencer_get_client_name().

Referenced by fluid_sequencer_get_client_name().

FLUIDSYNTH_API int fluid_sequencer_client_is_dest ( fluid_sequencer_t seq,
int  id 
)

Check if a client is a destination client.

Parameters:
seqSequencer object
idClient ID
Returns:
TRUE if client is a destination client, FALSE otherwise or if not found

References fluid_sequencer_client_is_dest().

Referenced by fluid_sequencer_client_is_dest().

FLUIDSYNTH_API void fluid_sequencer_process ( fluid_sequencer_t seq,
unsigned int  msec 
)

Advance a sequencer that isn't using the system timer.

Parameters:
seqSequencer object
msecTime to advance sequencer to (absolute time since sequencer start).
Since:
1.1.0

References fluid_sequencer_process().

Referenced by fluid_sequencer_process().

FLUIDSYNTH_API void fluid_sequencer_send_now ( fluid_sequencer_t seq,
fluid_event_t evt 
)

Send an event immediately.

Parameters:
seqSequencer object
evtEvent to send (copied)

References fluid_event_get_dest(), fluid_sequencer_get_tick(), and fluid_sequencer_send_now().

Referenced by fluid_sequencer_send_now().

FLUIDSYNTH_API int fluid_sequencer_send_at ( fluid_sequencer_t seq,
fluid_event_t evt,
unsigned int  time,
int  absolute 
)

Schedule an event for sending at a later time.

Parameters:
seqSequencer object
evtEvent to send
timeTime value in ticks (in milliseconds with the default time scale of 1000).
absoluteTRUE if time is absolute sequencer time (time since sequencer creation), FALSE if relative to current time.
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Examples:
fluidsynth_arpeggio.c, and fluidsynth_metronome.c.

References fluid_sequencer_get_tick(), and fluid_sequencer_send_at().

Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_sequencer_send_at().

FLUIDSYNTH_API void fluid_sequencer_remove_events ( fluid_sequencer_t seq,
short  source,
short  dest,
int  type 
)

Remove events from the event queue.

Parameters:
seqSequencer object
sourceSource client ID to match or -1 for wildcard
destDestination client ID to match or -1 for wildcard
typeEvent type to match or -1 for wildcard (fluid_seq_event_type)

References fluid_sequencer_remove_events().

Referenced by fluid_sequencer_remove_events().

FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick ( fluid_sequencer_t seq)

Get the current tick of a sequencer.

Parameters:
seqSequencer object
Returns:
Current tick value
Examples:
fluidsynth_arpeggio.c, and fluidsynth_metronome.c.

References fluid_sequencer_get_tick().

Referenced by fluid_sequencer_add_midi_event_to_buffer(), fluid_sequencer_get_tick(), fluid_sequencer_send_at(), fluid_sequencer_send_now(), and fluid_sequencer_unregister_client().

FLUIDSYNTH_API void fluid_sequencer_set_time_scale ( fluid_sequencer_t seq,
double  scale 
)

Set the time scale of a sequencer.

Parameters:
seqSequencer object
scaleSequencer scale value in ticks per second (default is 1000 for 1 tick per millisecond, max is 1000.0)

If there are already scheduled events in the sequencer and the scale is changed the events are adjusted accordingly.

References fluid_log(), fluid_sequencer_set_time_scale(), and FLUID_WARN.

Referenced by fluid_sequencer_set_time_scale().

FLUIDSYNTH_API double fluid_sequencer_get_time_scale ( fluid_sequencer_t seq)

Get a sequencer's time scale.

Parameters:
seqSequencer object.
Returns:
Time scale value in ticks per second.

References fluid_sequencer_get_time_scale().

Referenced by fluid_sequencer_get_time_scale().