openMSX
MidiOutConnector.cc
Go to the documentation of this file.
1 #include "MidiOutConnector.hh"
2 #include "MidiOutDevice.hh"
3 #include "DummyMidiOutDevice.hh"
4 #include "checked_cast.hh"
5 #include "serialize.hh"
6 #include <memory>
7 
8 using std::string;
9 
10 namespace openmsx {
11 
13  std::string name_)
14  : Connector(pluggingController_, std::move(name_),
15  std::make_unique<DummyMidiOutDevice>())
16 {
17 }
18 
19 std::string_view MidiOutConnector::getDescription() const
20 {
21  return "MIDI-out connector";
22 }
23 
24 std::string_view MidiOutConnector::getClass() const
25 {
26  return "midi out";
27 }
28 
30 {
31  return *checked_cast<MidiOutDevice*>(&getPlugged());
32 }
33 
35 {
37 }
38 
40 {
42 }
43 
44 void MidiOutConnector::setParityBit(bool enable, ParityBit parity)
45 {
46  getPluggedMidiOutDev().setParityBit(enable, parity);
47 }
48 
49 void MidiOutConnector::recvByte(byte value, EmuTime::param time)
50 {
51  getPluggedMidiOutDev().recvByte(value, time);
52 }
53 
54 template<typename Archive>
55 void MidiOutConnector::serialize(Archive& ar, unsigned /*version*/)
56 {
57  ar.template serializeBase<Connector>(*this);
58 }
60 
61 } // namespace openmsx
std::string_view getClass() const final override
A Connector belong to a certain class.
MidiOutConnector(PluggingController &pluggingController, std::string name)
Represents something you can plug devices into.
Definition: Connector.hh:20
void setParityBit(bool enable, ParityBit parity) override
std::string_view getDescription() const final override
Get a description for this connector.
void recvByte(byte value, EmuTime::param time) override
void setStopBits(StopBits bits) override
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
STL namespace.
void setDataBits(DataBits bits) override
Pluggable that connects an MSX MIDI out port to a host MIDI device.
Central administration of Connectors and Pluggables.
void setStopBits(StopBits bits) override
void setDataBits(DataBits bits) override
void serialize(Archive &ar, unsigned version)
void recvByte(byte value, EmuTime::param time) override
void setParityBit(bool enable, ParityBit parity) override
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
MidiOutDevice & getPluggedMidiOutDev() const
Pluggable & getPlugged() const
Returns the Pluggable currently plugged in.
Definition: Connector.hh:59