diff --git a/common/JackMidiAsyncQueue.cpp b/common/JackMidiAsyncQueue.cpp index 0cfa42dc..ab64db3f 100644 --- a/common/JackMidiAsyncQueue.cpp +++ b/common/JackMidiAsyncQueue.cpp @@ -54,23 +54,16 @@ JackMidiAsyncQueue::DequeueEvent() { jack_midi_event_t *event = 0; if (jack_ringbuffer_read_space(info_ring) >= INFO_SIZE) { + size_t size; event = &dequeue_event; jack_ringbuffer_read(info_ring, (char *) &(event->time), sizeof(jack_nframes_t)); - size_t size; - jack_ringbuffer_read(info_ring, (char *) &size, sizeof(size_t)); + jack_ringbuffer_read(info_ring, (char *) &size, + sizeof(size_t)); + jack_ringbuffer_read(byte_ring, (char *) data_buffer, + size * sizeof(jack_midi_data_t)); event->buffer = data_buffer; event->size = size; - jack_ringbuffer_data_t vector[2]; - jack_ringbuffer_get_read_vector(byte_ring, vector); - size_t size1 = vector[0].len; - memcpy(data_buffer, vector[0].buf, size1 * sizeof(jack_midi_data_t)); - if (size1 < size) { - memcpy(data_buffer + size1, vector[1].buf, - (size - size1) * sizeof(jack_midi_data_t)); - } - jack_ringbuffer_read_advance(byte_ring, - size * sizeof(jack_midi_data_t)); } return event; } diff --git a/common/JackMidiAsyncQueue.h b/common/JackMidiAsyncQueue.h index a9ac84ce..5f23eff4 100644 --- a/common/JackMidiAsyncQueue.h +++ b/common/JackMidiAsyncQueue.h @@ -28,14 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace Jack { /** - * This is a MIDI message queue designed to allow two threads to pass MIDI - * messages between two threads (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 `JackMidiBufferReadQueue` to - * this queue, or from this queue to a `JackMidiBufferWriteQueue`. + * 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. */ class SERVER_EXPORT JackMidiAsyncQueue: @@ -64,7 +63,8 @@ namespace Jack { JackMidiAsyncQueue(size_t max_bytes=4096, size_t max_messages=1024); - virtual ~JackMidiAsyncQueue(); + virtual + ~JackMidiAsyncQueue(); /** * Dequeues and returns a MIDI event. Returns '0' if there are no MIDI