How to set up the FMOD audio library in Qt Creator for Android
-
@JoeCFD said in How to set up the FMOD audio library in Qt Creator for Android:
they are all together. No path issue here.
I mean, maybe Qt try to find it on the wrong path that I wrote in pro-file. I found somewhere that the folder must be named
jniLibs
:contains(ANDROID_TARGET_ARCH, armeabi-v7a) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libfmod.so }
-
I tried to use
lib
instead ofjniLibs
but the result is the same.contains(ANDROID_TARGET_ARCH, armeabi-v7a) { ANDROID_EXTRA_LIBS += $$PWD/lib/armeabi-v7a/libfmod.so }
-
@8Observer8 Very few people have phones with Android 7.
-
@JoeCFD said in How to set up the FMOD audio library in Qt Creator for Android:
Very few people have phones with Android 7.
I think the smaller the version, the more you can capture the audience. Let's say if you build for Android 4, then the application will run on Android 4, 5, 6, 7, 8, 9, 10, 11 and so on. But if you build on the latest version of Android, then the audience will be very small.
-
@8Observer8 then you need to add the support up to Android 13. Did you do it? Or you simply made Android 7 support?
my app supports Android 11, 12 and 13.
-
@JoeCFD said in How to set up the FMOD audio library in Qt Creator for Android:
my app supports Android 11, 12 and 13.
I think Android is backward compatible. That is, if I created applications with the selected Android 4, this means that the application will work not only on Android 4, but also on Android 5, 12 and 13.
-
@8Observer8 I guess not. I built my app for Android 11 and 12 at first. And it did not work on Android 13. I had to add 13 support in the build.
-
@JoeCFD My only guess is that an app built for Android 11 doesn't work on Android 13 because it uses APIs that were removed in Android 13, but unless you're using backwards compatibility hacks, then early apps should work on more number of new devices. But this is only my assumption, which I myself have to verify by experience.
-
I currently have an Android 13 smartphone. I tried to run my music application using OpenAL. It works on smartphones with Android 13 and 7. This is very good, because I thought that I would have to make a separate build in the APK for each version of the smartphone, starting from Android 7 to13.
-
@8Observer8 What I did is to add all SDKs of Android 11, 12 and 13 to the project, but I made only one build . My app works fine in 11, 12 and 13.
-
@JoeCFD said in How to set up the FMOD audio library in Qt Creator for Android:
What I did is to add all SDKs of Android 11, 12 and 13 to the project
Last time you wrote that if the application is built for Android 7 and Android 12 SDK, then it will not work on Android 13. Interestingly, I was unable to remove the Android 12 SDK from Qt Creator. Qt Creator says that Android 12 SDK is required:
I don't have the Android 13 SDK installed, but my app works fine on Android 13 and Android 7:
-
My APK file that I asked to try running on Android 13 two weeks ago turned out to work on Android 7 and Android 13. I compiled OpenAL to work with audio for Android 10 (When building OpenAL, I used Android API 29, which is compatible with Android 10). The compiled library works on Android 7 and Android 13. I tested it on real devices. I have the Android 7 and Android 12 SDKs installed in Qt Creator in the SDK manager. Tried to run on Android 7 and Android: OpenAL, Box2D, Bullet Physics and OpenGL ES 2.0. That's all you need to develop 2D and 3D games. Now I'm not interested in wasting time on FMOD. You can read posts from one of the FMOD developers on the official FMOD forum: https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561
-
@8Observer8 It is the case of my app which has a lot of third-party libs. I had to add Android 13 SDK to make it run properly. But it is also true that 4 small libs I built with
Android 12 can still be used in Android 13. I guess different apps may require different SDKs. I did not spend a lot of time on it and simply made my app running. -
@JoeCFD said in How to set up the FMOD audio library in Qt Creator for Android:
you need to add the support up to Android 13. Did you do it? Or you simply made Android 7 support?
It's not possible to only support Android 7 as Qt Creator won't let you uninstall the Android 12 SDK. If you try to uninstall the Android 12 SDK, Qt Creator will issue a message and install the Android 12 SDK again. FMOD is built in such a way that it will work on Android 13 as well. My example was very simple. It included only FMOD. I understand you just didn't have the time or desire to run it. But I now have two smartphones with Android 7 and Android 13, and I can test my games on OpenGL ES, OpenAL, Box2D and Bullet Physics. I don't need many libraries. These are enough. Qt already includes support for working with JSON, web sockets, and so on. I like OpenAL a lot more than FMOD. I haven't figured out how to use FMOD, but I don't need to - I don't want to waste time on it. OpenAL-Soft is the best for 3D audio because it's easy to install, free and open source.
-
I tried FMOD, Bass, QMediaPlayer and OpenAL. For me, OpenAL is the best. I have made my choice. That's all for the audio library.
Now I will focus on translating my demos from pure WebGL 1.0 (Box2D-WASM/Ammo.js) to OpenGL ES 2.0 (Box2D/Bullet Physics) to run on Android and Desktop:
Pong game using WebGL 1.0, Web Audio API, glMatrix, FreeTexturePacker and JavaScript: https://8observer8.github.io/webgl10-js/2d-games/pong-2d-noobtuts-port-box2dcore-webgl-js/
Multiplayer demo with Jill. This demo uses free hosting from Render.com. You must wait 15-20 seconds to start the server for the first time. The Node.js server on a free hosting falls asleep 30 minutes after the last activity.: https://8observer8.github.io/webgl10-js/room-webgl-js/
You can select "first person" and "third person" camera:
Jill with lighthouse: https://8observer8.github.io/webgl10-js/simple-lighthouse-oimophysics-webgl-js/
I extracted models, textures and animations from the original Resident Evil game. I imported them to Blender, exported to DAE (COLLADA), and import them to pure WebGL 1.0:
- Jill animations: https://8observer8.github.io/webgl10-js/re1/jill-animations-without-skinning-webgl-js/
- Barry animations: https://8observer8.github.io/webgl10-js/re1/barry-animations-without-skinning-webgl-js/
Super Mario (box2d-core) and Bomberman (Box2D-WASM):
Mario: https://8observer8.github.io/webgl10-js/mario-2d-jumps-box2dcore-webgl-js/
Output of English, Russian and Chinese fonts with stroke and Distance Field (the text is not pixelated when the camera zooms in) on JS and Rollup. Fonts converted to Distance Field using Hiero. Shadows was baked in Blender. Demo in the browser: https://8observer8.github.io/webgl10-js/shapes-with-text-webgl-js/
Click detection with color ID. Font in English and Russian. Dynamic shadow: https://8observer8.github.io/webgl10-js/door-with-ortho-shadow-map-webgl-js/
Another demos I will be published here: https://8observer8.github.io/
-
To set up the FMOD audio library in Qt Creator for Android, follow these general steps:
Download FMOD Studio:
Go to the FMOD website and download the FMOD Studio API package.
Install FMOD Studio:
Install FMOD Studio on your development machine.
Create a Qt Android Project:Start a new Qt Creator project for Android or open an existing one.
Include FMOD Libraries:
Add the FMOD library to your Qt project. You can do this by adding the FMOD header files and libraries to your project's .pro file:
INCLUDEPATH += /path/to/fmod/api/lowlevel/inc
LIBS += -L/path/to/fmod/api/lowlevel/lib -lfmodAndroid Permissions:
If your app requires audio permissions, add the necessary permissions to your AndroidManifest.xml file.
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>Initialize FMOD:
In your Qt code, initialize FMOD as early as possible in your application. You'll typically do this in your main function or at the beginning of your Qt application.
#include "fmod.h"
FMOD_SYSTEM* system;
FMOD_RESULT result = FMOD_System_Create(&system);
if (result != FMOD_OK) {
// Handle initialization error
}
result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
if (result != FMOD_OK) {
// Handle initialization error
}Use FMOD in Your Application:
You can now use FMOD functions to manage and play audio within your Qt Creator project.
Build and Deploy:
Build your Qt project and deploy it to an Android device or emulator.
Please note that the specific paths, project configurations, and setup may vary depending on your Qt Creator project and the version of FMOD you are using. Make sure to refer to the FMOD documentation and your Qt Creator documentation for more details and any version-specific information.
-
@Robert-A-Navarro thank you for your answer. I want to try to run FMOD on Android again but before it I want to try to run it on Windows 10 with Qt6 MinGW 64-bit but I have the problem:
undefined reference to `FMOD_System_Create'
. My steps are below.I downloaded "FMOD Engine" instead of "FMOD Studio" because I need "include" and "libs" only:
This is the contains of the "lib/x64" folder:
There are no the
fmod.a
file here. I tried to include "fmod.dll" like this:INCLUDEPATH += "E:/Libs/fmod-2.2.21-mingw-64-bit/include" LIBS += -L"E:/Libs/fmod-2.2.21-mingw-64-bit/lib/x64/fmod.dll"
But I have this error:
undefined reference to `FMOD_System_Create'
I tried to use FMOD with SFML in makefile. It works without the problem:
CC = g++ INC = -I"E:\Libs\SFML-2.5.1-windows-gcc-7.3.0-mingw-64-bit\include" \ -I"E:\Libs\box2d-2.4.1-mingw-64-bit\include" \ -I"E:\Libs\fmod-2.2.21-mingw-64-bit\include" LIB = -L"E:\Libs\SFML-2.5.1-windows-gcc-7.3.0-mingw-64-bit\lib" \ -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib" FLAGS = -c -DSFML_STATIC all: main.o $(CC) main.o $(LIB) -static \ "E:\Libs\fmod-2.2.21-mingw-64-bit\lib\x64\fmod.dll" \ -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lfreetype \ -lopengl32 -lwinmm -lgdi32 -lbox2d -o app main.o: main.cpp $(CC) $(FLAGS) $(INC) main.cpp