Merge branch 'master' into port_register_notification_defer
[jack2.git] / macosx / coremidi / JackCoreMidiDriver.h
blob190e9cd2d8493b9443a3b9bd9ff746827017d4e4
1 /*
2 Copyright (C) 2009 Grame
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.
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.
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.
20 #ifndef __JackCoreMidiDriver__
21 #define __JackCoreMidiDriver__
23 #include <CoreMIDI/CoreMIDI.h>
24 #include "JackMidiDriver.h"
25 #include "JackTime.h"
27 namespace Jack
30 /*!
31 \brief The CoreMidi driver.
34 class JackCoreMidiDriver : public JackMidiDriver
37 private:
39 MIDIClientRef fMidiClient;
40 MIDIPortRef fInputPort;
41 MIDIPortRef fOutputPort;
42 MIDIEndpointRef* fMidiDestination;
43 MIDIEndpointRef* fMidiSource;
45 char fMIDIBuffer[BUFFER_SIZE_MAX * sizeof(float)];
47 int fRealCaptureChannels;
48 int fRealPlaybackChannels;
50 static void ReadProcAux(const MIDIPacketList *pktlist, jack_ringbuffer_t* ringbuffer);
51 static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
52 static void ReadVirtualProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
53 static void NotifyProc(const MIDINotification *message, void *refCon);
55 public:
57 JackCoreMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
58 virtual ~JackCoreMidiDriver();
60 int Open( bool capturing,
61 bool playing,
62 int chan_in,
63 int chan_out,
64 bool monitor,
65 const char* capture_driver_name,
66 const char* playback_driver_name,
67 jack_nframes_t capture_latency,
68 jack_nframes_t playback_latency);
69 int Close();
71 int Attach();
73 int Read();
74 int Write();
78 } // end of namespace
80 #endif