openMSX
MidiOutCoreMIDI.hh
Go to the documentation of this file.
1#ifndef MIDIOUTCOREMIDI_HH
2#define MIDIOUTCOREMIDI_HH
3
4#if defined(__APPLE__)
5
6#include "MidiOutDevice.hh"
7#include <CoreMIDI/MIDIServices.h>
8
9#include <vector>
10
11namespace openmsx {
12
13class PluggingController;
14
17class MidiOutMessageBuffer : public MidiOutDevice
18{
19protected:
20 virtual OSStatus sendPacketList(MIDIPacketList *myPacketList) = 0;
21
22private:
23 void recvMessage(
24 const std::vector<uint8_t>& message, EmuTime::param time) override;
25};
26
29class MidiOutCoreMIDI final : public MidiOutMessageBuffer
30{
31public:
32 static void registerAll(PluggingController& controller);
33
37 explicit MidiOutCoreMIDI(MIDIEndpointRef endpoint);
38
39 // Pluggable
40 void plugHelper(Connector& connector, EmuTime::param time) override;
41 void unplugHelper(EmuTime::param time) override;
42 [[nodiscard]] std::string_view getName() const override;
43 [[nodiscard]] std::string_view getDescription() const override;
44
45 // MidiOutMessageBuffer
46 OSStatus sendPacketList(MIDIPacketList *myPacketList) override;
47
48 template<typename Archive>
49 void serialize(Archive& ar, unsigned version);
50
51private:
52 MIDIClientRef client;
53 MIDIPortRef port;
54 MIDIEndpointRef endpoint;
55
56 std::string name;
57};
58
64class MidiOutCoreMIDIVirtual final : public MidiOutMessageBuffer
65{
66public:
67 explicit MidiOutCoreMIDIVirtual();
68
69 // Pluggable
70 void plugHelper(Connector& connector, EmuTime::param time) override;
71 void unplugHelper(EmuTime::param time) override;
72 [[nodiscard]] std::string_view getName() const override;
73 [[nodiscard]] std::string_view getDescription() const override;
74
75 // MidiOutMessageBuffer
76 OSStatus sendPacketList(MIDIPacketList *myPacketList) override;
77
78 template<typename Archive>
79 void serialize(Archive& ar, unsigned version);
80
81private:
82 MIDIClientRef client;
83 MIDIEndpointRef endpoint;
84};
85
86} // namespace openmsx
87
88#endif // defined(__APPLE__)
89#endif // MIDIOUTCOREMIDI_HH
This file implemented 3 utility functions:
Definition Autofire.cc:11
void serialize(Archive &ar, T &t, unsigned version)