Jack2 1.9.12

Public Member Functions | Protected Member Functions | List of all members
Jack::JackMidiRawInputWriteQueue Class Reference

`#include <JackMidiRawInputWriteQueue.h>`

Inheritance diagram for Jack::JackMidiRawInputWriteQueue:

## 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)
virtual EnqueueResult | EnqueueEvent (jack_nframes_t time, size_t size, jack_midi_data_t *buffer)=0
EnqueueResult | EnqueueEvent (jack_midi_event_t *event, jack_nframes_t frame_offset=0)
Public Member Functions inherited from Jack::JackMidiWriteQueue
EnqueueResult | EnqueueEvent (jack_midi_event_t *event, jack_nframes_t frame_offset=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)

## Additional Inherited Members
Public Types inherited from Jack::JackMidiWriteQueue
enum | EnqueueResult { BUFFER_FULL, BUFFER_TOO_SMALL, EVENT_EARLY, EN_ERROR, OK }

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ JackMidiRawInputWriteQueue()

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.

## Member Function Documentation

## ◆ HandleBufferFailure()

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.

## ◆ HandleEventLoss()

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.

## ◆ HandleIncompleteMessage()

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.

## ◆ HandleInvalidStatusByte()

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.

## ◆ HandleUnexpectedSysexEnd()

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.

## ◆ EnqueueEvent() [1/3]

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.

## ◆ GetAvailableSpace()

size_t JackMidiRawInputWriteQueue::GetAvailableSpace | ( |  | ) |

Returns the maximum size event that can be enqueued right now.

Definition at line 67 of file JackMidiRawInputWriteQueue.cpp.

## ◆ Process()

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.

## ◆ EnqueueEvent() [2/3]

virtual EnqueueResult Jack::JackMidiWriteQueue::EnqueueEvent

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.

## ◆ EnqueueEvent() [3/3]

EnqueueResult Jack::JackMidiWriteQueue::EnqueueEvent
| inline

A wrapper method for the `EnqueueEvent` method above. The optional 'frame_offset' argument is an amount of frames to add to the event's time.

Definition at line 72 of file JackMidiWriteQueue.h.

The documentation for this class was generated from the following files:

- JackMidiRawInputWriteQueue.h
- JackMidiRawInputWriteQueue.cpp