libfluidsynth
1.1.11
|
Functions for MIDI events, drivers and MIDI file playback. More...
Typedefs | |
typedef int(* | handle_midi_event_func_t) (void *data, fluid_midi_event_t *event) |
Generic callback function for MIDI events. More... | |
Enumerations | |
enum | fluid_midi_router_rule_type { FLUID_MIDI_ROUTER_RULE_NOTE, FLUID_MIDI_ROUTER_RULE_CC, FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, FLUID_MIDI_ROUTER_RULE_PITCH_BEND, FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, FLUID_MIDI_ROUTER_RULE_COUNT } |
MIDI router rule type. More... | |
enum | fluid_player_status { FLUID_PLAYER_READY, FLUID_PLAYER_PLAYING, FLUID_PLAYER_DONE } |
MIDI player status enum. More... | |
Functions | |
FLUIDSYNTH_API fluid_midi_event_t * | new_fluid_midi_event (void) |
Create a MIDI event structure. More... | |
FLUIDSYNTH_API int | delete_fluid_midi_event (fluid_midi_event_t *event) |
Delete MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_type (fluid_midi_event_t *evt, int type) |
Set the event type field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_type (fluid_midi_event_t *evt) |
Get the event type field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_channel (fluid_midi_event_t *evt, int chan) |
Set the channel field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_channel (fluid_midi_event_t *evt) |
Get the channel field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_key (fluid_midi_event_t *evt) |
Get the key field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_key (fluid_midi_event_t *evt, int key) |
Set the key field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_velocity (fluid_midi_event_t *evt) |
Get the velocity field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_velocity (fluid_midi_event_t *evt, int vel) |
Set the velocity field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_control (fluid_midi_event_t *evt) |
Get the control number of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_control (fluid_midi_event_t *evt, int ctrl) |
Set the control field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_value (fluid_midi_event_t *evt) |
Get the value field from a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_value (fluid_midi_event_t *evt, int val) |
Set the value field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_program (fluid_midi_event_t *evt) |
Get the program field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_program (fluid_midi_event_t *evt, int val) |
Set the program field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_get_pitch (fluid_midi_event_t *evt) |
Get the pitch field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_pitch (fluid_midi_event_t *evt, int val) |
Set the pitch field of a MIDI event structure. More... | |
FLUIDSYNTH_API int | fluid_midi_event_set_sysex (fluid_midi_event_t *evt, void *data, int size, int dynamic) |
Assign sysex data to a MIDI event structure. More... | |
FLUIDSYNTH_API fluid_midi_router_t * | new_fluid_midi_router (fluid_settings_t *settings, handle_midi_event_func_t handler, void *event_handler_data) |
Create a new midi router. More... | |
FLUIDSYNTH_API int | delete_fluid_midi_router (fluid_midi_router_t *handler) |
Delete a MIDI router instance. More... | |
FLUIDSYNTH_API int | fluid_midi_router_set_default_rules (fluid_midi_router_t *router) |
Set a MIDI router to use default "unity" rules. More... | |
FLUIDSYNTH_API int | fluid_midi_router_clear_rules (fluid_midi_router_t *router) |
Clear all rules in a MIDI router. More... | |
FLUIDSYNTH_API int | fluid_midi_router_add_rule (fluid_midi_router_t *router, fluid_midi_router_rule_t *rule, int type) |
Add a rule to a MIDI router. More... | |
FLUIDSYNTH_API fluid_midi_router_rule_t * | new_fluid_midi_router_rule (void) |
Create a new MIDI router rule. More... | |
FLUIDSYNTH_API void | delete_fluid_midi_router_rule (fluid_midi_router_rule_t *rule) |
Free a MIDI router rule. More... | |
FLUIDSYNTH_API void | fluid_midi_router_rule_set_chan (fluid_midi_router_rule_t *rule, int min, int max, float mul, int add) |
Set the channel portion of a rule. More... | |
FLUIDSYNTH_API void | fluid_midi_router_rule_set_param1 (fluid_midi_router_rule_t *rule, int min, int max, float mul, int add) |
Set the first parameter portion of a rule. More... | |
FLUIDSYNTH_API void | fluid_midi_router_rule_set_param2 (fluid_midi_router_rule_t *rule, int min, int max, float mul, int add) |
Set the second parameter portion of a rule. More... | |
FLUIDSYNTH_API int | fluid_midi_router_handle_midi_event (void *data, fluid_midi_event_t *event) |
Handle a MIDI event through a MIDI router instance. More... | |
FLUIDSYNTH_API int | fluid_midi_dump_prerouter (void *data, fluid_midi_event_t *event) |
MIDI event callback function to display event information to stdout. More... | |
FLUIDSYNTH_API int | fluid_midi_dump_postrouter (void *data, fluid_midi_event_t *event) |
MIDI event callback function to display event information to stdout. More... | |
FLUIDSYNTH_API fluid_midi_driver_t * | new_fluid_midi_driver (fluid_settings_t *settings, handle_midi_event_func_t handler, void *event_handler_data) |
Create a new MIDI driver instance. More... | |
FLUIDSYNTH_API void | delete_fluid_midi_driver (fluid_midi_driver_t *driver) |
Delete a MIDI driver instance. More... | |
FLUIDSYNTH_API fluid_player_t * | new_fluid_player (fluid_synth_t *synth) |
Create a new MIDI player. More... | |
FLUIDSYNTH_API int | delete_fluid_player (fluid_player_t *player) |
Delete a MIDI player instance. More... | |
FLUIDSYNTH_API int | fluid_player_add (fluid_player_t *player, const char *midifile) |
Add a MIDI file to a player queue. More... | |
FLUIDSYNTH_API int | fluid_player_add_mem (fluid_player_t *player, const void *buffer, size_t len) |
Add a MIDI file to a player queue, from a buffer in memory. More... | |
FLUIDSYNTH_API int | fluid_player_play (fluid_player_t *player) |
Activates play mode for a MIDI player if not already playing. More... | |
FLUIDSYNTH_API int | fluid_player_stop (fluid_player_t *player) |
Stops a MIDI player. More... | |
FLUIDSYNTH_API int | fluid_player_join (fluid_player_t *player) |
Wait for a MIDI player to terminate (when done playing). More... | |
FLUIDSYNTH_API int | fluid_player_set_loop (fluid_player_t *player, int loop) |
Enable looping of a MIDI player. More... | |
FLUIDSYNTH_API int | fluid_player_set_midi_tempo (fluid_player_t *player, int tempo) |
Set the tempo of a MIDI player. More... | |
FLUIDSYNTH_API int | fluid_player_set_bpm (fluid_player_t *player, int bpm) |
Set the tempo of a MIDI player in beats per minute. More... | |
FLUIDSYNTH_API int | fluid_player_set_playback_callback (fluid_player_t *player, handle_midi_event_func_t handler, void *handler_data) |
Change the MIDI callback function. More... | |
FLUIDSYNTH_API int | fluid_player_get_status (fluid_player_t *player) |
Get MIDI player status. More... | |
FLUIDSYNTH_API int | fluid_player_get_current_tick (fluid_player_t *player) |
Get the number of tempo ticks passed. More... | |
FLUIDSYNTH_API int | fluid_player_get_total_ticks (fluid_player_t *player) |
Looks through all available MIDI tracks and gets the absolute tick of the very last event to play. More... | |
FLUIDSYNTH_API int | fluid_player_get_bpm (fluid_player_t *player) |
Get the tempo of a MIDI player in beats per minute. More... | |
FLUIDSYNTH_API int | fluid_player_get_midi_tempo (fluid_player_t *player) |
Get the tempo of a MIDI player. More... | |
Functions for MIDI events, drivers and MIDI file playback.
typedef int(* handle_midi_event_func_t) (void *data, fluid_midi_event_t *event) |
Generic callback function for MIDI events.
data | User defined data pointer |
event | The MIDI event |
Will be used between
MIDI router rule type.
enum fluid_player_status |
FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event | ( | void | ) |
Create a MIDI event structure.
References FLUID_ERR.
FLUIDSYNTH_API int delete_fluid_midi_event | ( | fluid_midi_event_t * | evt | ) |
Delete MIDI event structure.
evt | MIDI event structure |
References FLUID_OK.
Referenced by fluid_midi_event_set_sysex().
FLUIDSYNTH_API int fluid_midi_event_set_type | ( | fluid_midi_event_t * | evt, |
int | type | ||
) |
Set the event type field of a MIDI event structure.
evt | MIDI event structure |
type | Event type field (MIDI status byte without channel) |
References FLUID_OK.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_get_type | ( | fluid_midi_event_t * | evt | ) |
Get the event type field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_channel | ( | fluid_midi_event_t * | evt, |
int | chan | ||
) |
Set the channel field of a MIDI event structure.
evt | MIDI event structure |
chan | MIDI channel field |
References FLUID_OK.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_get_channel | ( | fluid_midi_event_t * | evt | ) |
Get the channel field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_get_key | ( | fluid_midi_event_t * | evt | ) |
Get the key field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_key | ( | fluid_midi_event_t * | evt, |
int | v | ||
) |
FLUIDSYNTH_API int fluid_midi_event_get_velocity | ( | fluid_midi_event_t * | evt | ) |
Get the velocity field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_velocity | ( | fluid_midi_event_t * | evt, |
int | v | ||
) |
FLUIDSYNTH_API int fluid_midi_event_get_control | ( | fluid_midi_event_t * | evt | ) |
Get the control number of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_control | ( | fluid_midi_event_t * | evt, |
int | v | ||
) |
FLUIDSYNTH_API int fluid_midi_event_get_value | ( | fluid_midi_event_t * | evt | ) |
Get the value field from a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_value | ( | fluid_midi_event_t * | evt, |
int | v | ||
) |
FLUIDSYNTH_API int fluid_midi_event_get_program | ( | fluid_midi_event_t * | evt | ) |
Get the program field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_program | ( | fluid_midi_event_t * | evt, |
int | val | ||
) |
FLUIDSYNTH_API int fluid_midi_event_get_pitch | ( | fluid_midi_event_t * | evt | ) |
Get the pitch field of a MIDI event structure.
evt | MIDI event structure |
Referenced by fluid_sequencer_add_midi_event_to_buffer(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_event_set_pitch | ( | fluid_midi_event_t * | evt, |
int | val | ||
) |
Set the pitch field of a MIDI event structure.
evt | MIDI event structure |
val | Pitch value (14 bit value, 0-16383, 8192 is center) |
References FLUID_OK.
FLUIDSYNTH_API int fluid_midi_event_set_sysex | ( | fluid_midi_event_t * | evt, |
void * | data, | ||
int | size, | ||
int | dynamic | ||
) |
Assign sysex data to a MIDI event structure.
evt | MIDI event structure |
data | Pointer to SYSEX data |
size | Size of SYSEX data |
dynamic | TRUE if the SYSEX data has been dynamically allocated and should be freed when the event is freed (only applies if event gets destroyed with delete_fluid_midi_event()) |
References delete_fluid_midi_event(), FLUID_ERR, FLUID_FAILED, FLUID_OK, and fluid_player_set_midi_tempo().
Referenced by fluid_player_get_midi_tempo().
FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router | ( | fluid_settings_t * | settings, |
handle_midi_event_func_t | handler, | ||
void * | event_handler_data | ||
) |
Create a new midi router.
The default rules will pass all events unmodified.
settings | Settings used to configure MIDI router |
handler | MIDI event callback. |
event_handler_data | Caller defined data pointer which gets passed to 'handler' |
The MIDI handler callback should process the possibly filtered/modified MIDI events from the MIDI router and forward them on to a synthesizer for example. The function fluid_synth_handle_midi_event() can be used for handle and a fluid_synth_t passed as the event_handler_data parameter for this purpose.
References delete_fluid_midi_router(), FLUID_ERR, FLUID_MIDI_ROUTER_RULE_COUNT, fluid_settings_getint(), and new_fluid_midi_router_rule().
FLUIDSYNTH_API int delete_fluid_midi_router | ( | fluid_midi_router_t * | router | ) |
Delete a MIDI router instance.
router | MIDI router to delete |
References FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.
Referenced by new_fluid_midi_router().
FLUIDSYNTH_API int fluid_midi_router_set_default_rules | ( | fluid_midi_router_t * | router | ) |
Set a MIDI router to use default "unity" rules.
Such a router will pass all events unmodified.
router | Router to set to default rules. |
References delete_fluid_midi_router_rule(), FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, FLUID_OK, and new_fluid_midi_router_rule().
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_router_clear_rules | ( | fluid_midi_router_t * | router | ) |
Clear all rules in a MIDI router.
Such a router will drop all events until rules are added.
router | Router to clear all rules from |
References FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_router_add_rule | ( | fluid_midi_router_t * | router, |
fluid_midi_router_rule_t * | rule, | ||
int | type | ||
) |
Add a rule to a MIDI router.
router | MIDI router |
rule | Rule to add (used directly and should not be accessed again following a successful call to this function). |
type | The type of rule to add (fluid_midi_router_rule_type) |
References FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API fluid_midi_router_rule_t* new_fluid_midi_router_rule | ( | void | ) |
Create a new MIDI router rule.
The new rule is a "unity" rule which will accept any values and wont modify them.
References FLUID_ERR.
Referenced by fluid_midi_router_handle_midi_event(), fluid_midi_router_set_default_rules(), and new_fluid_midi_router().
FLUIDSYNTH_API void delete_fluid_midi_router_rule | ( | fluid_midi_router_rule_t * | rule | ) |
Free a MIDI router rule.
rule | Router rule to free |
Note that rules which have been added to a router are managed by the router, so this function should seldom be needed.
Referenced by fluid_midi_router_handle_midi_event(), and fluid_midi_router_set_default_rules().
FLUIDSYNTH_API void fluid_midi_router_rule_set_chan | ( | fluid_midi_router_rule_t * | rule, |
int | min, | ||
int | max, | ||
float | mul, | ||
int | add | ||
) |
Set the channel portion of a rule.
rule | MIDI router rule |
min | Minimum value for rule match |
max | Maximum value for rule match |
mul | Value which is multiplied by matching event's channel value (1.0 to not modify) |
add | Value which is added to matching event's channel value (0 to not modify) |
The min and max parameters define a channel range window to match incoming events to. If min is less than or equal to max then an event is matched if its channel is within the defined range (including min and max). If min is greater than max then rule is inverted and matches everything except in between the defined range (so min and max would match).
The mul and add values are used to modify event channel values prior to sending the event, if the rule matches.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API void fluid_midi_router_rule_set_param1 | ( | fluid_midi_router_rule_t * | rule, |
int | min, | ||
int | max, | ||
float | mul, | ||
int | add | ||
) |
Set the first parameter portion of a rule.
rule | MIDI router rule |
min | Minimum value for rule match |
max | Maximum value for rule match |
mul | Value which is multiplied by matching event's 1st parameter value (1.0 to not modify) |
add | Value which is added to matching event's 1st parameter value (0 to not modify) |
The 1st parameter of an event depends on the type of event. For note events its the MIDI note #, for CC events its the MIDI control number, for program change events its the MIDI program #, for pitch bend events its the bend value, for channel pressure its the channel pressure value and for key pressure its the MIDI note number.
Pitch bend values have a maximum value of 16383 (8192 is pitch bend center) and all other events have a max of 127. All events have a minimum value of 0.
The min and max parameters define a parameter range window to match incoming events to. If min is less than or equal to max then an event is matched if its 1st parameter is within the defined range (including min and max). If min is greater than max then rule is inverted and matches everything except in between the defined range (so min and max would match).
The mul and add values are used to modify event 1st parameter values prior to sending the event, if the rule matches.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API void fluid_midi_router_rule_set_param2 | ( | fluid_midi_router_rule_t * | rule, |
int | min, | ||
int | max, | ||
float | mul, | ||
int | add | ||
) |
Set the second parameter portion of a rule.
rule | MIDI router rule |
min | Minimum value for rule match |
max | Maximum value for rule match |
mul | Value which is multiplied by matching event's 2nd parameter value (1.0 to not modify) |
add | Value which is added to matching event's 2nd parameter value (0 to not modify) |
The 2nd parameter of an event depends on the type of event. For note events its the MIDI velocity, for CC events its the control value and for key pressure events its the key pressure value. All other types lack a 2nd parameter.
All applicable 2nd parameters have the range 0-127.
The min and max parameters define a parameter range window to match incoming events to. If min is less than or equal to max then an event is matched if its 2nd parameter is within the defined range (including min and max). If min is greater than max then rule is inverted and matches everything except in between the defined range (so min and max would match).
The mul and add values are used to modify event 2nd parameter values prior to sending the event, if the rule matches.
Referenced by fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_router_handle_midi_event | ( | void * | data, |
fluid_midi_event_t * | event | ||
) |
Handle a MIDI event through a MIDI router instance.
data | MIDI router instance fluid_midi_router_t, its a void * so that this function can be used as a callback for other subsystems (new_fluid_midi_driver() for example). |
event | MIDI event to handle |
Purpose: The midi router is called for each event, that is received via the 'physical' midi input. Each event can trigger an arbitrary number of generated events (one for each rule that matches).
In default mode, a noteon event is just forwarded to the synth's 'noteon' function, a 'CC' event to the synth's 'CC' function and so on.
The router can be used to:
References delete_fluid_midi_router_rule(), FLUID_FAILED, fluid_midi_event_set_channel(), fluid_midi_event_set_type(), fluid_midi_router_add_rule(), fluid_midi_router_clear_rules(), FLUID_MIDI_ROUTER_RULE_CC, FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, FLUID_MIDI_ROUTER_RULE_NOTE, FLUID_MIDI_ROUTER_RULE_PITCH_BEND, FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, fluid_midi_router_rule_set_chan(), fluid_midi_router_rule_set_param1(), fluid_midi_router_rule_set_param2(), fluid_midi_router_set_default_rules(), FLUID_OK, and new_fluid_midi_router_rule().
Referenced by fluid_midi_dump_prerouter().
FLUIDSYNTH_API int fluid_midi_dump_prerouter | ( | void * | data, |
fluid_midi_event_t * | event | ||
) |
MIDI event callback function to display event information to stdout.
data | MIDI router instance |
event | MIDI event data |
An implementation of the handle_midi_event_func_t function type, used for displaying MIDI event information between the MIDI driver and router to stdout. Useful for adding into a MIDI router chain for debugging MIDI events.
References fluid_midi_router_handle_midi_event().
FLUIDSYNTH_API int fluid_midi_dump_postrouter | ( | void * | data, |
fluid_midi_event_t * | event | ||
) |
MIDI event callback function to display event information to stdout.
data | MIDI router instance |
event | MIDI event data |
An implementation of the handle_midi_event_func_t function type, used for displaying MIDI event information between the MIDI driver and router to stdout. Useful for adding into a MIDI router chain for debugging MIDI events.
References fluid_synth_handle_midi_event().
FLUIDSYNTH_API fluid_midi_driver_t* new_fluid_midi_driver | ( | fluid_settings_t * | settings, |
handle_midi_event_func_t | handler, | ||
void * | event_handler_data | ||
) |
Create a new MIDI driver instance.
settings | Settings used to configure new MIDI driver. |
handler | MIDI handler callback (for example: fluid_midi_router_handle_midi_event() for MIDI router) |
event_handler_data | Caller defined data to pass to 'handler' |
References FLUID_DBG, FLUID_ERR, fluid_settings_option_concat(), and fluid_settings_str_equal().
FLUIDSYNTH_API void delete_fluid_midi_driver | ( | fluid_midi_driver_t * | driver | ) |
Delete a MIDI driver instance.
driver | MIDI driver to delete |
FLUIDSYNTH_API fluid_player_t* new_fluid_player | ( | fluid_synth_t * | synth | ) |
Create a new MIDI player.
synth | Fluid synthesizer instance to create player for |
References FLUID_ERR, FLUID_PLAYER_READY, fluid_player_set_playback_callback(), fluid_settings_getint(), fluid_settings_str_equal(), and fluid_synth_handle_midi_event().
FLUIDSYNTH_API int delete_fluid_player | ( | fluid_player_t * | player | ) |
Delete a MIDI player instance.
player | MIDI player instance |
References FLUID_FAILED, FLUID_HINT_TOGGLED, FLUID_OK, and fluid_player_stop().
FLUIDSYNTH_API int fluid_player_add | ( | fluid_player_t * | player, |
const char * | midifile | ||
) |
Add a MIDI file to a player queue.
player | MIDI player instance |
midifile | File name of the MIDI file to add |
References FLUID_FAILED, FLUID_OK, and FLUID_PANIC.
FLUIDSYNTH_API int fluid_player_add_mem | ( | fluid_player_t * | player, |
const void * | buffer, | ||
size_t | len | ||
) |
Add a MIDI file to a player queue, from a buffer in memory.
player | MIDI player instance |
buffer | Pointer to memory containing the bytes of a complete MIDI file. The data is copied, so the caller may free or modify it immediately without affecting the playlist. |
len | Length of the buffer, in bytes. |
References FLUID_DBG, FLUID_ERR, FLUID_FAILED, FLUID_OK, FLUID_PANIC, FLUID_PLAYER_DONE, FLUID_PLAYER_PLAYING, fluid_player_set_midi_tempo(), and fluid_synth_system_reset().
FLUIDSYNTH_API int fluid_player_play | ( | fluid_player_t * | player | ) |
Activates play mode for a MIDI player if not already playing.
player | MIDI player instance |
References FLUID_FAILED, FLUID_OK, and FLUID_PLAYER_PLAYING.
FLUIDSYNTH_API int fluid_player_stop | ( | fluid_player_t * | player | ) |
Stops a MIDI player.
player | MIDI player instance |
References FLUID_OK, and FLUID_PLAYER_DONE.
Referenced by delete_fluid_player().
FLUIDSYNTH_API int fluid_player_join | ( | fluid_player_t * | player | ) |
Wait for a MIDI player to terminate (when done playing).
player | MIDI player instance |
References FLUID_OK, and FLUID_PLAYER_DONE.
FLUIDSYNTH_API int fluid_player_set_loop | ( | fluid_player_t * | player, |
int | loop | ||
) |
Enable looping of a MIDI player.
player | MIDI player instance |
loop | Times left to loop the playlist. -1 means loop infinitely. |
For example, if you want to loop the playlist twice, set loop to 2 and call this function before you start the player.
References FLUID_OK.
FLUIDSYNTH_API int fluid_player_set_midi_tempo | ( | fluid_player_t * | player, |
int | tempo | ||
) |
Set the tempo of a MIDI player.
player | MIDI player instance |
tempo | Tempo to set playback speed to (in microseconds per quarter note, as per MIDI file spec) |
References FLUID_DBG, and FLUID_OK.
Referenced by fluid_midi_event_set_sysex(), fluid_player_add_mem(), and fluid_player_set_bpm().
FLUIDSYNTH_API int fluid_player_set_bpm | ( | fluid_player_t * | player, |
int | bpm | ||
) |
Set the tempo of a MIDI player in beats per minute.
player | MIDI player instance |
bpm | Tempo in beats per minute |
References fluid_player_set_midi_tempo().
FLUIDSYNTH_API int fluid_player_set_playback_callback | ( | fluid_player_t * | player, |
handle_midi_event_func_t | handler, | ||
void * | handler_data | ||
) |
Change the MIDI callback function.
This is usually set to fluid_synth_handle_midi_event, but can optionally be changed to a user-defined function instead, for intercepting all MIDI messages sent to the synth. You can also use a midi router as the callback function to modify the MIDI messages before sending them to the synth.
player | MIDI player instance |
handler | Pointer to callback function |
handler_data | Parameter sent to the callback function |
References FLUID_OK.
Referenced by new_fluid_player().
FLUIDSYNTH_API int fluid_player_get_status | ( | fluid_player_t * | player | ) |
Get MIDI player status.
player | MIDI player instance |
FLUIDSYNTH_API int fluid_player_get_current_tick | ( | fluid_player_t * | player | ) |
Get the number of tempo ticks passed.
player | MIDI player instance |
FLUIDSYNTH_API int fluid_player_get_total_ticks | ( | fluid_player_t * | player | ) |
Looks through all available MIDI tracks and gets the absolute tick of the very last event to play.
player | MIDI player instance |
FLUIDSYNTH_API int fluid_player_get_bpm | ( | fluid_player_t * | player | ) |
Get the tempo of a MIDI player in beats per minute.
player | MIDI player instance |
FLUIDSYNTH_API int fluid_player_get_midi_tempo | ( | fluid_player_t * | player | ) |
Get the tempo of a MIDI player.
player | MIDI player instance |
References FLUID_ERR, fluid_midi_event_set_sysex(), and FLUID_OK.