Jack2  1.9.9
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  JackMidiAsyncQueue *thread_queue;
40  JackMidiBufferWriteQueue *write_queue;
41 
42  protected:
43 
44  void
45  Initialize(const char *alias_name, const char *client_name,
46  const char *driver_name, int index,
47  MIDIEndpointRef endpoint);
48 
49  public:
50 
51  JackCoreMidiInputPort(double time_ratio, size_t max_bytes=4096,
52  size_t max_messages=1024);
53 
54  virtual
56 
57  void
58  ProcessCoreMidi(const MIDIPacketList *packet_list);
59 
60  void
61  ProcessJack(JackMidiBuffer *port_buffer, jack_nframes_t frames);
62 
63  bool
64  Start();
65 
66  bool
67  Stop();
68 
69  };
70 
71 }
72 
73 #endif