openMSX
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
openmsx::MidiOutDevice Class Reference

Pluggable that connects an MSX MIDI out port to a host MIDI device. More...

#include <MidiOutDevice.hh>

Inheritance diagram for openmsx::MidiOutDevice:
Inheritance graph
[legend]
Collaboration diagram for openmsx::MidiOutDevice:
Collaboration graph
[legend]

Public Member Functions

std::string_view getClass () const final
 A pluggable belongs to a certain class.
 
void recvByte (byte value, EmuTime::param time) override
 
void setDataBits (DataBits bits) override
 
void setStopBits (StopBits bits) override
 
void setParityBit (bool enable, ParityBit parity) override
 
- Public Member Functions inherited from openmsx::Pluggable
virtual ~Pluggable ()=default
 
virtual std::string_view getName () const
 Name used to identify this pluggable.
 
virtual std::string_view getDescription () const =0
 Description for this pluggable.
 
void plug (Connector &connector, EmuTime::param time)
 This method is called when this pluggable is inserted in a connector.
 
void unplug (EmuTime::param time)
 This method is called when this pluggable is removed from a connector.
 
ConnectorgetConnector () const
 Get the connector this Pluggable is plugged into.
 
bool isPluggedIn () const
 Returns true if this pluggable is currently plugged into a connector.
 

Static Public Attributes

static constexpr size_t MAX_MESSAGE_SIZE = 256
 The limit for the amount of data we'll put into one MIDI message.
 

Protected Member Functions

 MidiOutDevice ()=default
 
void clearBuffer ()
 Discard any buffered partial MIDI message.
 
virtual void recvMessage (const std::vector< uint8_t > &message, EmuTime::param time)
 Called when a full MIDI message is ready to be sent.
 
- Protected Member Functions inherited from openmsx::Pluggable
 Pluggable ()
 
virtual void plugHelper (Connector &newConnector, EmuTime::param time)=0
 
virtual void unplugHelper (EmuTime::param time)=0
 
void setConnector (Connector *conn)
 
- Protected Member Functions inherited from openmsx::SerialDataInterface
 ~SerialDataInterface ()=default
 

Additional Inherited Members

- Public Types inherited from openmsx::SerialDataInterface
enum  DataBits { DATA_5 = 5 , DATA_6 = 6 , DATA_7 = 7 , DATA_8 = 8 }
 
enum  StopBits { STOP_INV = 0 , STOP_1 = 2 , STOP_15 = 3 , STOP_2 = 4 }
 
enum  ParityBit { EVEN = 0 , ODD = 1 }
 

Detailed Description

Pluggable that connects an MSX MIDI out port to a host MIDI device.

Implementations must override either recvByte(), if they can handle raw data, or recvMessage(), if they handle MIDI messages.

Definition at line 15 of file MidiOutDevice.hh.

Constructor & Destructor Documentation

◆ MidiOutDevice()

openmsx::MidiOutDevice::MidiOutDevice ( )
explicitprotecteddefault

Member Function Documentation

◆ clearBuffer()

void openmsx::MidiOutDevice::clearBuffer ( )
protected

Discard any buffered partial MIDI message.

Definition at line 54 of file MidiOutDevice.cc.

◆ getClass()

std::string_view openmsx::MidiOutDevice::getClass ( ) const
finalvirtual

A pluggable belongs to a certain class.

A pluggable only fits in connectors of the same class.

Implements openmsx::Pluggable.

Definition at line 49 of file MidiOutDevice.cc.

◆ recvByte()

void openmsx::MidiOutDevice::recvByte ( byte  value,
EmuTime::param  time 
)
overridevirtual

Implements openmsx::SerialDataInterface.

Reimplemented in openmsx::MidiOutLogger.

Definition at line 60 of file MidiOutDevice.cc.

References recvMessage().

Referenced by openmsx::MidiOutConnector::recvByte().

◆ recvMessage()

void openmsx::MidiOutDevice::recvMessage ( const std::vector< uint8_t > &  message,
EmuTime::param  time 
)
protectedvirtual

Called when a full MIDI message is ready to be sent.

Implementations that can handle raw bytes can override recvByte() instead, in which case this method will not be called.

Reimplemented in openmsx::MidiOutALSA.

Definition at line 119 of file MidiOutDevice.cc.

References UNREACHABLE.

Referenced by recvByte().

◆ setDataBits()

void openmsx::MidiOutDevice::setDataBits ( DataBits  bits)
overridevirtual

Implements openmsx::SerialDataInterface.

Definition at line 125 of file MidiOutDevice.cc.

Referenced by openmsx::MidiOutConnector::setDataBits().

◆ setParityBit()

void openmsx::MidiOutDevice::setParityBit ( bool  enable,
ParityBit  parity 
)
overridevirtual

Implements openmsx::SerialDataInterface.

Definition at line 135 of file MidiOutDevice.cc.

Referenced by openmsx::MidiOutConnector::setParityBit().

◆ setStopBits()

void openmsx::MidiOutDevice::setStopBits ( StopBits  bits)
overridevirtual

Implements openmsx::SerialDataInterface.

Definition at line 130 of file MidiOutDevice.cc.

Referenced by openmsx::MidiOutConnector::setStopBits().

Member Data Documentation

◆ MAX_MESSAGE_SIZE

constexpr size_t openmsx::MidiOutDevice::MAX_MESSAGE_SIZE = 256
staticconstexpr

The limit for the amount of data we'll put into one MIDI message.

The value of 256 comes from the data limit for a MIDIPacket in CoreMIDI.

Definition at line 21 of file MidiOutDevice.hh.


The documentation for this class was generated from the following files: