| e8555c89 Andy McCall |
1 |
#ifndef MIDIOUTCOREMIDI_HH |
| 2 |
#define MIDIOUTCOREMIDI_HH |
| 3 |
|
| 4 |
#ifdef __APPLE__ |
| 5 |
|
| 6 |
#include "MidiOutDevice.hh" |
| 7 |
#include <CoreMIDI/MIDIServices.h> |
| 8 |
|
| 9 |
#include <vector> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class PluggingController; |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
class MidiOutMessageBuffer : public MidiOutDevice |
| 18 |
{ |
| 19 |
protected: |
| 20 |
virtual OSStatus sendPacketList(MIDIPacketList *myPacketList) = 0; |
| 21 |
|
| 22 |
private: |
| 23 |
void recvMessage( |
| 24 |
const std::vector<uint8_t>& message, EmuTime time) override; |
| 25 |
}; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
class MidiOutCoreMIDI final : public MidiOutMessageBuffer |
| 30 |
{ |
| 31 |
public: |
| 32 |
static void registerAll(PluggingController& controller); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
explicit MidiOutCoreMIDI(MIDIEndpointRef endpoint); |
| 38 |
|
| 39 |
|
| 40 |
void plugHelper(Connector& connector, EmuTime time) override; |
| 41 |
void unplugHelper(EmuTime time) override; |
| 42 |
[[nodiscard]] zstring_view getName() const override; |
| 43 |
[[nodiscard]] zstring_view getDescription() const override; |
| 44 |
|
| 45 |
|
| 46 |
OSStatus sendPacketList(MIDIPacketList *myPacketList) override; |
| 47 |
|
| 48 |
template<typename Archive> |
| 49 |
void serialize(Archive& ar, unsigned version); |
| 50 |
|
| 51 |
private: |
| 52 |
MIDIClientRef client; |
| 53 |
MIDIPortRef port; |
| 54 |
MIDIEndpointRef endpoint; |
| 55 |
|
| 56 |
std::string name; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
class MidiOutCoreMIDIVirtual final : public MidiOutMessageBuffer |
| 65 |
{ |
| 66 |
public: |
| 67 |
explicit MidiOutCoreMIDIVirtual(); |
| 68 |
|
| 69 |
|
| 70 |
void plugHelper(Connector& connector, EmuTime time) override; |
| 71 |
void unplugHelper(EmuTime time) override; |
| 72 |
[[nodiscard]] zstring_view getName() const override; |
| 73 |
[[nodiscard]] zstring_view getDescription() const override; |
| 74 |
|
| 75 |
|
| 76 |
OSStatus sendPacketList(MIDIPacketList *myPacketList) override; |
| 77 |
|
| 78 |
template<typename Archive> |
| 79 |
void serialize(Archive& ar, unsigned version); |
| 80 |
|
| 81 |
private: |
| 82 |
MIDIClientRef client; |
| 83 |
MIDIEndpointRef endpoint; |
| 84 |
}; |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
#endif |
| 89 |
#endif |