Jack2  1.9.10
JackCoreMidiInputPort.h
1 /*
2 Copyright (C) 2011 Devin Anderson
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 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 General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __JackCoreMidiInputPort__
21 #define __JackCoreMidiInputPort__
22 
23 #include "JackCoreMidiPort.h"
24 #include "JackMidiAsyncQueue.h"
25 #include "JackMidiBufferWriteQueue.h"
26 
27 namespace Jack {
28 
30 
31  private:
32 
33  jack_nframes_t
34  GetFramesFromTimeStamp(MIDITimeStamp timestamp);
35 
36  jack_midi_event_t *jack_event;
37  jack_midi_data_t *sysex_buffer;
38  size_t sysex_bytes_sent;
39  jack_midi_data_t running_status_buf[3];
40  JackMidiAsyncQueue *thread_queue;
41  JackMidiBufferWriteQueue *write_queue;
42 
43  protected:
44 
45  void
46  Initialize(const char *alias_name, const char *client_name,
47  const char *driver_name, int index,
48  MIDIEndpointRef endpoint);
49 
50  public:
51 
52  JackCoreMidiInputPort(double time_ratio, size_t max_bytes=4096,
53  size_t max_messages=1024);
54 
55  virtual
57 
58  void
59  ProcessCoreMidi(const MIDIPacketList *packet_list);
60 
61  void
62  ProcessJack(JackMidiBuffer *port_buffer, jack_nframes_t frames);
63 
64  bool
65  Start();
66 
67  bool
68  Stop();
69 
70  };
71 
72 }
73 
74 #endif