2 Copyright (C) 2004 Paul Davis
3 Copyright (C) 2004 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 __coremidi_midiport_h__
21 #define __coremidi_midiport_h__
30 #include "midi++/port.h"
32 #include <CoreMIDI/CoreMIDI.h>
36 class CoreMidi_MidiPort:public Port {
38 CoreMidi_MidiPort(const XMLNode& node);
39 virtual ~ CoreMidi_MidiPort();
41 int write (byte * msg, size_t msglen, timestamp_t timestamp);
42 int read (byte * buf, size_t max) {
46 virtual int selectable() const {
50 static int discover (std::vector<PortSet>&);
51 static std::string typestring;
55 /* CoreMidi callback */
56 static void read_proc(const MIDIPacketList * pktlist,
57 void *refCon, void *connRefCon);
59 std::string get_typestring () const {
64 byte midi_buffer[1024];
65 MIDIClientRef midi_client;
66 MIDIEndpointRef midi_destination;
67 MIDIEndpointRef midi_source;
69 int Open(const Port::Descriptor&);
71 static MIDITimeStamp MIDIGetCurrentHostTime();
79 #endif // __coremidi_midiport_h__