midi.h File Reference

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.

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_tnew_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_tnew_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.

Detailed Description

Functions for MIDI events, drivers and MIDI file playback.


Typedef Documentation

typedef int(* handle_midi_event_func_t)(void *data, fluid_midi_event_t *event)

Generic callback function for MIDI events.

Parameters:
data User defined data pointer
event The MIDI event
Returns:
Should return FLUID_OK on success, FLUID_FAILED otherwise

Will be used between

  • MIDI driver and MIDI router
  • MIDI router and synth to communicate events. In the not-so-far future...

Enumeration Type Documentation

MIDI router rule type.

Since:
1.1.0
Enumerator:
FLUID_MIDI_ROUTER_RULE_NOTE 

MIDI note rule.

FLUID_MIDI_ROUTER_RULE_CC 

MIDI controller rule.

FLUID_MIDI_ROUTER_RULE_PROG_CHANGE 

MIDI program change rule.

FLUID_MIDI_ROUTER_RULE_PITCH_BEND 

MIDI pitch bend rule.

FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE 

MIDI channel pressure rule.

FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE 

MIDI key pressure rule.

FLUID_MIDI_ROUTER_RULE_COUNT 

Total count of rule types.

MIDI player status enum.

Since:
1.1.0
Enumerator:
FLUID_PLAYER_READY 

Player is ready.

FLUID_PLAYER_PLAYING 

Player is currently playing.

FLUID_PLAYER_DONE 

Player is finished playing.


Function Documentation

FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event ( void   ) 

Create a MIDI event structure.

Returns:
New MIDI event structure or NULL when out of memory.

References FLUID_ERR, and new_fluid_midi_event().

Referenced by new_fluid_midi_event().

FLUIDSYNTH_API int delete_fluid_midi_event ( fluid_midi_event_t evt  ) 

Delete MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
Always returns FLUID_OK

References delete_fluid_midi_event(), and FLUID_OK.

Referenced by delete_fluid_midi_event().

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.

Parameters:
evt MIDI event structure
type Event type field (MIDI status byte without channel)
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_type(), and FLUID_OK.

Referenced by fluid_midi_event_set_type(), and 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.

Parameters:
evt MIDI event structure
Returns:
Event type field (MIDI status byte without channel)

References fluid_midi_event_get_type().

Referenced by fluid_midi_event_get_type(), 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.

Parameters:
evt MIDI event structure
chan MIDI channel field
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_channel(), and FLUID_OK.

Referenced by fluid_midi_event_set_channel(), and 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.

Parameters:
evt MIDI event structure
Returns:
Channel field

References fluid_midi_event_get_channel().

Referenced by fluid_midi_event_get_channel(), 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.

Parameters:
evt MIDI event structure
Returns:
MIDI note number (0-127)

References fluid_midi_event_get_key().

Referenced by fluid_midi_event_get_key(), 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 
)

Set the key field of a MIDI event structure.

Parameters:
evt MIDI event structure
v MIDI note number (0-127)
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_key(), and FLUID_OK.

Referenced by fluid_midi_event_set_key().

FLUIDSYNTH_API int fluid_midi_event_get_velocity ( fluid_midi_event_t evt  ) 

Get the velocity field of a MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
MIDI velocity number (0-127)

References fluid_midi_event_get_velocity().

Referenced by fluid_midi_event_get_velocity(), 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 
)

Set the velocity field of a MIDI event structure.

Parameters:
evt MIDI event structure
v MIDI velocity value
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_velocity(), and FLUID_OK.

Referenced by fluid_midi_event_set_velocity().

FLUIDSYNTH_API int fluid_midi_event_get_control ( fluid_midi_event_t evt  ) 

Get the control number of a MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
MIDI control number

References fluid_midi_event_get_control().

Referenced by fluid_midi_event_get_control(), 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 
)

Set the control field of a MIDI event structure.

Parameters:
evt MIDI event structure
v MIDI control number
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_control(), and FLUID_OK.

Referenced by fluid_midi_event_set_control().

FLUIDSYNTH_API int fluid_midi_event_get_value ( fluid_midi_event_t evt  ) 

Get the value field from a MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
Value field

References fluid_midi_event_get_value().

Referenced by fluid_midi_event_get_value(), 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 
)

Set the value field of a MIDI event structure.

Parameters:
evt MIDI event structure
v Value to assign
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_value(), and FLUID_OK.

Referenced by fluid_midi_event_set_value().

FLUIDSYNTH_API int fluid_midi_event_get_program ( fluid_midi_event_t evt  ) 

Get the program field of a MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
MIDI program number (0-127)

References fluid_midi_event_get_program().

Referenced by fluid_midi_event_get_program(), 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 
)

Set the program field of a MIDI event structure.

Parameters:
evt MIDI event structure
val MIDI program number (0-127)
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_program(), and FLUID_OK.

