Correct JackEngine::NotifyGraphReorder : graph-order callback now notified after...
[jack2.git] / macosx / coremidi / JackCoreMidiDriver.h
blob90e36bb15dd46699c47b8da2a23ee3db216ef565
1 /*
2 Copyright (C) 2009 Grame
3 Copyright (C) 2011 Devin Anderson
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackCoreMidiDriver__
22 #define __JackCoreMidiDriver__
24 #include "JackCoreMidiPhysicalInputPort.h"
25 #include "JackCoreMidiPhysicalOutputPort.h"
26 #include "JackCoreMidiVirtualInputPort.h"
27 #include "JackCoreMidiVirtualOutputPort.h"
28 #include "JackMidiDriver.h"
29 #include "JackThread.h"
31 namespace Jack {
33 class JackCoreMidiDriver: public JackMidiDriver, public JackRunnableInterface, public JackLockAble {
35 private:
37 static void
38 HandleInputEvent(const MIDIPacketList *packet_list, void *driver,
39 void *port);
41 static void
42 HandleNotificationEvent(const MIDINotification *message, void *driver);
44 void
45 HandleNotification(const MIDINotification *message);
47 MIDIClientRef client;
48 MIDIPortRef internal_input;
49 MIDIPortRef internal_output;
50 int num_physical_inputs;
51 int num_physical_outputs;
52 int num_virtual_inputs;
53 int num_virtual_outputs;
54 JackCoreMidiPhysicalInputPort **physical_input_ports;
55 JackCoreMidiPhysicalOutputPort **physical_output_ports;
56 double time_ratio;
57 JackCoreMidiVirtualInputPort **virtual_input_ports;
58 JackCoreMidiVirtualOutputPort **virtual_output_ports;
60 bool OpenAux();
61 int CloseAux();
63 void Restart();
65 JackThread fThread; /*! Thread to execute the Process function */
67 public:
69 JackCoreMidiDriver(const char* name, const char* alias,
70 JackLockedEngine* engine, JackSynchro* table);
72 ~JackCoreMidiDriver();
74 int
75 Attach();
77 int
78 Close();
80 int
81 Open(bool capturing, bool playing, int num_inputs, int num_outputs,
82 bool monitor, const char* capture_driver_name,
83 const char* playback_driver_name, jack_nframes_t capture_latency,
84 jack_nframes_t playback_latency);
86 int
87 Read();
89 int
90 Start();
92 int
93 Stop();
95 int
96 Write();
98 int ProcessRead();
99 int ProcessWrite();
101 // JackRunnableInterface interface
102 bool Init();
103 bool Execute();
109 #define WAIT_COUNTER 100
111 #endif