Jack2  1.9.9
JackMidiAsyncQueue.h
1 /*
2 Copyright (C) 2010 Devin Anderson
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 */
19 
20 #ifndef __JackMidiAsyncQueue__
21 #define __JackMidiAsyncQueue__
22 
23 #include "JackMidiPort.h"
24 #include "JackMidiReadQueue.h"
25 #include "JackMidiWriteQueue.h"
26 #include "ringbuffer.h"
27 
28 namespace Jack {
29 
40  class SERVER_EXPORT JackMidiAsyncQueue:
41  public JackMidiReadQueue, public JackMidiWriteQueue {
42 
43  private:
44 
45  static const size_t INFO_SIZE =
46  sizeof(jack_nframes_t) + sizeof(size_t);
47 
48  jack_ringbuffer_t *byte_ring;
49  jack_midi_data_t *data_buffer;
50  jack_midi_event_t dequeue_event;
51  jack_ringbuffer_t *info_ring;
52  size_t max_bytes;
53 
54  public:
55 
57 
64  JackMidiAsyncQueue(size_t max_bytes=4096, size_t max_messages=1024);
65 
66  virtual
68 
74  virtual jack_midi_event_t *
75  DequeueEvent();
76 
83  virtual EnqueueResult
84  EnqueueEvent(jack_nframes_t time, size_t size,
85  jack_midi_data_t *buffer);
86 
91  size_t
92  GetAvailableSpace();
93 
94  };
95 
96 }
97 
98 #endif
virtual EnqueueResult EnqueueEvent(jack_nframes_t time, size_t size, jack_midi_data_t *buffer)=0