Hello Guest

FMOD - Webstart problem

  • 4 Replies
  • 19722 Views
FMOD - Webstart problem
« on: January 06, 2006, 17:47:33 »
Hi everybody,

I'm having trouble with FMOD sounds in Java Webstart on Windows platform (both XP and Win98).

When I load and initialize my game I have FMOD running and all the sound works great. Don't know what happens then (because I'm still trying to track this down), but suddenly I don't hear the FSoundSample sounds anymore and I get no error from FMOD either. The FMusicModules keep playing nicely and I can use "FSound.FSOUND_PlaySound(FSound.FSOUND_FREE,soundClip)" for the FSoundSamples without getting an error. I just don't hear the sounds anymore. I checked a bunch of values like the volume settings for FSound or whatever could cause this silence, but they all look ok and I couldn't find the error so far. I used LWJGL 0.97 and upgraded to LWJGL 0.99 today. This didn't change anything.

Are there any known issues with FMOD and Java Webstart or with using different Threads or Thread.sleep() while working with FMOD??? Because I init the SoundSystem in the main-Thread and use it later from a Game-Loop-Thread. Had no problems so far with this and FMOD-Music and OpenAL work fine. FSoundSamples work normal in a single-threaded sound test I wrote. There I'm using the Java Swing Event-Dispatcher-Thread for initializing FMOD and playing the sounds.

The really strange thing is, that when I launch the game locally in my Eclipse IDE, I don't have this problem and FSoundSamples work like expected. Only when I launch it trough Webstart I can't hear the sounds anymore after a while!

I'm using LWJGL 0.99 with fmod.dll 3.7.4.0 and JDK 1.5.0_06. My Java classes are compiled for Java 1.4 platform.

Hope somebody can help me out! :-(

Best regards,
Eboreus

*

Offline Matzon

  • *****
  • 2242
FMOD - Webstart problem
« Reply #1 on: January 07, 2006, 00:33:29 »
No known issues with threads and fmod - however that doesn't mean that there aren't any!

I have no reason to believe that fmod should behave differently when run as local app vs webstart.

Sorry not much of a help :(

FMOD - Webstart problem
« Reply #2 on: January 07, 2006, 22:34:03 »
Hi again,

thanks for the fast response! It was not much help, but motivating! ;-)

So I finally found the reason for the problem: as soon as the MAIN-Thread ends, the sounds go off and don't work anymore. If a sound is playing at this moment, it gets interrupted. As long as I keep the MAIN-Thread running, everything works fine. I fixed the problem for me by using the MAIN-Thread as GameLoop instead of starting a new Thread, but I don't know why the problem appears at all and why only in Webstart. It occurs with different configurations and the same code works even with Webstart on one Win98 machine. So I'm a bit confused!

I don't use a LWJGL Game-Window and have my own GameLoop Thread. Does this make a difference?
"FSound.FSOUND_Update()" is called every frame in the GameLoop, but FMOD normally works even without that.

Basically I do the following in the MAIN-Thread:

- init sound
- init graphic and load images
- init input devices
- start game loop thread

The same code works with Webstart for a Swing-based sound test and a few short demos, but doesn't want to work with that game I have. But there's not a big difference except the amount of images and sounds I load. I even tried to comment out everything in the game to get just the sound running, without any graphics and input, but the sound effects die as soon as the MAIN-Thread quits. I tried then to reproduce the error with a small test program, that does exactly the same, but it didn't work and everything stayed normal there!

Looking at the situation, I could imagine that it has something to do with the MAIN-Thread's context and Garbage Collection. Maybe some objects loaded with the MAIN-Thread's ClassLoader get deleted as soon as the MAIN-Thread quits. Or maybe some threads stop working.

How can I see if FMOD and the FMOD native threads are still running correctly?

Could it be that the ByteBuffers for the FSoundSamples are not valid anymore after the MAIN-Thread quits?

The sounds get loaded like this:
FSoundSample sound = FSound.FSOUND_Sample_Load(soundCounter,data,FSound.FSOUND_LOADMEMORY,0,data.capacity());

Which ClassLoader is used for loading a FSoundSample? Maybe it's the Classloader?!

*

Offline mac

  • *
  • 37
    • http://www.mac-systems.de
FMOD - Webstart problem
« Reply #3 on: February 03, 2006, 13:48:44 »
Hi,

i ran in a same situtation like you Eboreus. Actually i haven't figured out what cause this behavior. I also checked all init code and the volume setting without any success. All ran fine when my application gets started from commandline, only webstart version is silent.

For me i can remember that in a early dev. phase no problems occured. I was able to hear the Sound under webstart too, for me seems we ran in the same problem. Also i think its not caused by the classloader or gc.
May this is not right but i guess it's caused by a Thread in some situtation.

regards,
Jens
he Network is the Music
www.mac-systems.de

FMOD - Webstart problem
« Reply #4 on: February 03, 2006, 16:22:32 »
Thanks for the reply! :)

Quote
Also i think its not caused by the classloader or gc.
May this is not right but i guess it's caused by a Thread in some situtation.


I fixed my problem by keeping the Main-Thread alive. There were sounds as long as the Main-Thread was running, but as soon as it ended the sounds went off. So I think this has something to do with Threads. On the other hand the problem only occured when more resources and/or classes were loaded in the game. With small demos it didn't happen, that's why I think it could have something to do with GC or the ClassLoader. But this is just guessing ...

What I know for sure is, that the problem only occurs in Webstart and only for the FMOD-Sounds. The FMOD-Music works great all the time.

So far I didn't do any further investigation on this issue, but if more people experience the same problem and are able to reproduce it, it would make sense to invest some time here. So please let me know!