jdxi_editor.midi.sysex.request.read_session

Coordinated RQ1 read session with DT1 address matching and section status.

Used by Patch Manager and per-editor “Read from JD-Xi” actions so saves are not based on stale UI state without an explicit hardware round-trip.

Replies are matched on the raw DT1 bytes from the MIDI input (midi_message_incoming). The parsed midi_sysex_json signal is not used when raw input is available: its ADDRESS field is the command byte plus only three address bytes (e.g. "12194200" for 19 42 00 00), and the same signal also carries JSON from patch files being loaded, which are not replies.

Attributes

DRUM_PARTIAL_COUNT

DRUM_FIRST_NOTE

_DRUM_FIRST_LMB

_DRUM_PARTIAL_SIZE

Classes

SectionStatus

str(object='') -> str

ReadSectionResult

Status for one expected SysEx section.

ReadResult

Outcome of a full or scoped read session.

PatchReadSession

Send RQ1s and wait for matching DT1 addresses via midi_sysex_json.

Functions

normalize_address(address) → str

Normalize an address hex string for comparison (no spaces, lower).

address_from_rq1_hex(request_hex) → str

Extract the 4-byte Roland address from an RQ1 SysEx hex string.

address_from_dt1_bytes(data) → Optional[str]

4-byte address of a Roland DT1 (data set) message, or None if data is not one.

address_from_parsed_json(address_field) → str

Normalise the ADDRESS of a parsed-SysEx JSON payload to the 4-byte form.

label_for_address(address) → str

Human-readable label for a common JD-Xi temporary address.

drum_partial_index(address) → Optional[int]

0-based drum partial of a 19 70 xx 00 address, or None.

rq1_hex(address, size) → str

JD-Xi RQ1 (data request) for size bytes at address, as hex.

patch_section_requests() → List[Tuple[str, str]]

(label, RQ1) for every section of a patch, whichever editors are open.

sections_from_requests(requests, *[, labels]) → List[ReadSectionResult]

Build section results from RQ1 hex strings.

collect_editor_requests(editors, *[, skip_types]) → List[Tuple[str, str]]

Collect (label, rq1_hex) from editors that expose midi_requests.

start_read_session(midi_helper, requests, *[, labels, ...]) → PatchReadSession

Convenience: build sections, wire callbacks, and start.

Module Contents

class jdxi_editor.midi.sysex.request.read_session.SectionStatus[source]

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

PENDING = 'pending'[source]
OK = 'ok'[source]
TIMEOUT = 'timeout'[source]
ERROR = 'error'[source]
class jdxi_editor.midi.sysex.request.read_session.ReadSectionResult[source]

Status for one expected SysEx section.

label: str[source]
address: str[source]
request_hex: str[source]
status: SectionStatus[source]
property ok: bool[source]
class jdxi_editor.midi.sysex.request.read_session.ReadResult[source]

Outcome of a full or scoped read session.

sections: List[ReadSectionResult] = [][source]
property complete: bool[source]
property pending_count: int[source]
property ok_count: int[source]
summary() → str[source]
jdxi_editor.midi.sysex.request.read_session.normalize_address(address: str | None) → str[source]

Normalize an address hex string for comparison (no spaces, lower).

jdxi_editor.midi.sysex.request.read_session.address_from_rq1_hex(request_hex: str) → str[source]

Extract the 4-byte Roland address from an RQ1 SysEx hex string.

RQ1 layout after the JD-Xi header: command 11, then address (4 bytes), then size (4 bytes), checksum, F7.

jdxi_editor.midi.sysex.request.read_session.address_from_dt1_bytes(data: Sequence[int]) → str | None[source]

4-byte address of a Roland DT1 (data set) message, or None if data is not one.

jdxi_editor.midi.sysex.request.read_session.address_from_parsed_json(address_field: str | None) → str[source]

Normalise the ADDRESS of a parsed-SysEx JSON payload to the 4-byte form.

The parser reports command + 3 address bytes ("12194200"); patch JSON written by the composer uses the 4-byte address ("19420000").

jdxi_editor.midi.sysex.request.read_session.label_for_address(address: str) → str[source]

Human-readable label for a common JD-Xi temporary address.

jdxi_editor.midi.sysex.request.read_session.DRUM_PARTIAL_COUNT = 38[source]
jdxi_editor.midi.sysex.request.read_session.DRUM_FIRST_NOTE = 36[source]
jdxi_editor.midi.sysex.request.read_session._DRUM_FIRST_LMB = 46[source]
jdxi_editor.midi.sysex.request.read_session._DRUM_PARTIAL_SIZE = (0, 0, 1, 67)[source]
jdxi_editor.midi.sysex.request.read_session.drum_partial_index(address: str) → int | None[source]

0-based drum partial of a 19 70 xx 00 address, or None.

jdxi_editor.midi.sysex.request.read_session.rq1_hex(address: Sequence[int], size: Sequence[int]) → str[source]

JD-Xi RQ1 (data request) for size bytes at address, as hex.

jdxi_editor.midi.sysex.request.read_session.patch_section_requests() → List[Tuple[str, str]][source]

(label, RQ1) for every section of a patch, whichever editors are open.

Program Common, Vocal FX, Effects, Delay, Reverb, Zones, Arpeggio, both Digital synths (Common, partials, Modify), Analog, Drum Common and all 38 drum partials.

jdxi_editor.midi.sysex.request.read_session.sections_from_requests(requests: Sequence[str], *, labels: Sequence[str] | None = None) → List[ReadSectionResult][source]

Build section results from RQ1 hex strings.

jdxi_editor.midi.sysex.request.read_session.collect_editor_requests(editors: Iterable[Any], *, skip_types: Tuple[type, ...] | None = None) → List[Tuple[str, str]][source]

Collect (label, rq1_hex) from editors that expose midi_requests.

Deduplicates by address (first wins).

class jdxi_editor.midi.sysex.request.read_session.PatchReadSession(midi_helper, sections: Sequence[ReadSectionResult], *, timeout_ms: int = 8000, parent: PySide6.QtCore.QObject | None = None)[source]

Bases: PySide6.QtCore.QObject

Send RQ1s and wait for matching DT1 addresses via midi_sysex_json.

Emits progress as sections update and finished with the final ReadResult (complete, partial, or timed out).

progress[source]
finished[source]
_midi_helper[source]
_sections[source]
_by_address: Dict[str, ReadSectionResult][source]
_timeout_ms = 8000[source]
_timer[source]
_connected = False[source]
_connected_signal = None[source]
_done = False[source]
property result: ReadResult[source]
start() → None[source]

Connect to MIDI input, send RQ1s, and start the timeout timer.

cancel() → None[source]

Stop waiting; mark remaining sections as timeout.

_on_midi_message(message: Any) → None[source]

Raw MIDI input: match DT1 replies by their exact address.

_on_sysex_json(payload: str) → None[source]

Fallback when raw input is unavailable: match parsed-SysEx JSON.

_mark_received(address: str) → None[source]
property pending_count: int[source]
_on_timeout() → None[source]
_finish() → None[source]
_tell_connection(result: ReadResult) → None[source]

A whole reading: answers arrive; a partial one: some did not (UNSTABLE).

_disconnect() → None[source]
jdxi_editor.midi.sysex.request.read_session.start_read_session(midi_helper, requests: Sequence[str], *, labels: Sequence[str] | None = None, timeout_ms: int = 8000, on_progress: Callable[[ReadResult], None] | None = None, on_finished: Callable[[ReadResult], None] | None = None, parent: PySide6.QtCore.QObject | None = None) → PatchReadSession[source]

Convenience: build sections, wire callbacks, and start.