libfluidsynth  2.3.5
MIDI Events

Functions to create, modify, query and delete MIDI events. More...

Lifecycle Functions for MIDI Event_linebr@{

fluid_midi_event_tnew_fluid_midi_event (void)
 Create a MIDI event structure. More...
 
void delete_fluid_midi_event (fluid_midi_event_t *event)
 Delete MIDI event structure. More...
 

Functions

int fluid_midi_event_get_channel (const fluid_midi_event_t *evt)
 Get the channel field of a MIDI event structure. More...
 
int fluid_midi_event_get_control (const fluid_midi_event_t *evt)
 Get the control number of a MIDI event structure. More...
 
int fluid_midi_event_get_key (const fluid_midi_event_t *evt)
 Get the key field of a MIDI event structure. More...
 
int fluid_midi_event_get_lyrics (fluid_midi_event_t *evt, void **data, int *size)
 Get the lyric of a MIDI event structure. More...
 
int fluid_midi_event_get_pitch (const fluid_midi_event_t *evt)
 Get the pitch field of a MIDI event structure. More...
 
int fluid_midi_event_get_program (const fluid_midi_event_t *evt)
 Get the program field of a MIDI event structure. More...
 
int fluid_midi_event_get_text (fluid_midi_event_t *evt, void **data, int *size)
 Get the text of a MIDI event structure. More...
 
int fluid_midi_event_get_type (const fluid_midi_event_t *evt)
 Get the event type field of a MIDI event structure. More...
 
int fluid_midi_event_get_value (const fluid_midi_event_t *evt)
 Get the value field from a MIDI event structure. More...
 
int fluid_midi_event_get_velocity (const fluid_midi_event_t *evt)
 Get the velocity field of a MIDI event structure. More...
 
int fluid_midi_event_set_channel (fluid_midi_event_t *evt, int chan)
 Set the channel field of a MIDI event structure. More...
 
int fluid_midi_event_set_control (fluid_midi_event_t *evt, int ctrl)
 Set the control field of a MIDI event structure. More...
 
int fluid_midi_event_set_key (fluid_midi_event_t *evt, int key)
 Set the key field of a MIDI event structure. More...
 
int fluid_midi_event_set_lyrics (fluid_midi_event_t *evt, void *data, int size, int dynamic)
 Assign lyric data to a MIDI event structure. More...
 
int fluid_midi_event_set_pitch (fluid_midi_event_t *evt, int val)
 Set the pitch field of a MIDI event structure. More...
 
int fluid_midi_event_set_program (fluid_midi_event_t *evt, int val)
 Set the program field of a MIDI event structure. More...
 
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...
 
int fluid_midi_event_set_text (fluid_midi_event_t *evt, void *data, int size, int dynamic)
 Assign text data to a MIDI event structure. More...
 
int fluid_midi_event_set_type (fluid_midi_event_t *evt, int type)
 Set the event type field of a MIDI event structure. More...
 
int fluid_midi_event_set_value (fluid_midi_event_t *evt, int val)
 Set the value field of a MIDI event structure. More...
 
int fluid_midi_event_set_velocity (fluid_midi_event_t *evt, int vel)
 Set the velocity field of a MIDI event structure. More...
 

Detailed Description

Functions to create, modify, query and delete MIDI events.

These functions are intended to be used in MIDI routers and other filtering and processing functions in the MIDI event path. If you want to simply send MIDI messages to the synthesizer, you can use the more convenient MIDI Channel Messages interface.

Function Documentation

◆ delete_fluid_midi_event()

void delete_fluid_midi_event ( fluid_midi_event_t evt)

Delete MIDI event structure.

Parameters
evtMIDI event structure

◆ fluid_midi_event_get_channel()

int fluid_midi_event_get_channel ( const fluid_midi_event_t evt)

Get the channel field of a MIDI event structure.

Parameters
evtMIDI event structure
Returns
Channel field

◆ fluid_midi_event_get_control()

int fluid_midi_event_get_control ( const fluid_midi_event_t evt)

Get the control number of a MIDI event structure.

Parameters
evtMIDI event structure
Returns
MIDI control number

◆ fluid_midi_event_get_key()

int fluid_midi_event_get_key ( const fluid_midi_event_t evt)

Get the key field of a MIDI event structure.

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

◆ fluid_midi_event_get_lyrics()

int fluid_midi_event_get_lyrics ( fluid_midi_event_t evt,
void **  data,
int *  size 
)

Get the lyric of a MIDI event structure.

Parameters
evtMIDI event structure
dataPointer to return lyric data on.
sizePointer to return lyric size on.
Returns
Returns FLUID_OK if data and size previously set by fluid_midi_event_set_lyrics() have been successfully retrieved. Else FLUID_FAILED is returned and data and size are not changed.
Since
2.0.3

◆ fluid_midi_event_get_pitch()

int fluid_midi_event_get_pitch ( const fluid_midi_event_t evt)

Get the pitch field of a MIDI event structure.

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

◆ fluid_midi_event_get_program()

int fluid_midi_event_get_program ( const fluid_midi_event_t evt)

Get the program field of a MIDI event structure.

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

◆ fluid_midi_event_get_text()

int fluid_midi_event_get_text ( fluid_midi_event_t evt,
void **  data,
int *  size 
)

Get the text of a MIDI event structure.

Parameters
evtMIDI event structure
dataPointer to return text data on.
sizePointer to return text size on.
Returns
Returns FLUID_OK if data and size previously set by fluid_midi_event_set_text() have been successfully retrieved. Else FLUID_FAILED is returned and data and size are not changed.
Since
2.0.3

◆ fluid_midi_event_get_type()

int fluid_midi_event_get_type ( const fluid_midi_event_t evt)

Get the event type field of a MIDI event structure.

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

◆ fluid_midi_event_get_value()

int fluid_midi_event_get_value ( const fluid_midi_event_t evt)

Get the value field from a MIDI event structure.

Parameters
evtMIDI event structure
Returns
Value field

◆ fluid_midi_event_get_velocity()

int fluid_midi_event_get_velocity ( const fluid_midi_event_t evt)

Get the velocity field of a MIDI event structure.

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

◆ fluid_midi_event_set_channel()

int fluid_midi_event_set_channel ( fluid_midi_event_t evt,
int  chan 
)

Set the channel field of a MIDI event structure.

Parameters
evtMIDI event structure
chanMIDI channel field
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_control()

int fluid_midi_event_set_control ( fluid_midi_event_t evt,
int  v 
)

Set the control field of a MIDI event structure.

Parameters
evtMIDI event structure
vMIDI control number
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_key()

int fluid_midi_event_set_key ( fluid_midi_event_t evt,
int  v 
)

Set the key field of a MIDI event structure.

Parameters
evtMIDI event structure
vMIDI note number (0-127)
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_lyrics()

int fluid_midi_event_set_lyrics ( fluid_midi_event_t evt,
void *  data,
int  size,
int  dynamic 
)

Assign lyric data to a MIDI event structure.

Parameters
evtMIDI event structure
dataPointer to lyric data
sizeSize of lyric data in bytes
dynamicTRUE if the data has been dynamically allocated and should be freed when the event is freed via delete_fluid_midi_event()
Returns
Always returns FLUID_OK
Since
2.0.0

◆ fluid_midi_event_set_pitch()

int fluid_midi_event_set_pitch ( fluid_midi_event_t evt,
int  val 
)

Set the pitch field of a MIDI event structure.

Parameters
evtMIDI event structure
valPitch value (14 bit value, 0-16383, 8192 is center)
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_program()

int fluid_midi_event_set_program ( fluid_midi_event_t evt,
int  val 
)

Set the program field of a MIDI event structure.

Parameters
evtMIDI event structure
valMIDI program number (0-127)
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_sysex()

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
evtMIDI event structure
dataPointer to SYSEX data
sizeSize of SYSEX data in bytes
dynamicTRUE 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

◆ fluid_midi_event_set_text()

int fluid_midi_event_set_text ( fluid_midi_event_t evt,
void *  data,
int  size,
int  dynamic 
)

Assign text data to a MIDI event structure.

Parameters
evtMIDI event structure
dataPointer to text data
sizeSize of text data in bytes
dynamicTRUE if the data has been dynamically allocated and should be freed when the event is freed via delete_fluid_midi_event()
Returns
Always returns FLUID_OK
Since
2.0.0

◆ fluid_midi_event_set_type()

int fluid_midi_event_set_type ( fluid_midi_event_t evt,
int  type 
)

Set the event type field of a MIDI event structure.

Parameters
evtMIDI event structure
typeEvent type field (MIDI status byte without channel)
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_value()

int fluid_midi_event_set_value ( fluid_midi_event_t evt,
int  v 
)

Set the value field of a MIDI event structure.

Parameters
evtMIDI event structure
vValue to assign
Returns
Always returns FLUID_OK

◆ fluid_midi_event_set_velocity()

int fluid_midi_event_set_velocity ( fluid_midi_event_t evt,
int  v 
)

Set the velocity field of a MIDI event structure.

Parameters
evtMIDI event structure
vMIDI velocity value
Returns
Always returns FLUID_OK

◆ new_fluid_midi_event()

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.