jdxi_editor.ui.windows.jdxi.instrument

# Create editor instances analog_editor = AnalogSynthEditor(midi_helper, preset_helper) digital_editor = DigitalSynthEditor(midi_helper, preset_helper) drum_editor = DrumSynthEditor(midi_helper, preset_helper)

# Save all controls to a single JSON file save_all_controls_to_single_file(

editors=[self.analog_editor, self.digital_synth2_editor self.digital_synth1_editor, analog_editor], file_path=”all_controls.json”

) JD-Xi Instrument class for managing presets and MIDI settings.

This module defines the JdxiInstrument class, which extends from the JdxiUi class to manage JD-Xi instrument presets, MIDI communication, and UI interactions. It allows for controlling and modifying different preset types (Digital 1, Digital 2, Analog, Drums) and provides MIDI connectivity for program changes and preset management.

Key Features: - Handles MIDI connectivity and communication, including program change signals. - Manages different preset types (Digital, Analog, Drums) with the ability to select and load presets. - Provides MIDI indicators to display the status of MIDI input/output ports. - Includes functionality for dragging the window and selecting different synth types. - Integrates with external MIDI devices for seamless performance control. - Includes a custom UI to manage and visualize the instrument’s preset settings. - Supports the auto-connection of JD-Xi and provides MIDI configuration if auto-connection fails.

- __init__

Initializes the instrument’s MIDI settings, UI components, and preset handlers.

- mousePressEvent, mouseMoveEvent, mouseReleaseEvent

Handles window drag events for custom window movement.

- _select_synth

Selects the current synth type and updates UI button styles.

- _update_synth_button_styles

Updates button styles based on the selected synth type.

- _get_presets_for_current_synth

Returns the list of presets based on the selected synth type.

- _get_for_current_synth

Returns the appropriate preset handler based on the selected synth type.

- _previous_tone

Navigates to the previous tone in the preset list and updates the display.

- ...

Classes

JDXiInstrument

class JDXiInstrument

Module Contents

class jdxi_editor.ui.windows.jdxi.instrument.JDXiInstrument(splash=None, progress_bar=None, status_label=None)[source]

Bases: jdxi_editor.ui.windows.jdxi.ui.JDXiUi

class JDXiInstrument

splash = None[source]
splash_progress_bar = None[source]
splash_status_label = None[source]
sysex_composer[source]
program_helper[source]
settings[source]
recent_files_manager[source]
recent_files_menu = None[source]
editor_registry[source]
main_editor = None[source]
current_synth_type = 'DIGITAL_SYNTH_1'[source]
channel[source]
_init_preset_helpers()[source]

Initialize preset helpers dynamically

_set_callbacks()[source]

Set up signal-slot connections for various UI elements.

closeEvent(event: PySide6.QtGui.QCloseEvent) None[source]

Handle window close event

Parameters:

event – QCloseEvent

Returns:

None

mousePressEvent(event: PySide6.QtGui.QMouseEvent) None[source]

mousePressEvent

Parameters:

event – mousePressEvent

Returns:

None

mouseMoveEvent(event: PySide6.QtGui.QMouseEvent)[source]

mouseMoveEvent

Parameters:

event – QMouseEvent

Returns:

None

mouseReleaseEvent(event: PySide6.QtGui.QMouseEvent) None[source]

mouseReleaseEvent

Parameters:

event – QMouseEvent

Returns:

None

data_request() None[source]

Request the current value of the NRPN parameter from the device.

_handle_program_change(bank_letter: str, program_number: int) None[source]

perform data request

Parameters:
  • bank_letter – str

  • program_number – int

Returns:

None

register_editor(editor: jdxi_editor.ui.editors.SynthEditor) None[source]

register editor

Parameters:

editor – SynthEditor

Returns:

None

set_tone_name_by_type(tone_name: str, synth_type: str) None[source]

set tone name by type

Parameters:
  • tone_name – str Tone name

  • synth_type – str Synth type

Returns:

None

get_preset_helper_for_current_synth() jdxi_editor.jdxi.preset.helper.JDXiPresetHelper[source]

Return the appropriate preset helper based on the current synth preset_type

Returns:

JDXiPresetHelper

set_current_program_name(program_name: str) None[source]

program name

Parameters:

program_name – str

Returns:

None