Referenced by fluid_midi_event_set_program().

FLUIDSYNTH_API int fluid_midi_event_get_pitch ( fluid_midi_event_t evt  ) 

Get the pitch field of a MIDI event structure.

Parameters:
evt MIDI event structure
Returns:
Pitch value (14 bit value, 0-16383, 8192 is center)

References fluid_midi_event_get_pitch().

Referenced by fluid_midi_event_get_pitch(), 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.

Parameters:
evt MIDI event structure
val Pitch value (14 bit value, 0-16383, 8192 is center)
Returns:
Always returns FLUID_OK

References fluid_midi_event_set_pitch(), and FLUID_OK.

Referenced by fluid_midi_event_set_pitch().

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.

Parameters:
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())
Returns:
Always returns FLUID_OK

NOTE: Unlike the other event assignment functions, this one sets evt->type.

References fluid_midi_event_set_sysex(), and FLUID_OK.

Referenced by fluid_midi_event_set_sysex().

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.

Parameters:
settings Settings used to configure MIDI router
handler MIDI event callback.
event_handler_data Caller defined data pointer which gets passed to 'handler'
Returns:
New MIDI router instance or NULL on error

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(), new_fluid_midi_router(), and new_fluid_midi_router_rule().

Referenced by new_fluid_midi_router().

FLUIDSYNTH_API int delete_fluid_midi_router ( fluid_midi_router_t router  ) 

Delete a MIDI router instance.

Parameters:
router MIDI router to delete
Returns:
Returns FLUID_OK on success, FLUID_FAILED otherwise (only if NULL router passed really)

References delete_fluid_midi_router(), FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.

Referenced by delete_fluid_midi_router(), and 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.

Parameters:
router Router to set to default rules.
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.0

References delete_fluid_midi_router_rule(), FLUID_FAILED, FLUID_MIDI_ROUTER_RULE_COUNT, fluid_midi_router_set_default_rules(), FLUID_OK, and new_fluid_midi_router_rule().

Referenced by fluid_midi_router_set_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.

Parameters:
router Router to clear all rules from
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
Since:
1.1.0

References FLUID_FAILED, fluid_midi_router_clear_rules(), FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.

Referenced by fluid_midi_router_clear_rules().

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.

Parameters:
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)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise (invalid rule for example)
Since:
1.1.0

References FLUID_FAILED, fluid_midi_router_add_rule(), FLUID_MIDI_ROUTER_RULE_COUNT, and FLUID_OK.

Referenced by fluid_midi_router_add_rule().

FLUIDSYNTH_API fluid_midi_router_rule_t* new_fluid_midi_router_rule ( void   ) 

Create a new MIDI router rule.

Returns:
Newly allocated router rule or NULL if out of memory.
Since:
1.1.0

The new rule is a "unity" rule which will accept any values and wont modify them.

References FLUID_ERR, and new_fluid_midi_router_rule().

Referenced by fluid_midi_router_set_default_rules(), new_fluid_midi_router(), and new_fluid_midi_router_rule().

FLUIDSYNTH_API void delete_fluid_midi_router_rule ( fluid_midi_router_rule_t rule  ) 

Free a MIDI router rule.

Parameters:
rule Router rule to free
Since:
1.1.0

Note that rules which have been added to a router are managed by the router, so this function should seldom be needed.

References delete_fluid_midi_router_rule().

Referenced by delete_fluid_midi_router_rule(), 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.

Parameters:
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)
Since:
1.1.0

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.

References fluid_midi_router_rule_set_chan().

Referenced by fluid_midi_router_rule_set_chan().

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.

Parameters:
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)
Since:
1.1.0

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.

References fluid_midi_router_rule_set_param1().

Referenced by fluid_midi_router_rule_set_param1().

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.

Parameters:
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)
Since:
1.1.0

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.

References fluid_midi_router_rule_set_param2().

Referenced by fluid_midi_router_rule_set_param2().

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.

Parameters:
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
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

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:

  • filter messages (for example: Pass sustain pedal CCs only to selected channels)
  • split the keyboard (noteon with notenr < x: to ch 1, >x to ch 2)
  • layer sounds (for each noteon received on ch 1, create a noteon on ch1, ch2, ch3,...)
  • velocity scaling (for each noteon event, scale the velocity by 1.27 to give DX7 users a chance)
  • velocity switching ("v <=100: Angel Choir; V > 100: Hell's Bells")
  • get rid of aftertouch
  • ...

References FLUID_FAILED, fluid_midi_event_set_channel(), fluid_midi_event_set_type(), fluid_midi_router_handle_midi_event(), 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, and FLUID_OK.

Referenced by fluid_midi_dump_prerouter(), and fluid_midi_router_handle_midi_event().

FLUIDSYNTH_API int fluid_midi_dump_prerouter ( void *  data,
fluid_midi_event_t event 
)

MIDI event callback function to display event information to stdout.

