Mockbird
Interface Libarary and Synthesizer Setup Tool for Mockingbird-OTTO
Loading...
Searching...
No Matches
Soundscape::MPU401Port Class Reference

MPU401-compatible ODIE communication port in UART mode. More...

#include <sndscape.h>

Public Member Functions

 MPU401Port (std::uint16_t base)
 Constructs a port.
 
void ensure_uart_mode ()
 Ensures the MPU401 port is set to operate in UART mode.
 
void out (std::uint8_t data)
 Sends a MIDI (OUT) byte.
 
bool in_avail ()
 Polls whether a MIDI (IN) byte is available.
 
std::uint8_t in ()
 Reads a MIDI (IN) byte (blocking).
 

Detailed Description

MPU401-compatible ODIE communication port in UART mode.

This class represents an ODIE communication port set to MPU401-compatible mode. This mode is typically used on the first port in DOS environments.

Constructor & Destructor Documentation

◆ MPU401Port()

Soundscape::MPU401Port::MPU401Port ( std::uint16_t base)

Constructs a port.

Parameters
baseI/O base address of the port. 0x330 for the primary port of a Soundscape in default config.

Member Function Documentation

◆ ensure_uart_mode()

void Soundscape::MPU401Port::ensure_uart_mode ( )

Ensures the MPU401 port is set to operate in UART mode.

This mode is used for "dumb" MIDI communication without any processing by the MIDI Processing Unit, and the standard mode used in DOS environments.

This function should be called before the other methods, unless there is prior knowledge that the port already is in UART mode.

Exceptions
HWMissingExceptionThere obviously is no Sounscape port in MPU401 mode at the given address.
TimeoutSending the reset or UART command took more than half a second. Likely the hardware is not present.

◆ in()

std::uint8_t Soundscape::MPU401Port::in ( )

Reads a MIDI (IN) byte (blocking).

Returns
the received MIDI byte
Exceptions
TimeoutNo byte was received within half a second.

◆ in_avail()

bool Soundscape::MPU401Port::in_avail ( )

Polls whether a MIDI (IN) byte is available.

Returns
true if a byte is available.

◆ out()

void Soundscape::MPU401Port::out ( std::uint8_t data)

Sends a MIDI (OUT) byte.

Parameters
dataMIDI byte to send.
Exceptions
TimeoutThe output buffer was stuck full for half a second.

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