mk_midi_desc_initfunction
mk_midi_desc mk_midi_desc_init(void)Initialize the MIDI desc.
Returns The resulting value.
#include <modkit/midi.h>40 functions · 11 structs · 2 enums · 9 typedefs · 5 macros
Optional MIDI device I/O and SoundFont synthesis package.
mk_midi_desc_initfunctionmk_midi_desc mk_midi_desc_init(void)Initialize the MIDI desc.
Returns The resulting value.
mk_midi_device_io_availablefunctionbool mk_midi_device_io_available(void)Perform the MIDI device I/O available operation.
Returns True when the operation succeeds.
mk_midi_initfunctionmk_result mk_midi_init(const mk_midi_desc *desc)Initialize the MIDI.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_midi_desc * | Configuration descriptor. |
Returns MK_SUCCESS or an error result.
mk_midi_input_closefunctionmk_result mk_midi_input_close(mk_midi_input_t input)Close MIDI input.
| Parameter | Type | Description |
|---|---|---|
input | mk_midi_input_t | Value for input. |
Returns MK_SUCCESS or an error result.
mk_midi_input_openfunctionmk_result mk_midi_input_open(uint32_t port_index, mk_midi_input_t *out_input)Open MIDI input.
| Parameter | Type | Description |
|---|---|---|
port_index | uint32_t | Value for port index. |
out_input | mk_midi_input_t * | Receives the input. |
Returns MK_SUCCESS or an error result.
mk_midi_input_pollfunctionmk_result mk_midi_input_poll(mk_midi_input_t input, mk_midi_message *out_message)Poll MIDI input.
| Parameter | Type | Description |
|---|---|---|
input | mk_midi_input_t | Value for input. |
out_message | mk_midi_message * | Receives the message. |
Returns MK_SUCCESS or an error result.
mk_midi_input_port_countfunctionuint32_t mk_midi_input_port_count(void)Perform the MIDI input port count operation.
Returns The resulting value.
mk_midi_input_port_infofunctionmk_result mk_midi_input_port_info(uint32_t index, mk_midi_port_info *out_info)Perform the MIDI input port info operation.
| Parameter | Type | Description |
|---|---|---|
index | uint32_t | Zero-based index. |
out_info | mk_midi_port_info * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_midi_is_initializedfunctionbool mk_midi_is_initialized(void)Test whether the MIDI is initialized.
Returns True when the condition holds.
mk_midi_output_closefunctionmk_result mk_midi_output_close(mk_midi_output_t output)Close MIDI output.
| Parameter | Type | Description |
|---|---|---|
output | mk_midi_output_t | Value for output. |
Returns MK_SUCCESS or an error result.
mk_midi_output_openfunctionmk_result mk_midi_output_open(uint32_t port_index, mk_midi_output_t *out_output)Open MIDI output.
| Parameter | Type | Description |
|---|---|---|
port_index | uint32_t | Value for port index. |
out_output | mk_midi_output_t * | Receives the output. |
Returns MK_SUCCESS or an error result.
mk_midi_output_port_countfunctionuint32_t mk_midi_output_port_count(void)Perform the MIDI output port count operation.
Returns The resulting value.
mk_midi_output_port_infofunctionmk_result mk_midi_output_port_info(uint32_t index, mk_midi_port_info *out_info)Perform the MIDI output port info operation.
| Parameter | Type | Description |
|---|---|---|
index | uint32_t | Zero-based index. |
out_info | mk_midi_port_info * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_midi_output_sendfunctionmk_result mk_midi_output_send(mk_midi_output_t output, const uint8_t *bytes, size_t size)Send MIDI output.
| Parameter | Type | Description |
|---|---|---|
output | mk_midi_output_t | Value for output. |
bytes | const uint8_t * | Value for bytes. |
size | size_t | Size in bytes. |
Returns MK_SUCCESS or an error result.
mk_midi_player_createfunctionmk_result mk_midi_player_create(const mk_midi_player_desc *desc, mk_midi_player_t *out_player)Create MIDI player.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_midi_player_desc * | Configuration descriptor. |
out_player | mk_midi_player_t * | Receives the player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_desc_initfunctionmk_midi_player_desc mk_midi_player_desc_init(mk_midi_sequence_t sequence, mk_midi_synth_t synth)Initialize the MIDI player desc.
| Parameter | Type | Description |
|---|---|---|
sequence | mk_midi_sequence_t | Value for sequence. |
synth | mk_midi_synth_t | Value for synth. |
Returns The resulting value.
mk_midi_player_destroyfunctionmk_result mk_midi_player_destroy(mk_midi_player_t player)Destroy the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_get_durationfunctiondouble mk_midi_player_get_duration(mk_midi_player_t player)Get duration from the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns The resulting value.
mk_midi_player_get_positionfunctiondouble mk_midi_player_get_position(mk_midi_player_t player)Get position from the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns The resulting value.
mk_midi_player_get_statefunctionmk_midi_player_state mk_midi_player_get_state(mk_midi_player_t player)Get state from the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns The resulting value.
mk_midi_player_pausefunctionmk_result mk_midi_player_pause(mk_midi_player_t player)Pause the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_playfunctionmk_result mk_midi_player_play(mk_midi_player_t player)Play MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_restartfunctionmk_result mk_midi_player_restart(mk_midi_player_t player)Perform the MIDI player restart operation.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_stopfunctionmk_result mk_midi_player_stop(mk_midi_player_t player)Stop the MIDI player.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
Returns MK_SUCCESS or an error result.
mk_midi_player_updatefunctionmk_result mk_midi_player_update(mk_midi_player_t player, double elapsed_seconds)Advance frame-driven MIDI playback.
Events are submitted on the first call that reaches their timestamp, so timing is quantized to the caller's frame interval and is not sample-accurate against the audio clock.
| Parameter | Type | Description |
|---|---|---|
player | mk_midi_player_t | Value for player. |
elapsed_seconds | double | Value for elapsed seconds. |
Returns MK_SUCCESS or an error result.
mk_midi_sequence_destroyfunctionmk_result mk_midi_sequence_destroy(mk_midi_sequence_t sequence)Destroy the MIDI sequence.
| Parameter | Type | Description |
|---|---|---|
sequence | mk_midi_sequence_t | Value for sequence. |
Returns MK_SUCCESS or an error result.
mk_midi_sequence_get_infofunctionmk_result mk_midi_sequence_get_info(mk_midi_sequence_t sequence, mk_midi_sequence_info *out_info)Get info from the MIDI sequence.
| Parameter | Type | Description |
|---|---|---|
sequence | mk_midi_sequence_t | Value for sequence. |
out_info | mk_midi_sequence_info * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_midi_sequence_load_filefunctionmk_result mk_midi_sequence_load_file(const char *path, mk_midi_sequence_t *out_sequence)Load file for the MIDI sequence.
| Parameter | Type | Description |
|---|---|---|
path | const char * | Value for path. |
out_sequence | mk_midi_sequence_t * | Receives the sequence. |
Returns MK_SUCCESS or an error result.
mk_midi_sequence_load_memoryfunctionmk_result mk_midi_sequence_load_memory(const void *data, size_t size, mk_midi_sequence_t *out_sequence)Load memory for the MIDI sequence.
| Parameter | Type | Description |
|---|---|---|
data | const void * | Data buffer. |
size | size_t | Size in bytes. |
out_sequence | mk_midi_sequence_t * | Receives the sequence. |
Returns MK_SUCCESS or an error result.
mk_midi_shutdownfunctionvoid mk_midi_shutdown(void)Perform the MIDI shutdown operation.
mk_midi_synth_all_notes_offfunctionmk_result mk_midi_synth_all_notes_off(mk_midi_synth_t synth)Perform the MIDI synth all notes off operation.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_clonefunctionmk_result mk_midi_synth_clone(mk_midi_synth_t source, mk_midi_synth_t *out_synth)Perform the MIDI synth clone operation.
| Parameter | Type | Description |
|---|---|---|
source | mk_midi_synth_t | Value for source. |
out_synth | mk_midi_synth_t * | Receives the synth. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_destroyfunctionmk_result mk_midi_synth_destroy(mk_midi_synth_t synth)Destroy the MIDI synth.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_load_filefunctionmk_result mk_midi_synth_load_file(const char *soundfont_path, mk_midi_synth_t *out_synth)Load file for the MIDI synth.
| Parameter | Type | Description |
|---|---|---|
soundfont_path | const char * | Value for soundfont path. |
out_synth | mk_midi_synth_t * | Receives the synth. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_load_memoryfunctionmk_result mk_midi_synth_load_memory(const void *data, size_t size, mk_midi_synth_t *out_synth)Load memory for the MIDI synth.
| Parameter | Type | Description |
|---|---|---|
data | const void * | Data buffer. |
size | size_t | Size in bytes. |
out_synth | mk_midi_synth_t * | Receives the synth. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_note_offfunctionmk_result mk_midi_synth_note_off(mk_midi_synth_t synth, uint8_t channel, uint8_t note)Perform the MIDI synth note off operation.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
channel | uint8_t | Value for channel. |
note | uint8_t | Value for note. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_note_onfunctionmk_result mk_midi_synth_note_on(mk_midi_synth_t synth, uint8_t channel, uint8_t note, float velocity)Perform the MIDI synth note on operation.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
channel | uint8_t | Value for channel. |
note | uint8_t | Value for note. |
velocity | float | Value for velocity. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_sendfunctionmk_result mk_midi_synth_send(mk_midi_synth_t synth, const uint8_t *bytes, size_t size)Send MIDI synth.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
bytes | const uint8_t * | Value for bytes. |
size | size_t | Size in bytes. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_set_programfunctionmk_result mk_midi_synth_set_program(mk_midi_synth_t synth, uint8_t channel, uint8_t program, bool drums)Set program on the MIDI synth.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
channel | uint8_t | Value for channel. |
program | uint8_t | Value for program. |
drums | bool | Value for drums. |
Returns MK_SUCCESS or an error result.
mk_midi_synth_set_volumefunctionmk_result mk_midi_synth_set_volume(mk_midi_synth_t synth, float volume)Set volume on the MIDI synth.
| Parameter | Type | Description |
|---|---|---|
synth | mk_midi_synth_t | Value for synth. |
volume | float | Value for volume. |
Returns MK_SUCCESS or an error result.
mk_midi_descstructData for MIDI desc.
| Field | Type | Description |
|---|---|---|
max_inputs | uint32_t | The max inputs. |
max_outputs | uint32_t | The max outputs. |
max_synths | uint32_t | The max synths. |
max_sequences | uint32_t | The max sequences. |
max_players | uint32_t | The max players. |
mk_midi_input_tstructData for MIDI input.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_midi_messagestructData for MIDI message.
| Field | Type | Description |
|---|---|---|
timestamp_seconds | double | The timestamp seconds. |
bytes | uint8_t | The bytes. |
size | uint8_t | The size. |
mk_midi_output_tstructData for MIDI output.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_midi_player_descstructData for MIDI player desc.
| Field | Type | Description |
|---|---|---|
sequence | mk_midi_sequence_t | The sequence. |
synth | mk_midi_synth_t | The synth. |
loop | bool | The loop. |
event_cb | mk_midi_player_event_fn | The event. |
user_data | void * | The user data. |
mk_midi_player_eventstructData for MIDI player event.
| Field | Type | Description |
|---|---|---|
time_seconds | double | The time seconds. |
bytes | uint8_t | The bytes. |
size | uint8_t | The size. |
flags | uint32_t | The flags. |
mk_midi_player_tstructData for MIDI player.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_midi_port_infostructData for MIDI port info.
| Field | Type | Description |
|---|---|---|
index | uint32_t | The index. |
name | char | The name. |
mk_midi_sequence_infostructData for MIDI sequence info.
| Field | Type | Description |
|---|---|---|
used_channels | uint32_t | The used channels. |
used_programs | uint32_t | The used programs. |
total_notes | uint32_t | The total notes. |
first_note_seconds | double | The first note seconds. |
duration_seconds | double | The duration seconds. |
mk_midi_sequence_tstructData for MIDI sequence.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_midi_synth_tstructData for MIDI synth.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_midi_player_event_flagsenumValues for MIDI player event flags.
| Value | Description |
|---|---|
MK_MIDI_PLAYER_EVENT_NONE | Selects none. |
MK_MIDI_PLAYER_EVENT_PROGRAM_UNAVAILABLE | Selects program unavailable. |
MK_MIDI_PLAYER_EVENT_SYNTHETIC | Selects synthetic. |
mk_midi_player_stateenumValues for MIDI player state.
| Value | Description |
|---|---|
MK_MIDI_PLAYER_STOPPED | Selects stopped. |
MK_MIDI_PLAYER_PLAYING | Selects playing. |
MK_MIDI_PLAYER_PAUSED | Selects paused. |
MK_MIDI_PLAYER_FINISHED | Selects finished. |
mk_midi_desctypedeftypedef struct mk_midi_desc mk_midi_descData for MIDI desc.
mk_midi_messagetypedeftypedef struct mk_midi_message mk_midi_messageData for MIDI message.
mk_midi_player_desctypedeftypedef struct mk_midi_player_desc mk_midi_player_descData for MIDI player desc.
mk_midi_player_eventtypedeftypedef struct mk_midi_player_event mk_midi_player_eventData for MIDI player event.
mk_midi_player_event_flagstypedeftypedef enum mk_midi_player_event_flags mk_midi_player_event_flagsValues for MIDI player event flags.
mk_midi_player_event_fntypedeftypedef void(*) mk_midi_player_event_fn(mk_midi_player_t player, const mk_midi_player_event *event, void *user_data)Callback used for MIDI player event.
mk_midi_player_statetypedeftypedef enum mk_midi_player_state mk_midi_player_stateValues for MIDI player state.
mk_midi_port_infotypedeftypedef struct mk_midi_port_info mk_midi_port_infoData for MIDI port info.
mk_midi_sequence_infotypedeftypedef struct mk_midi_sequence_info mk_midi_sequence_infoData for MIDI sequence info.
MK_MIDI_INPUT_INVALIDdefineMK_MIDI_INPUT_INVALIDInvalid sentinel for MIDI input.
MK_MIDI_OUTPUT_INVALIDdefineMK_MIDI_OUTPUT_INVALIDInvalid sentinel for MIDI output.
MK_MIDI_PLAYER_INVALIDdefineMK_MIDI_PLAYER_INVALIDInvalid sentinel for MIDI player.
MK_MIDI_SEQUENCE_INVALIDdefineMK_MIDI_SEQUENCE_INVALIDInvalid sentinel for MIDI sequence.
MK_MIDI_SYNTH_INVALIDdefineMK_MIDI_SYNTH_INVALIDInvalid sentinel for MIDI synth.