set_current_program_number(channel: int, program_number: int) None[source]

program number

Parameters:
  • channel – int midi channel (discarded)

  • program_number – int Program number

Returns:

None

_select_synth(synth_type: jdxi_editor.jdxi.synth.type.JDXiSynth) None[source]

Select address synth and update button styles

Parameters:

synth_type – JDXiSynth

Returns:

None

_update_synth_button_styles()[source]

Update styles for synth buttons based on selection.

_program_update(index_change: int) None[source]

Update the program by incrementing or decrementing its index

Parameters:

index_change – int

Returns:

None

_program_previous() None[source]

Decrement the program index and update the display.

_program_next() None[source]

Increment the program index and update the display.

_preset_update(index_change: int) None[source]

Update the preset by incrementing or decrementing its index

Parameters:

index_change – int

Returns:

None

_preset_previous() None[source]

Decrement the tone index and update the display

Returns:

None

_preset_next() None[source]

Increment the tone index and update the display.

update_display_callback(synth_type: jdxi_editor.jdxi.synth.type.JDXiSynth, preset_index: int, channel: int) None[source]

Update the display for the given synth preset_type and preset index

Parameters:
  • synth_type – JDXiSynth

  • preset_index – int

  • channel – int

Returns:

None

_toggle_illuminate_sequencer_lightshow(enabled: bool) None[source]

Toggle the sequencer lightshow on or off

Parameters:

enabled – bool

Returns:

None

init_main_editor() None[source]

Initialize the UI for the MainEditor

Returns:

show_editor(editor_type: str, **kwargs) None[source]

Show editor of given type

Parameters:

editor_type – str Editor type

on_documentation()[source]

on_documentation

Returns:

None

on_preferences()[source]

on_preferences :return:

get_existing_editor(editor_class) jdxi_editor.ui.editors.SynthEditor | None[source]

Get existing editor instance of the specified class

Parameters:

editor_class – class

Returns:

Optional[SynthEditor]

_show_editor_tab(title: str, editor_class, icon, **kwargs) None[source]

_show_editor_tab

Parameters:
  • title – str Title of the tab

  • editor_class – cls Class of the Editor

  • kwargs

Returns:

None

_update_tab_bar_property(index: int) None[source]

Update QTabBar property based on current tab selection for styling.

Parameters:

index – int Current tab index

_show_editor(title: str, editor_class, **kwargs) None[source]

_show editor

Parameters:
  • title – str

  • editor_class – class

  • kwargs – Any

Returns:

None

_show_log_viewer() None[source]

Show log viewer window

_show_midi_config() None[source]

Show MIDI configuration dialog

_show_midi_debugger() None[source]

Open MIDI debugger window

_show_midi_message_monitor() None[source]

Open MIDI message monitor window

_show_program_editor(_) None[source]

Open the ProgramEditor when the digital display is clicked.

_show_about_help() None[source]

_show_about_help

Returns:

_show_main_editor() None[source]

_show_about_help

Returns:

_create_menu_bar() None[source]

Override to add Recent Files submenu.

_add_recent_files_menu() None[source]

Add Recent Files submenu to File menu.

_update_recent_files_menu() None[source]

Update the Recent Files menu with current recent files.

_load_recent_file(file_path: str) None[source]

Load a recent MIDI file.

Parameters:

file_path – Path to the MIDI file

_clear_recent_files() None[source]

Clear all recent files.

_midi_file_load()[source]

_midi_file_load

Returns:

None

Load a MIDI file and process it 1. Load the current MIDI file using the MidiFileEditor. 2. If the editor does not exist, create and show it. 3. After saving, show the editor again.

_midi_file_save()[source]

_midi_file_save :return: 1. Save the current MIDI file using the MidiFileEditor. 2. If the editor does not exist, create and show it. 3. After saving, show the editor again.

_patch_load() None[source]

Show load patch dialog

_patch_save() None[source]

Show save patch dialog

_dump_settings_to_synth() None[source]

Dump all current settings from all editors to the synthesizer. This sends all parameters from all active editors to the JD-Xi.

_update_user_program_database() None[source]

Update the User Program database by scanning through all user banks (E, F, G, H) and reading program names from the synthesizer.

