jdxi_editor.midi.fluidsynth_library =================================== .. py:module:: jdxi_editor.midi.fluidsynth_library .. autoapi-nested-parse:: Native FluidSynth library lookup pyfluidsynth (``import fluidsynth``) is only the Python interface: it loads the native FluidSynth library when imported. On Windows it finds ``libfluidsynth-3.dll`` only through PATH or ``C:\tools\fluidsynth\bin``, so call :func:`prepare_fluidsynth_library` before importing it. That adds the first folder that has the DLL, searched in this order: 1. ``FLUIDSYNTH_DIR`` (environment variable): the folder holding the DLL, or a FluidSynth install whose ``bin`` folder holds it 2. ``fluidsynth/bin`` in the application bundle (the Windows build ships it) or the repository checkout (it is committed there) 3. the folder of the executable (frozen builds) 4. ``C:\tools\fluidsynth\bin``, ``%ProgramFiles%\FluidSynth\bin`` and a Chocolatey install (``choco install fluidsynth``) On macOS and Linux the system loader finds Homebrew or distribution packages, so nothing is done there. .. rubric:: Example >>> prepare_fluidsynth_library() >>> import fluidsynth Attributes ---------- .. autoapisummary:: jdxi_editor.midi.fluidsynth_library.FLUIDSYNTH_DIR_ENV jdxi_editor.midi.fluidsynth_library.DLL_PATTERN jdxi_editor.midi.fluidsynth_library._REPOSITORY_ROOT jdxi_editor.midi.fluidsynth_library._dll_directory_handles jdxi_editor.midi.fluidsynth_library._prepared_dir Functions --------- .. autoapisummary:: jdxi_editor.midi.fluidsynth_library.candidate_dirs jdxi_editor.midi.fluidsynth_library.find_library_dir jdxi_editor.midi.fluidsynth_library.prepare_fluidsynth_library jdxi_editor.midi.fluidsynth_library.missing_library_message jdxi_editor.midi.fluidsynth_library.import_error_message Module Contents --------------- .. py:data:: FLUIDSYNTH_DIR_ENV :value: 'FLUIDSYNTH_DIR' .. py:data:: DLL_PATTERN :value: 'libfluidsynth*.dll' .. py:data:: _REPOSITORY_ROOT .. py:data:: _dll_directory_handles :type: list :value: [] .. py:data:: _prepared_dir :type: Optional[pathlib.Path] :value: None .. py:function:: candidate_dirs() -> list[pathlib.Path] Folders that may hold libfluidsynth-*.dll, most specific first. .. py:function:: find_library_dir(dirs: Optional[Iterable[pathlib.Path]] = None) -> Optional[pathlib.Path] The first folder that contains libfluidsynth-*.dll, or None. .. py:function:: prepare_fluidsynth_library(platform: str = sys.platform) -> Optional[pathlib.Path] Make the native FluidSynth library findable before ``import fluidsynth``. :return: the folder added to the DLL search (Windows), else None .. py:function:: missing_library_message(platform: str = sys.platform) -> str How to install the native library, for this platform. .. py:function:: import_error_message(error: str, platform: str = sys.platform) -> str A status line for a failed ``import fluidsynth``.