Jack2
1.9.12
|
#include <JackMidiAsyncQueue.h>
Public Member Functions | |
JackMidiAsyncQueue (size_t max_bytes=4096, size_t max_messages=1024) | |
virtual jack_midi_event_t * | DequeueEvent () |
virtual EnqueueResult | EnqueueEvent (jack_nframes_t time, size_t size, jack_midi_data_t *buffer) |
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) |
![]() | |
EnqueueResult | EnqueueEvent (jack_midi_event_t *event, jack_nframes_t frame_offset=0) |
Additional Inherited Members | |
![]() | |
enum | EnqueueResult { BUFFER_FULL, BUFFER_TOO_SMALL, EVENT_EARLY, EN_ERROR, OK } |
This is a MIDI message queue designed to allow one thread to pass MIDI messages to another thread (though it can also be used to buffer events internally). This is especially useful if the MIDI API you're attempting to interface with doesn't provide the ability to schedule MIDI events ahead of time and/or has blocking send/receive calls, as it allows a separate thread to handle input/output while the JACK process thread copies events from a MIDI buffer to this queue, or vice versa.
Definition at line 40 of file JackMidiAsyncQueue.h.
JackMidiAsyncQueue::JackMidiAsyncQueue | ( | size_t | max_bytes = 4096 , |
size_t | max_messages = 1024 |
||
) |
Creates a new asynchronous MIDI 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 26 of file JackMidiAsyncQueue.cpp.
|
virtual |
Dequeues and returns a MIDI event. Returns '0' if there are no MIDI events available. This method may be overridden.
Implements Jack::JackMidiReadQueue.
Reimplemented in Jack::JackMidiAsyncWaitQueue.
Definition at line 53 of file JackMidiAsyncQueue.cpp.
|
virtual |
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.
Implements Jack::JackMidiWriteQueue.
Reimplemented in Jack::JackMidiAsyncWaitQueue.
Definition at line 72 of file JackMidiAsyncQueue.cpp.
size_t JackMidiAsyncQueue::GetAvailableSpace | ( | ) |
Returns the maximum size event that can be enqueued right now.
Definition at line 92 of file JackMidiAsyncQueue.cpp.
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.
|
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.