Jack2 1.9.12

JackCoreMidiDriver.h
1 /*
2 Copyright (C) 2009 Grame
3 Copyright (C) 2011 Devin Anderson
4
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.
9
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.
14
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.
18
19 */
20
21 #ifndef __JackCoreMidiDriver__
22 #define __JackCoreMidiDriver__
23
24 #include "JackCoreMidiPhysicalInputPort.h"
25 #include "JackCoreMidiPhysicalOutputPort.h"
26 #include "JackCoreMidiVirtualInputPort.h"
27 #include "JackCoreMidiVirtualOutputPort.h"
28 #include "JackMidiDriver.h"
29 #include "JackThread.h"
30
31 namespace Jack {
32
33 class JackCoreMidiDriver: public JackMidiDriver, public JackRunnableInterface, public JackLockAble {
34
35 private:
36
37 static void
38 HandleInputEvent(const MIDIPacketList *packet_list, void *driver,
39 void *port);
40
41 static void
42 HandleNotificationEvent(const MIDINotification *message, void *driver);
43
44 void
45 HandleNotification(const MIDINotification *message);
46
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;
59
60 bool OpenAux();
61 int CloseAux();
62
63 void Restart();
64
65 JackThread fThread;
67 public:
68
69 JackCoreMidiDriver(const char* name, const char* alias,
70 JackLockedEngine* engine, JackSynchro* table);
71
72 ~JackCoreMidiDriver();
73
74 int
75 Attach();
76
77 int
78 Close();
79
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);
85
86 int
87 Read();
88
89 int
90 Start();
91
92 int
93 Stop();
94
95 int
96 Write();
97
98 int ProcessRead();
99 int ProcessWrite();
100
101 // JackRunnableInterface interface
102 bool Init();
103 bool Execute();
104
105 };
106
107 }
108
109 #define WAIT_COUNTER 100
110
111 #endif
Jack::JackMidiDriver
The base class for MIDI drivers: drivers with MIDI ports.
Definition: JackMidiDriver.h:39
Jack::JackCoreMidiVirtualInputPort
Definition: JackCoreMidiVirtualInputPort.h:27
Jack::JackCoreMidiPhysicalOutputPort
Definition: JackCoreMidiPhysicalOutputPort.h:27
Jack::JackLockedEngine
Locked Engine, access to methods is serialized using a mutex.
Definition: JackLockedEngine.h:78
Jack::JackRunnableInterface
The base class for runnable objects, that have an Init and Execute method to be called in a threa...
Definition: JackThread.h:34
Jack::JackPosixSemaphore
Inter process synchronization using POSIX semaphore.
Definition: JackPosixSemaphore.h:36
Jack::JackLockAble
Base class for "lockable" objects.
Definition: JackMutex.h:36
Jack::JackCoreMidiDriver::Init
bool Init()
Jack::JackCoreMidiDriver
Definition: JackCoreMidiDriver.h:33
Jack::JackCoreMidiVirtualOutputPort
Definition: JackCoreMidiVirtualOutputPort.h:27
Jack::JackCoreMidiDriver::JackCoreMidiDriver
JackCoreMidiDriver(const char *name, const char *alias, JackLockedEngine *engine, JackSynchro *table)
Jack::JackCoreMidiPhysicalInputPort
Definition: JackCoreMidiPhysicalInputPort.h:27
Jack::JackMachThread
Darwin threads. Real-time threads are actually "time constraint" threads.
Definition: JackMachThread.h:92