jdxi_editor.midi.io.connection

The connection to the JD-Xi, in one place.

Every window asks this object whether the JD-Xi can be talked to, instead of looking at the MIDI ports on its own:

OFFLINE no ports open, or the JD-Xi is not there DETECTED both ports open: not yet known to be a JD-Xi VERIFYING Identity Request sent, waiting for the reply ONLINE a Roland JD-Xi answered: reading and writing allowed UNSTABLE ONLINE, but requests went unanswered: writes still go out,

nothing is shown as verified until a whole reading succeeds

A JD-Xi switched off leaves its USB MIDI ports open on some systems: while ONLINE, a JD-Xi silent for SILENT_ASK_S is asked who it is; silent for LOST_AFTER_S it is OFFLINE (and asked again, quietly, until it answers).

A port merely named “JD-Xi” is not enough: the device has to answer the Identity Request as a Roland JD-Xi (manufacturer 41h, family 0Eh).

Attributes

OFFLINE

DETECTED

VERIFYING

ONLINE

UNSTABLE

STATES

ROLAND

JDXI_FAMILY

POLL_MS

VERIFY_RETRY_MS

UNSTABLE_AFTER

SILENT_ASK_S

LOST_AFTER_S

SILENCE_CHECK

Classes

Connection

The state of the connection to one JD-Xi (one MIDI helper).

Functions

ports_open(helper) → bool

Both MIDI ports of helper open (a reading needs to send and to receive).

is_jdxi_identity(data) → bool

An Identity Reply from a Roland JD-Xi (data with or without F0/F7).

connection_for(helper) → Optional[Connection]

The Connection of helper (made the first time; None without a helper).

can_talk(helper) → bool

For the windows: the JD-Xi can be read and written through helper

Module Contents

jdxi_editor.midi.io.connection.OFFLINE = 'offline'[source]
jdxi_editor.midi.io.connection.DETECTED = 'detected'[source]
jdxi_editor.midi.io.connection.VERIFYING = 'verifying'[source]
jdxi_editor.midi.io.connection.ONLINE = 'online'[source]
jdxi_editor.midi.io.connection.UNSTABLE = 'unstable'[source]
jdxi_editor.midi.io.connection.STATES[source]
jdxi_editor.midi.io.connection.ROLAND = 65[source]
jdxi_editor.midi.io.connection.JDXI_FAMILY = 14[source]
jdxi_editor.midi.io.connection.POLL_MS = 1000[source]
jdxi_editor.midi.io.connection.VERIFY_RETRY_MS = 3000[source]
jdxi_editor.midi.io.connection.UNSTABLE_AFTER = 2[source]
jdxi_editor.midi.io.connection.SILENT_ASK_S = 3.0[source]
jdxi_editor.midi.io.connection.LOST_AFTER_S = 8.0[source]
jdxi_editor.midi.io.connection.SILENCE_CHECK[source]
jdxi_editor.midi.io.connection.ports_open(helper) → bool[source]

Both MIDI ports of helper open (a reading needs to send and to receive).

jdxi_editor.midi.io.connection.is_jdxi_identity(data: Sequence[int]) → bool[source]

An Identity Reply from a Roland JD-Xi (data with or without F0/F7).

class jdxi_editor.midi.io.connection.Connection(helper, poll_ms: int = POLL_MS, parent: PySide6.QtCore.QObject | None = None)[source]

Bases: PySide6.QtCore.QObject

The state of the connection to one JD-Xi (one MIDI helper).

changed[source]
_identity_seen[source]
_helper[source]
state = 'offline'[source]
ever_online = False[source]
_unanswered = 0[source]
_last_ask = None[source]
_last_heard: float | None = None[source]
_lost = False[source]
_timer[source]
property helper[source]
can_talk() → bool[source]

The JD-Xi answered and is still there: reading and writing allowed.

verified() → bool[source]

Results can be shown as verified (not while answers go missing).

_set(state: str) → None[source]
poll() → None[source]

Follow the ports; ask a newly found device who it is; notice a JD-Xi gone silent.

heard() → None[source]

Any MIDI from the device (from the MIDI input thread): it is still there.

_ask_identity() → None[source]
identity_seen(data: Sequence[int]) → None[source]

From any thread (the MIDI input): handled in this object’s thread.

identity_reply(data: Sequence[int]) → None[source]

An Identity Reply came in: a JD-Xi makes the connection ONLINE.

request_unanswered() → None[source]

A request to the JD-Xi got no answer in time.

request_answered() → None[source]
reading_complete() → None[source]

A whole reading succeeded: answers arrive again.

set_state_for_tests(state: str) → None[source]
jdxi_editor.midi.io.connection.connection_for(helper) → Connection | None[source]

The Connection of helper (made the first time; None without a helper).

jdxi_editor.midi.io.connection.can_talk(helper) → bool[source]

For the windows: the JD-Xi can be read and written through helper (looked at now: a closed port counts at once, a new one is asked who it is).