Skip to content

Commit

Permalink
Merge pull request #69 from ideoforms/master
Browse files Browse the repository at this point in the history
Add fix to locate Homebrew-installed libfluidsynth on Apple silicon
  • Loading branch information
cclauss committed Aug 7, 2024
2 parents 4ac5ce9 + e1ad069 commit 4779dca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fluidsynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ def load_libfluidsynth(debug_print: bool = False) -> str:
if debug_print:
print(f"'{lib_name}' was loaded as {lib}.")
return lib

# On macOS on Apple silicon, non-Homebrew Python distributions fail to locate
# homebrew-installed instances of FluidSynth. This workaround addresses this.
if homebrew_prefix := os.getenv("HOMEBREW_PREFIX"):
lib = os.path.join(homebrew_prefix, "lib", "libfluidsynth.dylib")
if os.path.exists(lib):
return lib

raise ImportError("Couldn't find the FluidSynth library.")

lib = load_libfluidsynth()
Expand Down

0 comments on commit 4779dca

Please sign in to comment.