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
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.JDXiUiclass JDXiInstrument
- 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
- _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
- _program_update(index_change: int) None[source]
Update the program by incrementing or decrementing its index
- Parameters:
index_change – int
- Returns:
None
- _preset_update(index_change: int) None[source]
Update the preset by incrementing or decrementing its index
- Parameters:
index_change – int
- Returns:
None
- 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
- show_editor(editor_type: str, **kwargs) None[source]
Show editor of given type
- Parameters:
editor_type – str Editor type
- 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
Override to add Recent Files submenu.
Add Recent Files submenu to File menu.
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
- _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.
- _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
- _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.
- 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
- _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
- _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
- _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 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
- _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