Data Structures | |
struct | seq_midi_out_queue_item_t |
Defines | |
#define | DEBUG_VERBOSE_LEVEL 1 |
#define | SEQ_MIDI_OUT_MALLOC_FLAG_WIDTH 1 |
#define | SEQ_MIDI_OUT_MALLOC_FLAG_MASK 1 |
Functions | |
s32 | SEQ_MIDI_OUT_Init (u32 mode) |
s32 | SEQ_MIDI_OUT_Callback_MIDI_SendPackage_Set (void *_callback_midi_send_package) |
s32 | SEQ_MIDI_OUT_Callback_BPM_IsRunning_Set (void *_callback_bpm_is_running) |
s32 | SEQ_MIDI_OUT_Callback_BPM_TickGet_Set (void *_callback_bpm_tick_get) |
s32 | SEQ_MIDI_OUT_Callback_BPM_Set_Set (void *_callback_bpm_set) |
s32 | SEQ_MIDI_OUT_Send (mios32_midi_port_t port, mios32_midi_package_t midi_package, seq_midi_out_event_type_t event_type, u32 timestamp, u32 len) |
s32 | SEQ_MIDI_OUT_ReSchedule (u8 tag, seq_midi_out_event_type_t event_type, u32 timestamp, u32 *reschedule_filter) |
s32 | SEQ_MIDI_OUT_FlushQueue (void) |
s32 | SEQ_MIDI_OUT_FreeHeap (void) |
s32 | SEQ_MIDI_OUT_Handler (void) |
Variables | |
u32 | seq_midi_out_allocated |
contains number of events which have allocated memory |
Functions for schedules MIDI output
#define DEBUG_VERBOSE_LEVEL 1 |
#define SEQ_MIDI_OUT_MALLOC_FLAG_MASK 1 |
#define SEQ_MIDI_OUT_MALLOC_FLAG_WIDTH 1 |
s32 SEQ_MIDI_OUT_Callback_BPM_IsRunning_Set | ( | void * | _callback_bpm_is_running | ) |
Allows to change the function which is called to check if the BPM generator is running.
Together with the other callback functions, this becomes useful if the MIDI output should be rendered into a MIDI file (in this case, the function should return 1, so that SEQ_MIDI_OUT_Handler handler will generate MIDI output)
[in] | *_callback_bpm_is_running | pointer to callback function:s32 callback_bpm_is_running(void) { return 1; // always running } If set to NULL, the default function SEQ_BPM_IsRunning function will be used. This allows you to restore the default setup properly. |
s32 SEQ_MIDI_OUT_Callback_BPM_Set_Set | ( | void * | _callback_bpm_set | ) |
Allows to change the function which is called to change the song tempo.
Together with the other callback functions, this becomes useful if the MIDI output should be rendered into a MIDI file (in this case, the function should add the appr. meta event into the MIDI file).
[in] | *_callback_bpm_set | pointer to callback function:u32 callback_bpm_set(float bpm) { // ... // do something with bpm value // ... return 0; // no error } If set to NULL, the default function SEQ_BPM_Set function will be used. This allows you to restore the default setup properly. |
s32 SEQ_MIDI_OUT_Callback_BPM_TickGet_Set | ( | void * | _callback_bpm_tick_get | ) |
Allows to change the function which is called to retrieve the current BPM tick.
Together with the other callback functions, this becomes useful if the MIDI output should be rendered into a MIDI file (in this case, the function should return a number which is incremented after each rendering step).
[in] | *_callback_bpm_tick_get | pointer to callback function:u32 callback_bpm_tick_get(void) { return my_bpm_tick; // this variable will be incremented after each rendering step } If set to NULL, the default function SEQ_BPM_TickGet function will be used. This allows you to restore the default setup properly. |
s32 SEQ_MIDI_OUT_Callback_MIDI_SendPackage_Set | ( | void * | _callback_midi_send_package | ) |
Allows to change the function which is called whenever a MIDI package should be sent.
This becomes useful if the MIDI output should be filtered, converted or rendered into a MIDI file.
[in] | *_callback_midi_send_package | pointer to callback function:s32 callback_midi_send_package(mios32_midi_port_t port, mios32_midi_package_t midi_package) { // ... // do something with port and midi_package // ... return 0; // no error } If set to NULL, the default function MIOS32_MIDI_SendPackage function will be used. This allows you to restore the default setup properly. |
s32 SEQ_MIDI_OUT_FlushQueue | ( | void | ) |
This function empties the queue and plays all "off" events
s32 SEQ_MIDI_OUT_FreeHeap | ( | void | ) |
This function frees the complete allocated memory.
It should only be called after SEQ_MIDI_OUT_FlushQueue to prevent stucking Note events
s32 SEQ_MIDI_OUT_Handler | ( | void | ) |
This function should be called periodically (1 mS) to check for timestamped MIDI events which have to be sent.
Initialisation of MIDI output scheduler
[in] | mode | currently only mode 0 supported |
s32 SEQ_MIDI_OUT_ReSchedule | ( | u8 | tag, | |
seq_midi_out_event_type_t | event_type, | |||
u32 | timestamp, | |||
u32 * | reschedule_filter | |||
) |
This function re-schedules MIDI Off/OnOff events assigned to a given "tag" (0..15, stored in mios32_midi_package_t.cable of events which already have been sent.
Usually only SEQ_MIDI_OUT_Off events will be re-scheduled, all events which don't match the event_type will be ignored so that no special tag is required for such events.
Usecase: sustained notes can be realized this way: schedule a Note Off event at timestamp 0xffffffff, reschedule it to timestamp == bpm_tick once the sequencer determined, that the off event should be played.
[in] | tag | (0..15) the mios32_midi_package.t.cable number of events which should be re-scheduled |
[in] | event_type | the event type which should be rescheduled |
[in] | timestamp | the bpm_tick value at which the event should be sent |
[in] | reschedule_filter | if != NULL, we expect a 4*32 bit word which contains flags for all Note and CC values which shouldn't be rescheduled (e.g. don't send note off for notes which are played on a keyboard) |
s32 SEQ_MIDI_OUT_Send | ( | mios32_midi_port_t | port, | |
mios32_midi_package_t | midi_package, | |||
seq_midi_out_event_type_t | event_type, | |||
u32 | timestamp, | |||
u32 | len | |||
) |
This function schedules a MIDI event, which will be sent over a given port at a given bpm_tick
[in] | port | MIDI port (DEFAULT, USB0..USB7, UART0..UART1, IIC0..IIC7) |
[in] | midi_package | MIDI package If the re-schedule feature SEQ_MIDI_OUT_ReSchedule() should be used, the mios32_midi_package_t.cable field should be initialized with a tag (supported range: 0-15) |
[in] | event_type | the event type |
[in] | timestamp | the bpm_tick value at which the event should be sent |
contains number of events which have allocated memory