openMSX
MidiOutDevice.hh
Go to the documentation of this file.
1 #ifndef MIDIOUTDEVICE_HH
2 #define MIDIOUTDEVICE_HH
3 
4 #include "Pluggable.hh"
5 #include "SerialDataInterface.hh"
6 #include <vector>
7 
8 
9 namespace openmsx {
10 
16 {
17 public:
21  static constexpr size_t MAX_MESSAGE_SIZE = 256;
22 
23  // Pluggable (part)
24  std::string_view getClass() const final override;
25 
26  // SerialDataInterface (part)
27  void recvByte(byte value, EmuTime::param time) override;
28  void setDataBits(DataBits bits) override;
29  void setStopBits(StopBits bits) override;
30  void setParityBit(bool enable, ParityBit parity) override;
31 
32 protected:
33  explicit MidiOutDevice() = default;
34 
37  void clearBuffer();
38 
43  virtual void recvMessage(
44  const std::vector<uint8_t>& message, EmuTime::param time);
45 
46 private:
47  std::vector<uint8_t> buffer;
48  bool isSysEx = false;
49 };
50 
51 } // namespace openmsx
52 
53 #endif
openmsx::MidiOutDevice::setParityBit
void setParityBit(bool enable, ParityBit parity) override
Definition: MidiOutDevice.cc:135
openmsx::MidiOutDevice::getClass
std::string_view getClass() const final override
A pluggable belongs to a certain class.
Definition: MidiOutDevice.cc:49
SerialDataInterface.hh
openmsx::MidiOutDevice::recvByte
void recvByte(byte value, EmuTime::param time) override
Definition: MidiOutDevice.cc:60
openmsx::MidiOutDevice::clearBuffer
void clearBuffer()
Discard any buffered partial MIDI message.
Definition: MidiOutDevice.cc:54
openmsx::SerialDataInterface
Definition: SerialDataInterface.hh:9
Pluggable.hh
openmsx::MidiOutDevice
Pluggable that connects an MSX MIDI out port to a host MIDI device.
Definition: MidiOutDevice.hh:15
openmsx::Pluggable
Definition: Pluggable.hh:11
openmsx::SerialDataInterface::StopBits
StopBits
Definition: SerialDataInterface.hh:15
openmsx::SerialDataInterface::DataBits
DataBits
Definition: SerialDataInterface.hh:12
openmsx::MidiOutDevice::MAX_MESSAGE_SIZE
static constexpr size_t MAX_MESSAGE_SIZE
The limit for the amount of data we'll put into one MIDI message.
Definition: MidiOutDevice.hh:21
openmsx::MidiOutDevice::setDataBits
void setDataBits(DataBits bits) override
Definition: MidiOutDevice.cc:125
openmsx::SerialDataInterface::ParityBit
ParityBit
Definition: SerialDataInterface.hh:19
openmsx::MidiOutDevice::setStopBits
void setStopBits(StopBits bits) override
Definition: MidiOutDevice.cc:130
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::MidiOutDevice::recvMessage
virtual void recvMessage(const std::vector< uint8_t > &message, EmuTime::param time)
Called when a full MIDI message is ready to be sent.
Definition: MidiOutDevice.cc:119