jdxi_editor.ui.windows.midi.config_dialog
MIDIConfigDialog is a dialog class that allows users to configure MIDI input and output ports.
It provides the following functionality: - Display available MIDI input and output ports in combo boxes (the JD-Xi first). - Allow users to select and change MIDI input and output ports. - Refresh the list of available MIDI ports. - Test the connection: an Identity Request, and what answered. - Retrieve the selected MIDI port settings.
The dialog opens at once: the MIDI ports, the audio outputs and the SoundFonts are listed on a worker thread, and FluidSynth starts there too (loading a SoundFont of 140 MB kept Windows from drawing the dialog for seconds).
- jdxi_editor.ui.windows.midi.config_dialog.input_ports
List of available MIDI input ports.
- Type:
- jdxi_editor.ui.windows.midi.config_dialog.output_ports
List of available MIDI output ports.
- Type:
- jdxi_editor.ui.windows.midi.config_dialog.current_in
Currently selected MIDI input port (optional).
- Type:
- jdxi_editor.ui.windows.midi.config_dialog.current_out
Currently selected MIDI output port (optional).
- Type:
- jdxi_editor.ui.windows.midi.config_dialog.midi_helper
Instance of the MIDIHelper class to interact with MIDI devices.
- Type:
MidiIOHelper
- jdxi_editor.ui.windows.midi.config_dialog.refresh_ports()
Refresh the list of available MIDI ports.
- jdxi_editor.ui.windows.midi.config_dialog.get_input_port()
Returns the currently selected MIDI input port.
- jdxi_editor.ui.windows.midi.config_dialog.get_output_port()
Returns the currently selected MIDI output port.
- jdxi_editor.ui.windows.midi.config_dialog.get_settings()
Returns a dictionary containing the selected MIDI input and output ports.
Attributes
Classes
Delivers a background result on the UI thread, if its owner still exists. |
|
Reopen a SoundFont that follows the system output when that route changes. |
|
Functions
|
Output devices as (display name, sounddevice index). |
|
fn() on a worker thread, then callback(result, error) on parent's thread. |
|
The MIDI ports, listed through ports of its own. |
|
The audio outputs FluidSynth can play on; None without sounddevice. |
|
The .sf2 and .sf3 files under folder. |
|
Identity Reply (mido sysex data, without F0/F7) -> details, else None. |
Module Contents
- jdxi_editor.ui.windows.midi.config_dialog._get_output_devices() list[tuple[str, int]][source]
Output devices as (display name, sounddevice index).
- Returns:
list
- class jdxi_editor.ui.windows.midi.config_dialog._Relay(callback: Callable, owner: PySide6.QtCore.QObject)[source]
Bases:
PySide6.QtCore.QObjectDelivers a background result on the UI thread, if its owner still exists.
Not a child of the owner: the dialog may be deleted (closed) while the work runs, and the worker must never emit on a deleted object.
- jdxi_editor.ui.windows.midi.config_dialog.run_in_background(fn: Callable, callback: Callable, parent: PySide6.QtCore.QObject) None[source]
fn() on a worker thread, then callback(result, error) on parent’s thread.
A plain Python thread (not a QRunnable, whose wrapper PySide may free while it runs); the result crosses back through a queued Qt signal.
- jdxi_editor.ui.windows.midi.config_dialog.list_midi_ports(midi_helper) tuple[list[str], list[str]][source]
The MIDI ports, listed through ports of its own.
This runs in the background while the app uses the helper’s ports (rtmidi is not thread-safe, and with a device gone Windows crashed listing through them). Without a MIDI backend the helper’s lists are used.
- jdxi_editor.ui.windows.midi.config_dialog.list_audio_outputs() list[tuple[str, int]] | None[source]
The audio outputs FluidSynth can play on; None without sounddevice.
- jdxi_editor.ui.windows.midi.config_dialog.find_soundfonts(folder: str = SF2_DIR) list[str][source]
The .sf2 and .sf3 files under folder.
- jdxi_editor.ui.windows.midi.config_dialog.parse_identity_reply(data) dict | None[source]
Identity Reply (mido sysex data, without F0/F7) -> details, else None.
- class jdxi_editor.ui.windows.midi.config_dialog._SoundfontRouteWatch(helper)[source]
Bases:
PySide6.QtCore.QObjectReopen a SoundFont that follows the system output when that route changes.
- class jdxi_editor.ui.windows.midi.config_dialog.MIDIConfigDialog(midi_helper=MidiIOHelper, parent=None)[source]
Bases:
PySide6.QtWidgets.QDialog- _update_midi_port_combo(midi_port_combo: PySide6.QtWidgets.QComboBox, midi_ports: list, current_port: str) None[source]
Populate a MIDI port combo box, omitting virtual/loopback ports.
The JD-Xi comes first, marked, so it is easy to spot; it is chosen when current_port is not listed.
- _create_button_row_specs(btn_row: PySide6.QtWidgets.QHBoxLayout) list[picoui.specs.widgets.ButtonSpec][source]
create button row specs
- _refresh_hardware_devices(devices: list | None = None) None[source]
Fill the audio outputs.
- Parameters:
devices – (name, index) as list_audio_outputs() gives them (None: sounddevice not installed)
- _on_audio_output_changed(index: int) None[source]
Remember the output, and reopen it when playback is already running.
- _fill_ports(inputs: list[str], outputs: list[str]) None[source]
The ports listed, keeping the ports chosen in the dialog where they still exist.
- test_connection() None[source]
Use the chosen ports and send an Identity Request; the reply arrives later.
- _on_soundfont_list_toggled(checked: bool) None[source]
Handle SoundFont list checkbox toggle - save immediately and notify listeners.
Data requests follow the mode until chosen: off for SoundFont, on for the JD-Xi lists; the box can still be changed afterwards.
- _populate_sf2_combo(found: list[str]) None[source]
Fill the combo box with the SoundFonts found (find_soundfonts).
- get_input_port() str[source]
Get selected input port name
- Returns:
Selected input port name or empty string if none selected