jdxi_editor.ui.editors.synth.editor
synth_editor.py
This module defines the SynthEditor class, a base class for all editor windows in the JD-Xi Manager application. It provides an interface for editing synthesizer parameters, handling MIDI messages, and updating UI components.
Key Features: - UI Elements: Uses PySide6 widgets, including ComboBoxes, Sliders, and SpinBoxes, to adjust synthesizer parameters. - MIDI Integration: Sends and receives MIDI messages via MIDIHelper, supporting parameter changes, SysEx communication,
and program change handling.
Preset Management: Loads, updates, and applies instrument presets with PresetHandler and PresetLoader.
Parameter Control: Dynamically creates UI controls for synthesizer parameters, supporting bipolar values and digital conversion.
Shortcuts: Implements keyboard shortcuts for refreshing data and closing the window.
Dependencies: - PySide6 for the UI components. - jdxi_manager.midi for MIDI communication. - jdxi_manager.midi.data.parameter for synthesizer parameter handling. - jdxi_manager.ui.style for applying UI styles.
Attributes
Classes
Base class for all editor windows |
Functions
|
|
|
Module Contents
- class jdxi_editor.ui.editors.synth.editor.SynthEditor(midi_helper: object | None = None, parent: PySide6.QtWidgets.QWidget | None = None, address: jdxi_editor.midi.data.address.address.JDXiSysExAddress | None = None)[source]
Bases:
jdxi_editor.ui.editors.synth.base.SynthBaseBase class for all editor windows
- _init_synth_data(synth_type: str = JDXi.Synth.DIGITAL_SYNTH_1, partial_number: int | None = 0)[source]
Initialize synth-specific data.
- showEvent(event: PySide6.QtGui.QShowEvent) None[source]
Override showEvent to request current settings from the instrument when the editor is shown. This ensures the sliders pick up the current settings from the instrument, similar to Digital 1, Digital 2, and Analog synth editors.
- Parameters:
event – QShowEvent
- get_controls_as_dict()[source]
Get the current values of all controls (see all_controls) as a dictionary.
- Returns:
dict A dictionary of control parameter names and their values.
- _get_preset_helper_for_current_synth()[source]
Return the appropriate preset handler based on the current synth preset_type.
- dispatch_sysex_to_area(json_sysex_data: str) None[source]
Dispatch SysEx data to the appropriate area for processing.
- Parameters:
json_sysex_data
- Returns:
None
- abstract _update_controls(partial_no: int, sysex_data: dict, successes: list, failures: list) None[source]
Apply updates to the UI components based on the received SysEx data.
- Parameters:
partial_no – int
sysex_data – dict
successes – list
failures – list
- Returns:
None
By default has no partials, so subclass to implement partial updates
- _parse_sysex_json(json_sysex_data: str) dict | None[source]
_parse_sysex_json
- Parameters:
json_sysex_data – str
- Returns:
dict
- set_instrument_title_label(name: str, synth_type: str)[source]
set_instrument_title_label
- Parameters:
name – str
synth_type – str
- Returns:
None
- _sync_preset_selection_to_tone(name: str, title_label=None) None[source]
Point the preset combo (and the display’s BANK/PC line) at the preset named name, the tone the synth reported. Without a match (an edited or user tone) the BANK/PC line is cleared rather than describing another sound. Nothing is sent to the synth.
- Parameters:
name – str tone name read from the synth
title_label – DigitalTitle or None
- load_preset(preset_index, *, request_data: bool = True)[source]
Load a preset by program change.
- Parameters:
request_data – If True, follow with data_request(); set False when the caller will run read_from_jdxi() for tracked readback.
- _handle_program_change(channel: int, program: int)[source]
Handle program change messages by requesting updated data
- _handle_control_change(channel: int, control: int, value: int)[source]
Handle program change messages by requesting updated data
- load_and_set_image(image_path, secondary_image_path=None)[source]
Helper function to load and set the image on the label.
- _get_instrument_selection_combo()[source]
Get the instrument selection combo box from either the widget or direct attribute. Returns None if not found.
- _get_instrument_image_label()[source]
Get the instrument image label from either the widget or direct attribute. Returns None if not found.
- _parse_instrument_text(text: str) jdxi_editor.ui.editors.synth.specs.InstrumentDescriptor | None[source]
- _icon_path(basename: str) str[source]
Absolute path of an icon in the current instrument folder.
- Parameters:
basename – Filename without extension.
- Returns:
Absolute path to
<basename>.png.
- _resolve_icon_path(path: str) str | None[source]
Resolve path, ignoring filename case.
Artwork is not always named in lower case (“JD Piano.png”), which only matters on case-sensitive filesystems: the lookup would miss the file on Linux while working on macOS and Windows.
- Parameters:
path – Candidate absolute path.
- Returns:
The path that exists, or None.
- _preset_image_paths(preset_text: str) list[source]
Candidate paths for artwork named after the preset itself.
Lets “164: Trem EP 1” pick up “trem-ep.png” ahead of the family image, so dropping in a file named after a preset is all it takes.
- Parameters:
preset_text – Preset label (may be empty).
- Returns:
list of absolute paths, most specific first.
- _name_image_paths(name: str) list[source]
Build the candidate image paths for an instrument/engine name.
Each name is expanded through its known filename aliases, so an name detected as
tbmatchestb.png,tb-303.png,tb303.pngor303.pngdepending on which artwork a resource folder ships.- Parameters:
name – Detected name or instrument name (may be empty).
- Returns:
list of absolute paths, most specific first.