Parameters:
data MIDI router instance
event MIDI event data
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

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_dump_prerouter(), and fluid_midi_router_handle_midi_event().

Referenced by fluid_midi_dump_prerouter().

FLUIDSYNTH_API int fluid_midi_dump_postrouter ( void *  data,
fluid_midi_event_t event 
)

MIDI event callback function to display event information to stdout.

Parameters:
data MIDI router instance
event MIDI event data
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

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_dump_postrouter(), and fluid_synth_handle_midi_event().

Referenced by fluid_midi_dump_postrouter().

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.

Parameters:
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'
Returns:
New MIDI driver instance or NULL on error

References FLUID_DBG, FLUID_ERR, fluid_settings_option_concat(), fluid_settings_str_equal(), and new_fluid_midi_driver().

Referenced by new_fluid_midi_driver().

FLUIDSYNTH_API void delete_fluid_midi_driver ( fluid_midi_driver_t driver  ) 

Delete a MIDI driver instance.

Parameters:
driver MIDI driver to delete

References delete_fluid_midi_driver().

Referenced by delete_fluid_midi_driver().

FLUIDSYNTH_API fluid_player_t* new_fluid_player ( fluid_synth_t synth  ) 

Create a new MIDI player.

Parameters:
synth Fluid synthesizer instance to create player for
Returns:
New MIDI player instance or NULL on error (out of memory)

References FLUID_ERR, FLUID_PLAYER_READY, fluid_settings_getint(), fluid_settings_str_equal(), and new_fluid_player().

Referenced by new_fluid_player().

FLUIDSYNTH_API int delete_fluid_player ( fluid_player_t player  ) 

Delete a MIDI player instance.

Parameters:
player MIDI player instance
Returns:
Always returns FLUID_OK

References delete_fluid_player(), FLUID_OK, and fluid_player_stop().

Referenced by delete_fluid_player().

FLUIDSYNTH_API int fluid_player_add ( fluid_player_t player,
const char *  midifile 
)

Add a MIDI file to a player queue.

Parameters:
player MIDI player instance
midifile File name of the MIDI file to add
Returns:
FLUID_OK

References FLUID_OK, and fluid_player_add().

Referenced by fluid_player_add().

FLUIDSYNTH_API int fluid_player_play ( fluid_player_t player  ) 

Activates play mode for a MIDI player if not already playing.

Parameters:
player MIDI player instance
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED, FLUID_OK, fluid_player_play(), and FLUID_PLAYER_PLAYING.

Referenced by fluid_player_play().

FLUIDSYNTH_API int fluid_player_stop ( fluid_player_t player  ) 

Stops a MIDI player.

Parameters:
player MIDI player instance
Returns:
Always returns FLUID_OK

References FLUID_OK, FLUID_PLAYER_DONE, and fluid_player_stop().

Referenced by delete_fluid_player(), and fluid_player_stop().

FLUIDSYNTH_API int fluid_player_join ( fluid_player_t player  ) 

Wait for a MIDI player to terminate (when done playing).

Parameters:
player MIDI player instance
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_OK, FLUID_PLAYER_DONE, and fluid_player_join().

Referenced by fluid_player_join().

FLUIDSYNTH_API int fluid_player_set_loop ( fluid_player_t player,
int  loop 
)

Enable looping of a MIDI player.

Parameters:
player MIDI player instance
loop Times left to loop the playlist. -1 means loop infinitely.
Returns:
Always returns FLUID_OK
Since:
1.1.0

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, and fluid_player_set_loop().

Referenced by fluid_player_set_loop().

FLUIDSYNTH_API int fluid_player_set_midi_tempo ( fluid_player_t player,
int  tempo 
)

Set the tempo of a MIDI player.

Parameters:
player MIDI player instance
tempo Tempo to set playback speed to (in microseconds per quarter note, as per MIDI file spec)
Returns:
Always returns FLUID_OK

References FLUID_DBG, FLUID_OK, and fluid_player_set_midi_tempo().

Referenced by fluid_player_set_bpm(), and fluid_player_set_midi_tempo().

FLUIDSYNTH_API int fluid_player_set_bpm ( fluid_player_t player,
int  bpm 
)

Set the tempo of a MIDI player in beats per minute.

Parameters:
player MIDI player instance
bpm Tempo in beats per minute
Returns:
Always returns FLUID_OK

References fluid_player_set_bpm(), and fluid_player_set_midi_tempo().

Referenced by fluid_player_set_bpm().

FLUIDSYNTH_API int fluid_player_get_status ( fluid_player_t player  ) 

Get MIDI player status.

Parameters:
player MIDI player instance
Returns:
Player status (fluid_player_status)
Since:
1.1.0

References fluid_player_get_status().

Referenced by fluid_player_get_status().

Generated on Mon Sep 6 12:29:27 2010 for libfluidsynth by  doxygen 1.6.3