jdxi_editor.midi.io.backend

Starting without a MIDI backend.

python-rtmidi raises from MidiIn() / MidiOut() when it cannot reach the platform’s MIDI service at all. On Linux that is whenever /dev/snd/seq is missing, because the kernel’s snd-seq module is not loaded – the normal state in a container, on a minimal install, and on a CI runner, where it reads:

MidiInAlsa::initialize: error creating ALSA sequencer client object

An unguarded construction makes that fatal: the editor cannot be built at all, and the user is shown a traceback rather than a message. But the editor is useful without a JD-Xi attached, and already opens its MIDI configuration dialog when it finds no ports, so an absent backend should look like “no ports” rather than a crash.

NoMidiBackend answers every method the editor calls on a port, so callers need no special case and nothing has to tolerate None. rtmidi’s own dummy API would have done this, but the published wheels are not built with it: get_compiled_api() offers only the platform’s real backend.

Classes

NoMidiBackend

A MIDI port that is always closed and has nothing to offer.

Functions

open_rtmidi(factory, kind)

Build an rtmidi port, or a stand-in when there is no MIDI backend.

Module Contents

class jdxi_editor.midi.io.backend.NoMidiBackend[source]

A MIDI port that is always closed and has nothing to offer.

get_ports() → list[source]
open_port(*_args, **_kwargs) → None[source]
close_port() → None[source]
is_port_open() → bool[source]
set_callback(*_args, **_kwargs) → None[source]
cancel_callback() → None[source]
ignore_types(*_args, **_kwargs) → None[source]
send_message(*_args, **_kwargs) → None[source]
jdxi_editor.midi.io.backend.open_rtmidi(factory, kind: str)[source]

Build an rtmidi port, or a stand-in when there is no MIDI backend.

Parameters:
  • factory – rtmidi.MidiIn or rtmidi.MidiOut

  • kind – str what the port is for, for the log line

Returns:

the rtmidi port, or NoMidiBackend