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 display 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.

Classes

SynthEditor

Base class for all editor windows

Functions

log_changes(previous_data, current_data)

Log changes between previous and current JSON data.

Module Contents

jdxi_editor.ui.editors.synth.editor.log_changes(previous_data, current_data)[source]

Log changes between previous and current JSON data.

class jdxi_editor.ui.editors.synth.editor.SynthEditor(midi_helper: object | None = None, parent: PySide6.QtWidgets.QWidget | None = None)[source]

Bases: jdxi_editor.ui.editors.synth.base.SynthBase

Base class for all editor windows

parameter_received[source]
partial_map[source]
sysex_current_data = None[source]
preset_list = None[source]
programs = None[source]
midi_helper[source]
cc_parameters[source]
nrpn_parameters[source]
nrpn_map[source]
controls[source]
bipolar_parameters = [][source]
midi_requests = [][source]
instrument_default_image = None[source]
instrument_title_label = None[source]
instrument_image_label = None[source]
instrument_icon_folder = None[source]
partial_number = None[source]
midi_channel = None[source]
preset_helper = None[source]
instrument_selection_combo = None[source]
preset_type = None[source]
refresh_shortcut[source]
close_shortcut[source]
json_parser[source]
__str__()[source]
__repr__()[source]
_init_synth_data(synth_type: str = JDXiSynth.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

create_instrument_preset_group(synth_type: str = 'Analog') PySide6.QtWidgets.QGroupBox[source]

Create the instrument preset group box.

Parameters:

synth_type – str

Returns:

QGroupBox

get_controls_as_dict()[source]

Get the current values of self.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_partial_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

update_combo_box_index(preset_number)[source]

Updates the QComboBox to reflect the loaded preset.

update_instrument_title()[source]

update instrument title

Returns:

update_instrument_preset(text)[source]
load_preset(preset_index)[source]

Load a preset by program change.

_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

send_control_change(control_change: jdxi_editor.midi.data.control_change.base.ControlChange, value: int)[source]

Send MIDI CC message

load_and_set_image(image_path, secondary_image_path=None)[source]

Helper function to load and set the image on the label.

update_instrument_image()[source]

Update the instrument image based on the selected synth.

_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.

_get_selected_instrument_text() str[source]
_parse_instrument_text(text: str) tuple[source]
_try_load_specific_or_generic_image(name: str, type_: str) bool[source]
_fallback_to_default_image(reason: str)[source]
update_instrument_image_new()[source]

Update the instrument image based on the selected synth.

update_instrument_image_old()[source]

Update the instrument image based on the selected synth.

_update_common_controls(partial_number: int, filtered_data, successes, failures)[source]
_update_modify_controls(partial_number: int, filtered_data, successes, failures)[source]