libfluidsynth
2.3.5
|
MIDI Input Subsystem. More...
Modules | |
MIDI Driver | |
Functions for managing MIDI drivers. | |
MIDI Events | |
Functions to create, modify, query and delete MIDI events. | |
MIDI File Player | |
Parse standard MIDI files and emit MIDI events. | |
MIDI Router | |
Rule based transformation and filtering of MIDI events. | |
Typedefs | |
typedef int(* | handle_midi_event_func_t) (void *data, fluid_midi_event_t *event) |
Generic callback function for MIDI event handler. More... | |
typedef int(* | handle_midi_tick_func_t) (void *data, int tick) |
Generic callback function fired once by MIDI tick change. More... | |
Functions | |
int | fluid_synth_handle_midi_event (void *data, fluid_midi_event_t *event) |
Handle MIDI event from MIDI router, used as a callback function. More... | |
MIDI Input Subsystem.
There are multiple ways to send MIDI events to the synthesizer. They can come from MIDI files, from external MIDI sequencers or raw MIDI event sources, can be modified via MIDI routers and also generated manually.
The interface connecting all sources and sinks of MIDI events in libfluidsynth is handle_midi_event_func_t.
typedef int(* handle_midi_event_func_t) (void *data, fluid_midi_event_t *event) |
Generic callback function for MIDI event handler.
data | User defined data pointer |
event | The MIDI event |
This callback is used to pass MIDI events
Additionally, there is a translation layer to pass MIDI events to a MIDI Sequencer via fluid_sequencer_add_midi_event_to_buffer().
typedef int(* handle_midi_tick_func_t) (void *data, int tick) |
Generic callback function fired once by MIDI tick change.
data | User defined data pointer |
tick | The current (zero-based) tick, which triggered the callback |
This callback is fired at a constant rate depending on the current BPM and PPQ. e.g. for PPQ = 192 and BPM = 140 the callback is fired 192 * 140 times per minute (448/sec).
It can be used to sync external elements with the beat, or stop / loop the song on a given tick. Ticks being BPM-dependent, you can manipulate values such as bars or beats, without having to care about BPM.
For example, this callback loops the song whenever it reaches the 5th bar :
int fluid_synth_handle_midi_event | ( | void * | data, |
fluid_midi_event_t * | event | ||
) |
Handle MIDI event from MIDI router, used as a callback function.
data | FluidSynth instance |
event | MIDI event to handle |