jdxi_editor.midi.io.controller_settings ======================================= .. py:module:: jdxi_editor.midi.io.controller_settings .. autoapi-nested-parse:: Stored controller mappings ========================== The CC numbers a controller sends differ between devices, and between the programs of one device: the MiniLab 3 map in :mod:`jdxi_editor.midi.io.controller_map` is only a sensible default. What the user learns in the MIDI Controller dialog is kept here, in QSettings, so it survives a restart. Each entry is stored as ``midi_controller/mapping/`` -> CC number, for example ``midi_controller/mapping/CUTOFF`` -> ``74``. Learnt transport buttons are stored per controller as one JSON list under ``midi_controller//transport``, in the form ``midi_controllers.json`` uses. Attributes ---------- .. autoapisummary:: jdxi_editor.midi.io.controller_settings.MAPPING_GROUP Functions --------- .. autoapisummary:: jdxi_editor.midi.io.controller_settings.mapping_group jdxi_editor.midi.io.controller_settings._settings jdxi_editor.midi.io.controller_settings.default_filter_map jdxi_editor.midi.io.controller_settings.load_filter_map jdxi_editor.midi.io.controller_settings.save_filter_map jdxi_editor.midi.io.controller_settings.clear_filter_map jdxi_editor.midi.io.controller_settings._default_cc jdxi_editor.midi.io.controller_settings._as_cc jdxi_editor.midi.io.controller_settings.transport_key jdxi_editor.midi.io.controller_settings.load_transport_specs jdxi_editor.midi.io.controller_settings.save_transport_specs jdxi_editor.midi.io.controller_settings.clear_transport_specs Module Contents --------------- .. py:data:: MAPPING_GROUP :value: 'midi_controller/mapping' .. py:function:: mapping_group(profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> str QSettings group for ``profile``'s learnt mappings. The MiniLab 3 keeps the original group, so mappings learnt before other controllers were supported still load. :param profile: ControllerProfile :return: str settings group .. py:function:: _settings() -> PySide6.QtCore.QSettings The application's settings store. :return: QSettings .. py:function:: default_filter_map(profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> Dict[int, jdxi_editor.midi.io.controller_map.FilterControl] The built-in map of ``profile``. :param profile: ControllerProfile defaults to the MiniLab 3 :return: dict CC number -> FilterControl .. py:function:: load_filter_map(settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> Dict[int, jdxi_editor.midi.io.controller_map.FilterControl] The stored mapping, falling back to the built-in one per control. A control with nothing stored keeps its default CC, so a part-finished learn still leaves a usable map. :param settings: Optional[QSettings] store to read; defaults to the application's own :param profile: ControllerProfile whose mappings and defaults to use :return: dict CC number -> FilterControl .. py:function:: save_filter_map(mapping: Dict[int, jdxi_editor.midi.io.controller_map.FilterControl], settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> None Store ``mapping`` for ``profile``, replacing whatever was there. :param mapping: dict CC number -> FilterControl :param settings: Optional[QSettings] store to write; defaults to the application's own :param profile: ControllerProfile the mapping belongs to :return: None .. py:function:: clear_filter_map(settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> None Forget ``profile``'s stored mapping, so its built-in one is used again. :param settings: Optional[QSettings] store to clear; defaults to the application's own :param profile: ControllerProfile whose mapping to forget :return: None .. py:function:: _default_cc(control: jdxi_editor.midi.io.controller_map.FilterControl, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> Optional[int] ``profile``'s built-in CC number for ``control``. :param control: FilterControl :param profile: ControllerProfile :return: Optional[int] .. py:function:: _as_cc(value: object) -> Optional[int] Read a stored value as a CC number. QSettings hands back strings on some platforms, and the file can be edited by hand, so anything unusable is discarded rather than trusted. :param value: object stored value :return: Optional[int] a CC number 0-127, or None .. py:function:: transport_key(profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> str QSettings key holding ``profile``'s learnt transport buttons. :param profile: ControllerProfile :return: str settings key .. py:function:: load_transport_specs(settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> tuple[jdxi_editor.midi.io.controller_map.TransportSpec, ...] ``profile``'s transport buttons: the learnt ones, or its built-in ones. :param settings: Optional[QSettings] store to read; defaults to the application's own :param profile: ControllerProfile :return: tuple[TransportSpec, ...] .. py:function:: save_transport_specs(specs: Iterable[jdxi_editor.midi.io.controller_map.TransportSpec], settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> None Store ``profile``'s transport buttons, replacing what was there. :param specs: Iterable[TransportSpec] :param settings: Optional[QSettings] store to write; defaults to the application's own :param profile: ControllerProfile :return: None .. py:function:: clear_transport_specs(settings: Optional[PySide6.QtCore.QSettings] = None, profile: jdxi_editor.midi.io.controller_map.ControllerProfile = MINILAB3) -> None Forget ``profile``'s learnt transport buttons, so its built-in ones apply. :param settings: Optional[QSettings] store to clear; defaults to the application's own :param profile: ControllerProfile :return: None