libretro.drivers.midi.driver

Protocol definition for MIDI input/output drivers.

See also

libretro.api.midi

The matching ctypes types and callback definitions.

Classes

MidiDriver

Protocol for drivers that expose MIDI input and output streams to a core.

class MidiDriver[source]

Bases: Protocol

Protocol for drivers that expose MIDI input and output streams to a core.

See also

libretro.api.midi

The matching ctypes types and callback definitions.

abstract property input_enabled

Whether MIDI input is currently enabled.

abstract property output_enabled

Whether MIDI output is currently enabled.

abstractmethod read()[source]

Read the next MIDI byte from the input stream.

Return type:

int | None

Returns:

The next byte (0–255), or None if no input is available.

See also

retro_midi_read_t

The C function pointer type whose signature this method implements.

abstractmethod write(byte, delta_time)[source]

Append a single MIDI byte to the output stream.

Parameters:
  • byte (int) – The MIDI byte (0–255) to write.

  • delta_time (int) – Time since the previous byte in microseconds.

Return type:

bool

Returns:

True if the byte was buffered for output.

See also

retro_midi_write_t

The C function pointer type whose signature this method implements.

abstractmethod flush()[source]

Send all buffered output bytes to the underlying MIDI device.

Return type:

bool

Returns:

True if the buffer was flushed successfully.

See also

retro_midi_flush_t

The C function pointer type whose signature this method implements.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)