jdxi_editor.ui.windows.midi.controller_config ============================================= .. py:module:: jdxi_editor.ui.windows.midi.controller_config .. autoapi-nested-parse:: MIDI controller configuration ============================= A window for setting up a hardware controller (an Arturia MiniLab 3 or similar) that drives the open synth editor's filter, in the same shape as ElMo's MIDI Control tab: - **Connection** — which ports the controller is heard on, and whether it is connected. - **Monitor** — every message arriving from it, so the CC number a knob sends can simply be read off. - **Mappings** — which CC drives which filter control, with **Learn** to take the number from the next knob that moves. Changes are saved to QSettings and applied to the running :class:`~jdxi_editor.ui.editors.filter_remote.FilterRemote` straight away, so a knob works the moment it is learnt. - **Transport** — which buttons play, pause, stop, record, rewind and fast forward the MIDI File player. **Learn** adds the next button pressed (a note or a CC); an action can have several, e.g. the VMX8's note and CC modes. Saved per controller, and picked up by the player straight away. The CC numbers a MiniLab 3 sends depend on the program loaded on the device, so the built-in map is only a starting point; Learn is the reliable way to get them right. Attributes ---------- .. autoapisummary:: jdxi_editor.ui.windows.midi.controller_config.STATUS_INTERVAL_MS jdxi_editor.ui.windows.midi.controller_config.MONITOR_MAX_LINES jdxi_editor.ui.windows.midi.controller_config.AUTOMATIC_PORTS jdxi_editor.ui.windows.midi.controller_config.CONTROL_SPECS jdxi_editor.ui.windows.midi.controller_config.CONTROL_LABELS jdxi_editor.ui.windows.midi.controller_config.TRANSPORT_LABELS jdxi_editor.ui.windows.midi.controller_config.CONTROL_SOURCES Classes ------- .. autoapisummary:: jdxi_editor.ui.windows.midi.controller_config.ControlLabelSpec jdxi_editor.ui.windows.midi.controller_config.MidiControllerDialog Module Contents --------------- .. py:data:: STATUS_INTERVAL_MS :value: 1000 .. py:data:: MONITOR_MAX_LINES :value: 500 .. py:data:: AUTOMATIC_PORTS :value: 'All controller ports (automatic)' .. py:class:: ControlLabelSpec How the Mappings table shows one control. :param control: FilterControl the control :param label: str human-readable name .. py:attribute:: control :type: jdxi_editor.midi.io.controller_map.FilterControl .. py:attribute:: label :type: str .. py:data:: CONTROL_SPECS :type: list[ControlLabelSpec] .. py:data:: CONTROL_LABELS :type: Dict[jdxi_editor.midi.io.controller_map.FilterControl, str] .. py:data:: TRANSPORT_LABELS :type: Dict[jdxi_editor.midi.io.controller_map.TransportAction, str] .. py:data:: CONTROL_SOURCES :type: Dict[jdxi_editor.midi.io.controller_map.FilterControl, str] .. py:class:: MidiControllerDialog(external_controller=None, filter_remote=None, parent: Optional[PySide6.QtWidgets.QWidget] = None) Bases: :py:obj:`PySide6.QtWidgets.QMainWindow` Set up the hardware controller that drives the filter. .. py:attribute:: preset_combo :type: PySide6.QtWidgets.QComboBox | None :value: None .. py:attribute:: port_combo :type: PySide6.QtWidgets.QComboBox | None :value: None .. py:attribute:: external_controller :value: None .. py:attribute:: filter_remote :value: None .. py:attribute:: profile :type: jdxi_editor.midi.io.controller_map.ControllerProfile .. py:attribute:: cc_map :type: Dict[int, jdxi_editor.midi.io.controller_map.FilterControl] .. py:attribute:: _learning :type: Optional[jdxi_editor.midi.io.controller_map.FilterControl] :value: None .. py:attribute:: transport_specs :type: list[jdxi_editor.midi.io.controller_map.TransportSpec] .. py:attribute:: _learning_transport :type: Optional[jdxi_editor.midi.io.controller_map.TransportAction] :value: None .. py:attribute:: _status_timer :type: PySide6.QtCore.QTimer | None :value: None .. py:method:: _timer_init() .. py:method:: _create_tab_widget() .. py:method:: build_tabs_dict() -> dict[Callable[[...], Any], str] .. py:method:: _connection_tab() -> PySide6.QtWidgets.QWidget The tab showing which ports are listened to. :return: QWidget .. py:method:: _create_connection_tab_widgets() -> tuple[PySide6.QtWidgets.QGroupBox, PySide6.QtWidgets.QGroupBox, PySide6.QtWidgets.QWidget] _create_connection_tab_widgets :return: tuple[QGroupBox, QWidget, QGroupBox] .. py:method:: create_port_combo() .. py:method:: create_preset_combo() .. py:method:: _preset_combo_current_index_changed_connect() .. py:method:: _preset_combo_set_current_index() .. py:method:: _preset_combo_populate() .. py:method:: _create_action_item_buttons() -> list[Any] _create_action_item_buttons .. py:method:: create_action_button_specs() -> list[picoui.specs.widgets.ButtonSpec] create_action_button_specs .. py:method:: _create_midi_controller_form(actions: PySide6.QtWidgets.QHBoxLayout | PySide6.QtWidgets.QVBoxLayout, connection: PySide6.QtWidgets.QGroupBox) .. py:method:: _monitor_tab() -> PySide6.QtWidgets.QWidget The tab logging what the controller sends. :return: QWidget .. py:method:: _mappings_tab() -> PySide6.QtWidgets.QWidget The tab assigning a CC number to each filter control. :return: QWidget .. py:method:: _build_mappings_table() -> None Fill the mappings table from the current map. :return: None .. py:method:: _transport_tab() -> PySide6.QtWidgets.QWidget The tab assigning controller buttons to the MIDI File player's transport. :return: QWidget .. py:method:: _build_transport_table() -> None One row per transport action, with its buttons, Learn and Clear. :return: None .. py:method:: _transport_text(action: jdxi_editor.midi.io.controller_map.TransportAction) -> str The buttons that trigger ``action``, as shown in the table. :param action: TransportAction :return: str e.g. "Note 94, CC 52", or "not set" .. py:method:: _refresh_transport_column() -> None Redraw the Buttons column. :return: None .. py:method:: _source_text(control: jdxi_editor.midi.io.controller_map.FilterControl) -> str The hardware control that sends ``control`` by default, for the table. Taken from the profile's ``source`` entries in ``midi_controllers.json``; blank where the physical control is not known (as for the VMX8, whose map is translated, not measured). :param control: FilterControl :return: str e.g. "Knob 1", or "" .. py:method:: connected_profile() -> jdxi_editor.midi.io.controller_map.ControllerProfile Profile of the controller plugged in, or the MiniLab 3 if none is. :return: ControllerProfile .. py:method:: select_profile(profile_id: Optional[str]) -> None Show and edit the mappings of another controller. :param profile_id: Optional[str] ControllerProfile id :return: None .. py:method:: _is_live_profile() -> bool Whether the profile being edited is the one the running remote uses. :return: bool .. py:method:: _cc_text(control: jdxi_editor.midi.io.controller_map.FilterControl) -> str The CC number assigned to ``control``, as shown in the table. :param control: FilterControl :return: str .. py:method:: cc_for(control: jdxi_editor.midi.io.controller_map.FilterControl) -> Optional[int] The CC number mapped to ``control``. :param control: FilterControl :return: Optional[int] .. py:method:: refresh_ports() -> None Reload the list of MIDI input ports, keeping the current choice. :return: None .. py:method:: connect_controller() -> None Listen to the chosen port, or find the controller's ports automatically. :return: None .. py:method:: disconnect_controller() -> None Stop listening to the controller. :return: None .. py:method:: update_status() -> None Show whether the controller is connected, and on which ports. :return: None .. py:method:: information_text_update(available_ports: list[Any] | Any, ports: list[Any] | Any) information_text_update :param available_ports: :param ports: :return: .. py:method:: _on_message(port_name: str, message: object) -> None Log a message from the controller, and use it if learning. :param port_name: str the port it arrived on :param message: mido.Message :return: None .. py:method:: _append_monitor_line(line: str) -> None Add a line to the monitor, dropping the oldest once it is full. :param line: str :return: None .. py:method:: start_learn(control: jdxi_editor.midi.io.controller_map.FilterControl) -> None Take the next CC received as the mapping for ``control``. :param control: FilterControl :return: None .. py:method:: cancel_learn() -> None Stop waiting for a CC. :return: None .. py:method:: assign_cc(control: jdxi_editor.midi.io.controller_map.FilterControl, cc: int) -> None Map ``cc`` to ``control``, replacing any other control using it. A CC can only drive one thing, otherwise one knob would move two sliders at once. :param control: FilterControl :param cc: int CC number 0-127 :return: None .. py:method:: reset_mappings() -> None Go back to the selected controller's built-in map. :return: None .. py:method:: apply_mappings() -> None Save the map and, if it is the connected controller's, hand it to the running filter remote. :return: None .. py:method:: _refresh_cc_column() -> None Redraw the CC numbers in the table. :return: None .. py:method:: _spec_from_press(action: jdxi_editor.midi.io.controller_map.TransportAction, message: object) -> Optional[jdxi_editor.midi.io.controller_map.TransportSpec] :staticmethod: The transport button ``message`` presses, bound to ``action``. :param action: TransportAction :param message: mido.Message :return: Optional[TransportSpec] None if ``message`` is not a button press (a release, or neither a note-on nor a CC) .. py:method:: _show_transport_press(message: object) -> None Name the transport action a button press triggers, if any. :param message: mido.Message :return: None .. py:method:: start_transport_learn(action: jdxi_editor.midi.io.controller_map.TransportAction) -> None Add the next button pressed as a trigger for ``action``. :param action: TransportAction :return: None .. py:method:: cancel_transport_learn() -> None Stop waiting for a transport button. :return: None .. py:method:: assign_transport(spec: jdxi_editor.midi.io.controller_map.TransportSpec) -> None Add ``spec`` to its action's buttons, taking it from any other action. A button can only do one thing, so it is removed from the others. :param spec: TransportSpec :return: None .. py:method:: clear_transport_action(action: jdxi_editor.midi.io.controller_map.TransportAction) -> None Remove every button bound to ``action``. :param action: TransportAction :return: None .. py:method:: reset_transport() -> None Go back to the selected controller's built-in transport buttons. :return: None .. py:method:: apply_transport() -> None Save the transport buttons and tell the MIDI File player. :return: None .. py:method:: closeEvent(event) -> None Stop the status timer and any learn in progress. :param event: QCloseEvent :return: None