This method: 1. Iterates through each user bank (E, F, G, H) 2. For each bank, iterates through programs 1-64 3. Selects each program on the synthesizer 4. Waits for program name and tone data to be received 5. Saves the program to the database 6. Shows progress to the user

_process_next_program() None[source]

Process the next program in the update sequence.

_request_program_data() None[source]

Request program data from the synthesizer.

_on_program_name_received(program_name: str) None[source]

Handle when program name is received from the synthesizer.

_on_tone_name_received(area: str, tone_name: str) None[source]

Handle when tone name is received from the synthesizer.

_check_and_save_program() None[source]

Check if we have all required data and save if ready.

_save_current_program() None[source]

Save the current program data to the database.

_handle_program_data_timeout() None[source]

Handle timeout when waiting for program data.

_move_to_next_program() None[source]

Move to the next program in the sequence.

_cleanup_db_update() None[source]

Clean up after database update is complete.

load_button_preset(button: jdxi_editor.ui.widgets.button.SequencerSquare) None[source]

load preset data stored on the button

Parameters:

button – SequencerSquare

Returns:

None

_generate_button_preset() jdxi_editor.jdxi.preset.button.JDXiPresetButtonData | None[source]

Generate a ButtonPreset object based on the current preset.

Returns:

Optional[JDXiPresetButtonData]

_get_current_preset_name_from_settings() str[source]
Returns:

str

Get the name of the currently selected preset based on the last used preset type and number.

_get_current_preset_type() jdxi_editor.jdxi.synth.type.JDXiSynth[source]

Get the preset_type of the currently selected preset

Returns:

JDXiSynth

_ui_update_octave() None[source]

Update octave-related UI elements

_midi_init_ports(in_port: jdxi_editor.midi.io.controller.MidiIOController, out_port: jdxi_editor.midi.io.controller.MidiIOController) None[source]

Set MIDI input and output ports

Parameters:
  • in_port

  • out_port

Returns:

None

Handle incoming MIDI messages and flash indicator

handle outgoing message blink

_midi_send_octave(direction: int) None | bool[source]

Send octave change MIDI message

Parameters:

direction – int

Returns:

Union[None, bool]

_midi_send_arp_key_hold(state: bool) None[source]

Send arpeggiator key hold (latch) command

Parameters:

state – bool

Returns:

None

_midi_send_arp_on_off(state: bool) None[source]

Send arpeggiator on/off command

Parameters:

state – bool ON/OFF

Returns:

None

handle_piano_note_on(note_num: int) None[source]

Handle piano key press

Parameters:

note_num – int note midi number

Returns:

None

handle_piano_note_off(note_num: int) None[source]

Handle piano key release

Parameters:

note_num – int midi note number

Returns:

None

_load_last_preset()[source]

Load the last used preset from settings.

_save_last_preset(synth_type: str, preset_num: int, channel: int)[source]

Save the last used preset to settings

Parameters:
  • synth_type – Type of synth (‘Analog’, ‘Digital 1’, ‘Digital 2’, ‘Drums’)

  • preset_num – Preset number (0-based index)

  • channel – MIDI channel

_show_favorite_context_menu(pos, button: jdxi_editor.ui.widgets.button.favorite.FavoriteButton | jdxi_editor.ui.widgets.button.SequencerSquare)[source]

Show context menu for favorite button

_save_to_favorite(button: jdxi_editor.ui.widgets.button.favorite.FavoriteButton | jdxi_editor.ui.widgets.button.SequencerSquare) None[source]

Save current preset to favorite slot

Parameters:

button – Union[FavoriteButton, SequencerSquare]

Returns:

None

_clear_favorite(button: jdxi_editor.ui.widgets.button.favorite.FavoriteButton | jdxi_editor.ui.widgets.button.SequencerSquare) None[source]

Clear favorite slot

Parameters:

button – FavoriteButton

Returns:

None

_load_saved_favorites()[source]

Load saved favorites from settings

_save_favorite(button: jdxi_editor.ui.widgets.button.favorite.FavoriteButton | jdxi_editor.ui.widgets.button.SequencerSquare, index: int) None[source]

Save the current preset as an address favorite and prevent toggling off

Parameters:
  • button – button: Union[FavoriteButton, SequencerSquare]

  • index – int

Returns:

None

_load_settings()[source]

Load application settings

_save_settings()[source]

Save application settings