Reading and writing MIDI data Detailed DescriptionMIDI support in JACK is implemented as extension on top of the multi-purpose port design of the JACK API. That means ports are created, searched and managed with the same set of core functions (covered by the main JACK API functions in jack.h) as audio ports are managed with JACK. The few functions in this API part cover the MIDI data aware parts necessary to use JACK MIDI ports conveniently in applications.
Function Documentation
Get number of events in a port buffer.
Get a MIDI event from an event port buffer. Jack MIDI is normalised, the MIDI event returned by this function is guaranteed to be a complete MIDI event (the status byte will always be present, and no realtime events will interspered with the event).
Clear an event buffer. This should be called at the beginning of each process cycle before calling jack_midi_event_reserve or jack_midi_event_write. This function may not be called on an input port's buffer.
Get the size of the largest event that can be stored by the port. This function returns the current space available, taking into account events already stored in the port.
Allocate space for an event to be written to an event port buffer. Clients are to write the actual event data to be written starting at the pointer returned by this function. Clients must not write more than data_size bytes into this buffer. Clients must write normalised MIDI data to the port - no running status and no (1-byte) realtime messages interspersed with other messages (realtime messages are fine when they occur on their own, like other messages). Events must be written in order, sorted by their sample offsets. JACK will not sort the events for you, and will refuse to store out-of-order events.
Write an event into an event port buffer. This function is simply a wrapper for jack_midi_event_reserve which writes the event data into the space reserved in the buffer. Clients must not write more than data_size bytes into this buffer. Clients must write normalised MIDI data to the port - no running status and no (1-byte) realtime messages interspersed with other messages (realtime messages are fine when they occur on their own, like other messages). Events must be written in order, sorted by their sample offsets. JACK will not sort the events for you, and will refuse to store out-of-order events.
Get the number of events that could not be written to port_buffer. This function returning a non-zero value implies port_buffer is full. Currently the only way this can happen is if events are lost on port mixdown.
Generated by |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|