I found the simples way! I just download these sources: https://github.com/AerialX/openal-soft-android and built it using CMake. The libopenal.so library was created. I created the "Play" button. I built my first app that plays music using OpenAL! It works on my smartphone! It's cool!
My step-by-step guide for Qt 6.2.4 MinGW 64-bit:
Download these sources:
https://github.com/AerialX/openal-soft-android
Download CMake (add it to the Path variable):
https://cmake.org/download/
Go to openal-soft-android from the console (cd openal-soft-android)
Copy the next commands to the console (don't forget to change the path to your android.toolchain.cmake)
cmake -G "MinGW Makefiles" -S . -B ./build -DCMAKE_TOOLCHAIN_FILE=E:\AppData\Android\SDK\ndk\22.1.7171670\build\cmake\android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=29
cmake --build ./build -j 4
The libopenal.so will be created. Create a new Qt project. Create the jniLibs/armeabi-v7a folder inside of your Qt project. And copy libopenal.so inside of jniLibs/armeabi-v7a.
Create the libs\openal-soft\include folder inside of your Qt project and copy the AL folder there.
Add these settings to your pro-file:
INCLUDEPATH += $$PWD/libs/openal-soft/include
contains(ANDROID_TARGET_ARCH, armeabi-v7a)
{
ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libopenal.so
}
Added 2/25/2024
I use these settings to run on Windows, real device, and Android Emulator:
CONFIG("windows") {
INCLUDEPATH += $$PWD/libs/openal-soft-desktop-1.23.1/include
LIBS += -L$$PWD/libs/openal-soft-desktop-1.23.1/lib/x64
LIBS += -lOpenAL32.dll
}
CONFIG("armeabi-v7a") {
INCLUDEPATH += $$PWD/libs/openal-soft-android/include
contains(ANDROID_TARGET_ARCH, armeabi-v7a)
{
ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libopenal.so
}
}
CONFIG("x86") {
INCLUDEPATH += $$PWD/libs/openal-soft-android/include
contains(ANDROID_TARGET_ARCH, x86)
{
ANDROID_EXTRA_LIBS += $$PWD/jniLibs/x86/libopenal.so
}
}