Jack2 1.9.6

JackPhysicalMidiOutput.h

00001 /*
00002 Copyright (C) 2009 Devin Anderson
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU Lesser General Public License as published by
00006 the Free Software Foundation; either version 2.1 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU Lesser General Public License for more details.
00013 
00014 You should have received a copy of the GNU Lesser General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 
00018 */
00019 
00020 #ifndef __JackPhysicalMidiOutput__
00021 #define __JackPhysicalMidiOutput__
00022 
00023 #include "JackMidiPort.h"
00024 #include "ringbuffer.h"
00025 
00026 namespace Jack {
00027 
00028     class JackPhysicalMidiOutput {
00029 
00030     private:
00031 
00032         jack_midi_data_t
00033         ApplyRunningStatus(jack_midi_data_t **, size_t *);
00034 
00035         jack_ringbuffer_t *output_ring;
00036         JackMidiBuffer *port_buffer;
00037         jack_ringbuffer_t *rt_output_ring;
00038         jack_midi_data_t running_status;
00039 
00040     protected:
00041 
00048         virtual jack_nframes_t
00049         Advance(jack_nframes_t);
00050 
00057         virtual void
00058         HandleEventLoss(JackMidiEvent *);
00059 
00069         virtual jack_nframes_t
00070         Send(jack_nframes_t, jack_midi_data_t) = 0;
00071 
00083         virtual jack_nframes_t
00084         SendBufferedData(jack_ringbuffer_t *, jack_nframes_t, jack_nframes_t);
00085 
00086     public:
00087 
00093         JackPhysicalMidiOutput(size_t non_rt_buffer_size=1024,
00094                                size_t rt_buffer_size=64);
00095         virtual ~JackPhysicalMidiOutput();
00096 
00101         void
00102         Process(jack_nframes_t);
00103 
00108         inline void
00109         SetPortBuffer(JackMidiBuffer *port_buffer)
00110         {
00111             this->port_buffer = port_buffer;
00112         }
00113 
00114     };
00115 
00116 }
00117 
00118 #endif