From e716de35cc75e25983e10bdd3d768f659fdb2971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 1 Dec 2025 22:33:23 +0100 Subject: [PATCH] Fix Haiku build --- cmake/Modules/FindFluidSynth.cmake | 41 ++++++++++++++++++++++++++++++ src/sdl/sdl_sound.c | 4 +++ 2 files changed, 45 insertions(+) create mode 100644 cmake/Modules/FindFluidSynth.cmake diff --git a/cmake/Modules/FindFluidSynth.cmake b/cmake/Modules/FindFluidSynth.cmake new file mode 100644 index 000000000..37bd7392e --- /dev/null +++ b/cmake/Modules/FindFluidSynth.cmake @@ -0,0 +1,41 @@ +# Find FluidSynth +# Once done, this will define +# +# FLUIDSYNTH_FOUND - system has FluidSynth +# FLUIDSYNTH_INCLUDE_DIRS - FluidSynth include directories +# FLUIDSYNTH_LIBRARIES - link libraries + +include(LibFindMacros) + +libfind_pkg_check_modules(FLUIDSYNTH_PKGCONF FLUIDSYNTH) + +# includes +find_path(FLUIDSYNTH_INCLUDE_DIR + NAMES fluidsynth.h + PATHS + ${FLUIDSYNTH_PKGCONF_INCLUDE_DIRS} +) + +# library +find_library(FLUIDSYNTH_LIBRARY + NAMES fluidsynth + PATHS + ${FLUIDSYNTH_PKGCONF_LIBRARY_DIRS} + "/usr/lib" + "/usr/local/lib" +) + +# set include dir variables +set(FLUIDSYNTH_PROCESS_INCLUDES FLUIDSYNTH_INCLUDE_DIR) +set(FLUIDSYNTH_PROCESS_LIBS FLUIDSYNTH_LIBRARY) +libfind_process(FLUIDSYNTH) + +if(FLUIDSYNTH_FOUND AND NOT TARGET FluidSynth::libfluidsynth) + add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED) + set_target_properties( + FluidSynth::libfluidsynth + PROPERTIES + IMPORTED_LOCATION "${FLUIDSYNTH_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${FLUIDSYNTH_INCLUDE_DIR}" + ) +endif() diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index b2c1236f2..4260e144b 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1199,7 +1199,11 @@ boolean I_SetSongSpeed(float speed) if (synth_player) { SDL_LockAudioStream(audio_stream); +#if FLUIDSYNTH_VERSION_MINOR < 2 + fluid_player_set_bpm(synth_player, speed); +#else fluid_player_set_tempo(synth_player, FLUID_PLAYER_TEMPO_INTERNAL, speed); +#endif SDL_UnlockAudioStream(audio_stream); return true; }