-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ex_hrtf_spatialization example have no sound bug #216
base: main
Are you sure you want to change the base?
Conversation
Thanks for thinking about this some more. I think it would be good to add an option cmake/LabSound.cmake:
and then we could elide the existing libsamplerate internal c file if that option is OFF, and all the currently commented sections could be guarded by the option as well. Then you wouldn't have to modify the cmake file at all, just pass in As a further question beyond the suggestion of adding an option, does it make sense for your use to use add_subdirectory for libsamplerate as a submodule, or would it be better to use find_package? If |
your ideas are more thoughtful, look forward to your repair update. |
I'm going to leave this open as we think about it. Would this work in your case? diff --git a/cmake/LabSound.cmake b/cmake/LabSound.cmake
index 1b8757ad..8abd7691 100644
--- a/cmake/LabSound.cmake
+++ b/cmake/LabSound.cmake
@@ -44,17 +44,28 @@ elseif (LABSOUND_USE_RTAUDIO)
)
endif()
-#option(LIBSAMPLERATE_EXAMPLES "" OFF)
-#option(LIBSAMPLERATE_INSTALL "" ON)
-#option(BUILD_TESTING "" OFF) # suppress testing of libsamplerate
-#add_subdirectory("${LABSOUND_ROOT}/third_party/libsamplerate")
+option(LABSOUND_INTERNAL_LIBSAMPLERATE, "Use internal libsamplerate", ON)
+if (LABSOUND_INTERNAL_LIBSAMPLERATE)
+ set(LABSOUND_LSR "${LABSOUND_ROOT}/src/internal/src/samplerate.c")
+else()
+ find_package(libsamplerate)
+ if (NOT libsamplerate_FOUND)
+ message(INFO "libsamplerate not found, using submodule")
+ option(LIBSAMPLERATE_EXAMPLES "" OFF)
+ option(LIBSAMPLERATE_INSTALL "" ON)
+ option(BUILD_TESTING "" OFF) # suppress testing of libsamplerate
+ add_subdirectory("${LABSOUND_ROOT}/third_party/libsamplerate")
+ endif()
+ set(LABSOUND_LSR SampleRate::samplerate)
+endif()
file(GLOB labsnd_core_h "${LABSOUND_ROOT}/include/LabSound/core/*")
file(GLOB labsnd_extended_h "${LABSOUND_ROOT}/include/LabSound/extended/*")
file(GLOB labsnd_core "${LABSOUND_ROOT}/src/core/*")
file(GLOB labsnd_extended "${LABSOUND_ROOT}/src/extended/*")
file(GLOB labsnd_int_h "${LABSOUND_ROOT}/src/internal/*")
-file(GLOB labsnd_int_src "${LABSOUND_ROOT}/src/internal/src/*")
+# only pick up the cpp, don't pick up libsamplerate.c
+file(GLOB labsnd_int_src "${LABSOUND_ROOT}/src/internal/src/*.cpp")
# FFT
if (IOS)
@@ -79,6 +90,7 @@ add_library(LabSound STATIC
${labsnd_int_h} ${labsnd_int_src}
${labsnd_fft_src}
${ooura_src}
+ ${LABSOUND_LSR}
)
#--- CONFIGURE RTAUDIO |
report error while cmake: |
I don't known if this is a better way to fix this bug, if so, I hope the author can adopt it. If not, just reject it.