Skip to content
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

Oboe audio driver is not producing any sound in Android #1393

Closed
prasenjitghoshcse opened this issue Oct 5, 2024 · 4 comments · Fixed by #1394
Closed

Oboe audio driver is not producing any sound in Android #1393

prasenjitghoshcse opened this issue Oct 5, 2024 · 4 comments · Fixed by #1394

Comments

@prasenjitghoshcse
Copy link

FluidSynth version

2.3.6 prebuild library package for Android

Describe the bug

Oboe audio driver is not producing any sound in Android. Even if liboboe.so is excluded in the build script, there is no linking error. Seems OBOE dependency is missing in this version of the package.

Expected behavior

Selecting oboe as audio driver through settings parameters, should use oboe and produce audio in Android.

Steps to reproduce

In CMakeList.txt if I place following block for creating my own library, there is no link failure.

target_link_libraries(
native-lib

# Non-fluidsynth binaries
libc++_shared
libomp

# fluidsynth binaries
libFLAC
libfluidsynth
libfluidsynth-assetloader
libgio-2.0
libglib-2.0
libgmodule-2.0
libgobject-2.0
libgthread-2.0
libinstpatch-1.0

liboboe --------- Note oboe is not linked

libogg
libopus
libpcre
libsndfile
libvorbis
libvorbisenc
libvorbisfile

)

Additional context

Following is the full CMakeLists.txt

# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)


# Create a variable fluidsynth_DIR to specify where the fluidsynth library is located.
set(fluidsynth_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fluidsynth)

# Create a variable lib_other_DIR to specify where the other non-fluidsynth libraries is located.
set(lib_other_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib_other)


# Fluidsynth library code will be calling some non-fluidsynth functions which are not part of
# default NDK, so we add the binaries as dependencies of our code.

add_library(libc++_shared SHARED IMPORTED)
set_target_properties(libc++_shared PROPERTIES IMPORTED_LOCATION ${lib_other_DIR}/${ANDROID_ABI}/libc++_shared.so)

add_library(libomp SHARED IMPORTED)
set_target_properties(libomp PROPERTIES IMPORTED_LOCATION ${lib_other_DIR}/${ANDROID_ABI}/libomp.so)


# Our code (native-lib.cpp) will be calling fluidsynth functions, so adding the fluidsynth binaries as dependencies.

add_library(libFLAC SHARED IMPORTED)
set_target_properties(libFLAC PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libFLAC.so)

add_library(libfluidsynth SHARED IMPORTED)
set_target_properties(libfluidsynth PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libfluidsynth.so)

add_library(libfluidsynth-assetloader SHARED IMPORTED)
set_target_properties(libfluidsynth-assetloader PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libfluidsynth-assetloader.so)

add_library(libgio-2.0 SHARED IMPORTED)
set_target_properties(libgio-2.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libgio-2.0.so)

add_library(libglib-2.0 SHARED IMPORTED)
set_target_properties(libglib-2.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libglib-2.0.so)

add_library(libgmodule-2.0 SHARED IMPORTED)
set_target_properties(libgmodule-2.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libgmodule-2.0.so)

add_library(libgobject-2.0 SHARED IMPORTED)
set_target_properties(libgobject-2.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libgobject-2.0.so)

add_library(libgthread-2.0 SHARED IMPORTED)
set_target_properties(libgthread-2.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libgthread-2.0.so)

add_library(libinstpatch-1.0 SHARED IMPORTED)
set_target_properties(libinstpatch-1.0 PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libinstpatch-1.0.so)

#add_library(liboboe SHARED IMPORTED)
#set_target_properties(liboboe PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/liboboe.so)

add_library(libogg SHARED IMPORTED)
set_target_properties(libogg PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libogg.so)

add_library(libopus SHARED IMPORTED)
set_target_properties(libopus PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libopus.so)

add_library(libpcre SHARED IMPORTED)
set_target_properties(libpcre PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libpcre.so)

add_library(libsndfile SHARED IMPORTED)
set_target_properties(libsndfile PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libsndfile.so)

add_library(libvorbis SHARED IMPORTED)
set_target_properties(libvorbis PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libvorbis.so)

add_library(libvorbisenc SHARED IMPORTED)
set_target_properties(libvorbisenc PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libvorbisenc.so)

add_library(libvorbisfile SHARED IMPORTED)
set_target_properties(libvorbisfile PROPERTIES IMPORTED_LOCATION ${fluidsynth_DIR}/lib/${ANDROID_ABI}/libvorbisfile.so)


# Library that will be called directly from JAVA
add_library(native-lib SHARED native-lib.cpp)


# Specifies the directory where the C or C++ source code will look the #include <yourlibrary.h> header files
target_include_directories(native-lib PRIVATE ${fluidsynth_DIR}/include)


# Link everything all together. Notice that native-lib should be the first element in the list.
target_link_libraries(
    native-lib

    # Non-fluidsynth binaries
    libc++_shared
    libomp

    # fluidsynth binaries
    libFLAC
    libfluidsynth
    libfluidsynth-assetloader
    libgio-2.0
    libglib-2.0
    libgmodule-2.0
    libgobject-2.0
    libgthread-2.0
    libinstpatch-1.0
#    liboboe
    libogg
    libopus
    libpcre
    libsndfile
    libvorbis
    libvorbisenc
    libvorbisfile
)
@derselbst
Copy link
Member

The Android binaries were indeed compiled without oboe support. I need to investigate.

Selecting oboe as audio driver through settings parameters, should use oboe and produce audio in Android.

PS: Make sure to evaluate the return value. In this case FLUID_FAILED will be returned, allowing you to handle that error.

@derselbst derselbst added this to the 2.3 milestone Oct 5, 2024
@derselbst
Copy link
Member

This bug seems to be a regression from da7e0d1. I fixed it, pls try those binaries and let me know if it works again:
https://dev.azure.com/tommbrt/tommbrt/_build/results?buildId=10637&view=artifacts&pathAsName=false&type=publishedArtifacts

@prasenjitghoshcse
Copy link
Author

prasenjitghoshcse commented Oct 5, 2024

Hi, yes, the binaries you provided works. Thanks for your quick help.

Is there going to be any official release? or I should use the binary you provided?

@derselbst
Copy link
Member

Ok, great. Fluidsynth 2.3.7 will have binaries as usual. I'll probably take 1-2 weeks until the release.

Thanks for the report!

@derselbst derselbst linked a pull request Oct 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants