Jack2: Jack::JackMidiAsyncWaitQueue Class Reference

Jack2 1.9.12

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

`#include <JackMidiAsyncWaitQueue.h>`

Inheritance diagram for Jack::JackMidiAsyncWaitQueue:

## Public Member Functions
| JackMidiAsyncWaitQueue (size_t max_bytes=4096, size_t max_messages=1024)
jack_midi_event_t * | DequeueEvent ()
jack_midi_event_t * | DequeueEvent (long usecs)
jack_midi_event_t * | DequeueEvent (jack_nframes_t frame)
EnqueueResult | EnqueueEvent (jack_nframes_t time, size_t size, jack_midi_data_t *buffer)
virtual EnqueueResult | EnqueueEvent (jack_nframes_t time, size_t size, jack_midi_data_t *buffer)
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::JackMidiAsyncQueue
| JackMidiAsyncQueue (size_t max_bytes=4096, size_t max_messages=1024)
size_t | GetAvailableSpace ()
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)

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

## Detailed Description

This is an asynchronous wait queue that allows a thread to wait for a message, either indefinitely or for a specified time. This is one example of a way that the `JackMidiAsyncQueue` class can be extended so that process threads can interact with non-process threads to send MIDI events.

XXX: As of right now, this code hasn't been tested. Also, note the warning in the JackMidiAsyncWaitQueue.cpp about semaphore wait resolution.

Definition at line 39 of file JackMidiAsyncWaitQueue.h.

## Constructor & Destructor Documentation

## ◆ JackMidiAsyncWaitQueue()

JackMidiAsyncWaitQueue::JackMidiAsyncWaitQueue | ( | size_t | max_bytes = `4096`,
|  | size_t | max_messages = `1024`
| ) |  |

Creates a new asynchronous MIDI wait message queue. The queue can store up to `max_messages` MIDI messages and up to `max_bytes` of MIDI data before it starts rejecting messages.

Definition at line 28 of file JackMidiAsyncWaitQueue.cpp.

## Member Function Documentation

## ◆ DequeueEvent() [1/3]

jack_midi_event_t * JackMidiAsyncWaitQueue::DequeueEvent | ( |  | ) |
| virtual

Dequeues and returns a MIDI event. Returns '0' if there are no MIDI events available right now.

Reimplemented from Jack::JackMidiAsyncQueue.

Definition at line 43 of file JackMidiAsyncWaitQueue.cpp.

## ◆ DequeueEvent() [2/3]

jack_midi_event_t * JackMidiAsyncWaitQueue::DequeueEvent | ( | long | usecs | ) |

Waits a specified time for a MIDI event to be available, or indefinitely if the time is negative. Returns the MIDI event, or '0' if time runs out and no MIDI event is available.

Definition at line 69 of file JackMidiAsyncWaitQueue.cpp.

## ◆ DequeueEvent() [3/3]

jack_midi_event_t * JackMidiAsyncWaitQueue::DequeueEvent | ( | jack_nframes_t | frame | ) |

Waits until the specified frame for a MIDI event to be available. Returns the MIDI event, or '0' if time runs out and no MIDI event is available.

Definition at line 49 of file JackMidiAsyncWaitQueue.cpp.

## ◆ EnqueueEvent() [1/4]

Jack::JackMidiWriteQueue::EnqueueResult JackMidiAsyncWaitQueue::EnqueueEvent | ( | jack_nframes_t | time,
|  | size_t | size,
|  | jack_midi_data_t * | buffer
| ) |  |
| virtual

Enqueues the MIDI event specified by the arguments. The return value indiciates whether or not the event was successfully enqueued.

Reimplemented from Jack::JackMidiAsyncQueue.

Definition at line 76 of file JackMidiAsyncWaitQueue.cpp.

## ◆ EnqueueEvent() [2/4]

Jack::JackMidiWriteQueue::EnqueueResult JackMidiAsyncQueue::EnqueueEvent

Enqueues the MIDI event specified by the arguments. The return value indiciates whether or not the event was successfully enqueued. This method may be overridden.

Definition at line 72 of file JackMidiAsyncQueue.cpp.

## ◆ EnqueueEvent() [3/4]

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() [4/4]

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:

- JackMidiAsyncWaitQueue.h
- JackMidiAsyncWaitQueue.cpp