JackMidiRawInputWriteQueue.h
/*
Copyright (C) 2010 Devin Anderson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __JackMidiRawInputWriteQueue__
#define __JackMidiRawInputWriteQueue__
#include "JackMidiAsyncQueue.h"
#include "JackMidiWriteQueue.h"
namespace Jack {
class SERVER_EXPORT JackMidiRawInputWriteQueue: public JackMidiWriteQueue {
private:
jack_midi_event_t event;
jack_midi_data_t event_byte;
bool event_pending;
size_t expected_bytes;
jack_midi_data_t *input_buffer;
size_t input_buffer_size;
jack_midi_event_t *packet;
JackMidiAsyncQueue *packet_queue;
jack_midi_data_t status_byte;
size_t total_bytes;
size_t unbuffered_bytes;
JackMidiWriteQueue *write_queue;
void
Clear();
bool
PrepareBufferedEvent(jack_nframes_t time);
bool
PrepareByteEvent(jack_nframes_t time, jack_midi_data_t byte);
void
PrepareEvent(jack_nframes_t time, size_t size,
jack_midi_data_t *buffer);
bool
ProcessByte(jack_nframes_t time, jack_midi_data_t byte);
void
RecordByte(jack_midi_data_t byte);
bool
WriteEvent(jack_nframes_t boundary_frame);
protected:
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);
public:
using JackMidiWriteQueue::EnqueueEvent;
JackMidiRawInputWriteQueue(JackMidiWriteQueue *write_queue,
size_t max_packet_data=4096,
size_t max_packets=1024);
~JackMidiRawInputWriteQueue();
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);
};
}
#endif
Jack::JackMidiAsyncQueue
Definition: JackMidiAsyncQueue.h:40
Jack
Definition: JackAC3Encoder.cpp:30
Jack::JackMidiRawInputWriteQueue
Definition: JackMidiRawInputWriteQueue.h:36
Jack::JackMidiWriteQueue
Definition: JackMidiWriteQueue.h:32
jack_midi_event_t
Definition: JackMidiPort.h:33
Jack::JackMidiWriteQueue::EnqueueEvent
virtual EnqueueResult EnqueueEvent(jack_nframes_t time, size_t size, jack_midi_data_t *buffer)=0