FMOD slows down my project

Started by Numknuf, June 06, 2005, 14:18:37

Previous topic - Next topic


I use FMOD in a program with a JFileChooser and other Swing components. The problem is that the moment fmod is created, the filechooser is slow to move between directories.
Are there any specific reasons for this?


Never mind. I seem to have solved the problem by explcitly creating FMOD earlier in my project. It's odd though...


hmm, I am not aware of any performance issues by just creating FMOD ??


If I referenced this class early in my project, the slow browsing problem disappeared. This class is supposed to be created only once, right? But isn't instantiated before the instance is referenced, so it can't have anything to do with garbage collection?

import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
import static org.lwjgl.fmod3.FSound.*;

public class SoundPlayer {
    public static final SoundPlayer instance = new SoundPlayer();

    private SoundPlayer() {

    private void init() {
        try {
            FSOUND_Init(44100, 32, 0);
        } catch (FMODException e) {
            System.out.println("Error:" + FMOD.FMOD_ErrorString(FSOUND_GetError()));

    public void play(String file) {
        file = file.replaceAll("\\\\", "/");

        FSoundStream stream = FSound.FSOUND_Stream_Open(file, FSound.FSOUND_NORMAL, 0, 0);
        FSOUND_Stream_SetMode(stream, FSOUND_LOOP_OFF);
        FSound.FSOUND_Stream_Play(1, stream);

    public void stop() {

    public static void destroy() {


Making sure that FMOD is created early and not when used, solved my problem.

Thanks for the work on this API, it's great!