Jack2 1.9.10
|
#include <JackMidiRawInputWriteQueue.h>
Public Member Functions | |
JackMidiRawInputWriteQueue (JackMidiWriteQueue *write_queue, size_t max_packet_data=4096, size_t max_packets=1024) | |
EnqueueResult | EnqueueEvent (jack_nframes_t time, size_t size, jack_midi_data_t *buffer) |
size_t | GetAvailableSpace () |
jack_nframes_t | Process (jack_nframes_t boundary_frame=0) |
Protected Member Functions | |
virtual void | HandleBufferFailure (size_t unbuffered_bytes, size_t total_bytes) |
virtual void | HandleEventLoss (jack_midi_event_t *event) |
virtual void | HandleIncompleteMessage (size_t total_bytes) |
virtual void | HandleInvalidStatusByte (jack_midi_data_t byte) |
virtual void | HandleUnexpectedSysexEnd (size_t total_bytes) |
This queue enqueues raw, unparsed MIDI packets, and outputs complete MIDI messages to a write queue.
Use this queue if the MIDI API you're interfacing with gives you raw MIDI bytes that must be parsed.
Definition at line 36 of file JackMidiRawInputWriteQueue.h.
JackMidiRawInputWriteQueue::JackMidiRawInputWriteQueue | ( | JackMidiWriteQueue * | write_queue, |
size_t | max_packet_data = 4096 , |
||
size_t | max_packets = 1024 |
||
) |
Called to create a new raw input write queue. The `write_queue` argument is the queue to write parsed messages to. The optional `max_packets` argument specifies the number of packets that can be enqueued in the internal queue. The optional `max_packet_data` argument specifies the total number of MIDI bytes that can be put in the internal queue, AND the maximum size for an event that can be written to the write queue.
Definition at line 30 of file JackMidiRawInputWriteQueue.cpp.
void JackMidiRawInputWriteQueue::HandleBufferFailure | ( | size_t | unbuffered_bytes, |
size_t | total_bytes | ||
) | [protected, virtual] |
Override this method to specify what happens when there isn't enough room in the ringbuffer to contain a parsed event. The default method outputs an error message.
Definition at line 73 of file JackMidiRawInputWriteQueue.cpp.
void JackMidiRawInputWriteQueue::HandleEventLoss | ( | jack_midi_event_t * | event | ) | [protected, virtual] |
Override this method to specify what happens when a parsed event can't be written to the write queue because the event's size exceeds the total possible space in the write queue. The default method outputs an error message.
Definition at line 82 of file JackMidiRawInputWriteQueue.cpp.
void JackMidiRawInputWriteQueue::HandleIncompleteMessage | ( | size_t | total_bytes | ) | [protected, virtual] |
Override this method to specify what happens when an incomplete MIDI message is parsed. The default method outputs an error message.
Definition at line 91 of file JackMidiRawInputWriteQueue.cpp.
void JackMidiRawInputWriteQueue::HandleInvalidStatusByte | ( | jack_midi_data_t | byte | ) | [protected, virtual] |
Override this method to specify what happens when an invalid MIDI status byte is parsed. The default method outputs an error message.
Definition at line 99 of file JackMidiRawInputWriteQueue.cpp.
void JackMidiRawInputWriteQueue::HandleUnexpectedSysexEnd | ( | size_t | total_bytes | ) | [protected, virtual] |
Override this method to specify what happens when a sysex end byte is parsed without first parsing a sysex begin byte. The default method outputs an error message.
Definition at line 106 of file JackMidiRawInputWriteQueue.cpp.
Jack::JackMidiWriteQueue::EnqueueResult JackMidiRawInputWriteQueue::EnqueueEvent | ( | jack_nframes_t | time, |
size_t | size, | ||
jack_midi_data_t * | buffer | ||
) | [virtual] |
Enqueues a data packet in the write queue of `size` bytes contained in `buffer` that will be sent the absolute time specified by `time`. This method should not block unless 1.) this write queue represents the actual outbound MIDI connection, 2.) the MIDI event is being sent *now*, meaning that `time` is less than or equal to *now*, and 3.) the method is *not* being called in the process thread. The method should return `OK` if the event was enqueued, `BUFFER_FULL` if the write queue isn't able to accept the event right now, `BUFFER_TOO_SMALL` if this write queue will never be able to accept the event because the event is too large, `EVENT_EARLY` if this queue cannot schedule events ahead of time, and `EN_ERROR` if an error occurs that cannot be specified by another return code.
Implements Jack::JackMidiWriteQueue.
Definition at line 60 of file JackMidiRawInputWriteQueue.cpp.
size_t JackMidiRawInputWriteQueue::GetAvailableSpace | ( | ) |
Returns the maximum size event that can be enqueued right *now*.
Definition at line 67 of file JackMidiRawInputWriteQueue.cpp.
jack_nframes_t JackMidiRawInputWriteQueue::Process | ( | jack_nframes_t | boundary_frame = 0 | ) |
The `Process()` method should be called each time the `EnqueueEvent()` method returns `OK`. The `Process()` method will return the next frame at which an event should be sent. The return value from `Process()` depends upon the result of writing bytes to the write queue:
-If the return value is '0', then all *complete* events have been sent successfully to the write queue. Don't call `Process()` again until another event has been enqueued.
-If the return value is a non-zero value, then it specifies the frame that a pending event is scheduled to sent at. If the frame is in the future, then `Process()` should be called again at that time; otherwise, `Process()` should be called as soon as the write queue will accept events again.
Definition at line 151 of file JackMidiRawInputWriteQueue.cpp.