Typedefs | |
typedef int(* | handle_midi_event_func_t )(void *data, fluid_midi_event_t *event) |
Generic callback function for MIDI events. | |
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. | |
FLUIDSYNTH_API int | delete_fluid_midi_event (fluid_midi_event_t *event) |
Delete MIDI event structure. | |
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. | |
FLUIDSYNTH_API int | fluid_midi_event_get_type (fluid_midi_event_t *evt) |
Get the event type field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_channel (fluid_midi_event_t *evt, int chan) |
Set the channel field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_channel (fluid_midi_event_t *evt) |
Get the channel field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_key (fluid_midi_event_t *evt) |
Get the key field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_key (fluid_midi_event_t *evt, int key) |
Set the key field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_velocity (fluid_midi_event_t *evt) |
Get the velocity field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_velocity (fluid_midi_event_t *evt, int vel) |
Set the velocity field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_control (fluid_midi_event_t *evt) |
Get the control number of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_control (fluid_midi_event_t *evt, int ctrl) |
Set the control field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_value (fluid_midi_event_t *evt) |
Get the value field from a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_value (fluid_midi_event_t *evt, int val) |
Set the value field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_program (fluid_midi_event_t *evt) |
Get the program field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_program (fluid_midi_event_t *evt, int val) |
Set the program field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_get_pitch (fluid_midi_event_t *evt) |
Get the pitch field of a MIDI event structure. | |
FLUIDSYNTH_API int | fluid_midi_event_set_pitch (fluid_midi_event_t *evt, int val) |
Set the pitch field of a MIDI event structure. | |
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. | |
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. | |
FLUIDSYNTH_API int | delete_fluid_midi_router (fluid_midi_router_t *handler) |
Delete a MIDI router instance. | |
FLUIDSYNTH_API int | fluid_midi_router_set_default_rules (fluid_midi_router_t *router) |
Set a MIDI router to use default "unity" rules. | |
FLUIDSYNTH_API int | fluid_midi_router_clear_rules (fluid_midi_router_t *router) |
Clear all rules in a MIDI router. | |
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. | |
FLUIDSYNTH_API fluid_midi_router_rule_t * | new_fluid_midi_router_rule (void) |
Create a new MIDI router rule. | |
FLUIDSYNTH_API void | delete_fluid_midi_router_rule (fluid_midi_router_rule_t *rule) |
Free a MIDI router rule. | |
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. | |
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. | |
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. | |
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. | |
FLUIDSYNTH_API int | fluid_midi_dump_prerouter (void *data, fluid_midi_event_t *event) |
MIDI event callback function to display event information to stdout. | |
FLUIDSYNTH_API int | fluid_midi_dump_postrouter (void *data, fluid_midi_event_t *event) |
MIDI event callback function to display event information to stdout. | |
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. | |
FLUIDSYNTH_API void | delete_fluid_midi_driver (fluid_midi_driver_t *driver) |
Delete a MIDI driver instance. | |
FLUIDSYNTH_API fluid_player_t * | new_fluid_player (fluid_synth_t *synth) |
Create a new MIDI player. | |
FLUIDSYNTH_API int | delete_fluid_player (fluid_player_t *player) |
Delete a MIDI player instance. | |
FLUIDSYNTH_API int | fluid_player_add (fluid_player_t *player, const char *midifile) |
Add a MIDI file to a player queue. | |
FLUIDSYNTH_API int | fluid_player_play (fluid_player_t *player) |
Activates play mode for a MIDI player if not already playing. | |
FLUIDSYNTH_API int | fluid_player_stop (fluid_player_t *player) |
Stops a MIDI player. | |
FLUIDSYNTH_API int | fluid_player_join (fluid_player_t *player) |
Wait for a MIDI player to terminate (when done playing). | |
FLUIDSYNTH_API int | fluid_player_set_loop (fluid_player_t *player, int loop) |
Enable looping of a MIDI player. | |
FLUIDSYNTH_API int | fluid_player_set_midi_tempo (fluid_player_t *player, int tempo) |
Set the tempo of a MIDI player. | |
FLUIDSYNTH_API int | fluid_player_set_bpm (fluid_player_t *player, int bpm) |
Set the tempo of a MIDI player in beats per minute. | |
FLUIDSYNTH_API int | fluid_player_get_status (fluid_player_t *player) |
Get MIDI player status. |
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 |
MIDI router rule type.
enum fluid_player_status |
FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event | ( | void | ) |
Create a MIDI event structure.
FLUIDSYNTH_API int delete_fluid_midi_event | ( | fluid_midi_event_t * | evt | ) |
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) |
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 |
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 |
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 |
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 |
FLUIDSYNTH_API int fluid_midi_event_set_key | ( | fluid_midi_event_t * | evt, | |
int | v | |||
) |
Set the key field of a MIDI event structure.
evt | MIDI event structure | |
v | MIDI note number (0-127) |
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 |
FLUIDSYNTH_API int fluid_midi_event_set_velocity | ( | fluid_midi_event_t * | evt, | |
int | v | |||
) |
Set the velocity field of a MIDI event structure.
evt | MIDI event structure | |
v | MIDI velocity value |
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 |
FLUIDSYNTH_API int fluid_midi_event_set_control | ( | fluid_midi_event_t * | evt, | |
int | v | |||
) |
Set the control field of a MIDI event structure.
evt | MIDI event structure | |
v | MIDI control number |
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 |
FLUIDSYNTH_API int fluid_midi_event_set_value | ( | fluid_midi_event_t * | evt, | |
int | v | |||
) |
Set the value field of a MIDI event structure.
evt | MIDI event structure | |
v | Value to assign |
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 |
FLUIDSYNTH_API int fluid_midi_event_set_program | ( | fluid_midi_event_t * | evt, | |
int | val | |||
) |
Set the program field of a MIDI event structure.
evt | MIDI event structure | |
val | MIDI program number (0-127) |
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 |
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) |
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()) |
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' |
FLUIDSYNTH_API int delete_fluid_midi_router | ( | fluid_midi_router_t * | router | ) |
Delete a MIDI router instance.
router | MIDI router to delete |
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. |
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 |
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) |
FLUIDSYNTH_API fluid_midi_router_rule_t* new_fluid_midi_router_rule | ( | void | ) |
Create a new MIDI router rule.
FLUIDSYNTH_API void delete_fluid_midi_router_rule | ( | fluid_midi_router_rule_t * | rule | ) |
Free a MIDI router rule.
rule | Router rule to free |
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 mul and add values are used to modify event channel values prior to sending the event, if the rule matches.
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) |
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.
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) |
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.
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 |
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:
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 |
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 |
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' |
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 |
FLUIDSYNTH_API int delete_fluid_player | ( | fluid_player_t * | player | ) |
Delete a MIDI player instance.
player | MIDI player instance |
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 |
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 |
FLUIDSYNTH_API int fluid_player_stop | ( | fluid_player_t * | 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 |
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. |
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) |
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 |
FLUIDSYNTH_API int fluid_player_get_status | ( | fluid_player_t * | player | ) |
Get MIDI player status.
player | MIDI player instance |