NativeFmodEx — ThreadUnsafe
Historical project documentation. Versions and platform requirements describe the original releases.
-
THREADS AND THREAD SAFETY
-
Article from FMOD Ex documentation
There is an article in FMOD Ex documentation talking
about thread safety.
Here is an excert of the REALLY important part of the article:
|
Thread safety, Firelight Technologies FMOD Ex |
|
Do not call FMOD commands from different threads! This will lead to
instability, corruption and possible crashes. |
-
What this article means ?
This means that you SHOULD make the FMOD Ex calls
from a unique thread.
You can't have a thread for the creation, another for updating the system, a
third for music management ...
-
Consequences
If you use more than one thread for FMOD Ex, you could have
major bad effects like NO OUTPUT SOUND,
SOUND BUT PLAYING TOO FAST,
NO SOUND & PLAYING TOO FAST, ...
It can really happened, I've experience all these bad effects.
For 'classic' applications, these effects can be silent. But, when you want to
deploy it with Java Web Start, your application will act strangely. These
strange effects are the consequence of thread unsafe of FMOD Ex.
I don't know why bad effects become effective for JWS applications, where mostly
there is no problems when they are executed 'classicly'.
-
How to fix ?
-
What you should do (not easy if you don't take it in account from the beginning of the development)
Put all call in same thread !
-
What you can do (should work for majority of cases)
By experimentation, the problem come predominantly
from System_Create,
System.init and System.update not in the
same thread.
So at least, put the initialization step and update in the same thread.
-
If the problem is fixed, you're lucky : you probably don't have to touch more of your code !
-
If the problem persists, put the maximumum of the FMOD Ex call into the same thread (HUGE changes).
=> If this is not possible, re-write your application !!!
