Making "looping" work

Sooo, i’ve been using that 3D Sound Engine from Paul’s Code, but i can’t get stuff to loop, check the examples:


import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.SoundSystemException;
import paulscode.sound.codecs.CodecJOgg;
import paulscode.sound.libraries.LibraryJavaSound;

public class Example_2 {
	SoundSystem mySoundSystem;
	
    public static void main(String[] args) {
        new Example_2();
    }

    public Example_2() {
        try {
            SoundSystemConfig.addLibrary(LibraryJavaSound.class);
            SoundSystemConfig.setCodec("ogg", CodecJOgg.class);
            SoundSystemConfig.setSoundFilesPackage("");
            mySoundSystem = new SoundSystem(LibraryJavaSound.class);
        }
        catch(SoundSystemException e) {
            System.err.println("WE GOT AN ERROR HERE HOUSTON" );
        }
        
        String filename = "hurr.ogg";
        
        //Plays once.
    	 mySoundSystem.backgroundMusic("music", getClass().getResource(filename), filename, false);
        mySoundSystem.setLooping("music", true);
        mySoundSystem.play("music");
        
        //If looping is set to false, plays the first 6 seconds, then stops. If looping is set to true, it keeps looping the same 6 seconds.   
        mySoundSystem.newSource(false, "music", getClass().getResource(filename), filename, false, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff());
        mySoundSystem.setLooping("music", true);
        mySoundSystem.play("music");

        //Same as above.
        mySoundSystem.quickPlay(false, filename, true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff());
   
        //Does not loop.
        mySoundSystem.quickStream(false, getClass().getResource(filename), filename, true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff());

        //Plays once. queueSound does nothing.
        mySoundSystem.newStreamingSource(false, "music", getClass().getResource(filename), filename, true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff());
        mySoundSystem.setLooping("music", true);
        mySoundSystem.queueSound("music", getClass().getResource(filename), filename);
        mySoundSystem.play("music");
            	
        while(true) {
    		if (mySoundSystem.playing("music")) System.out.println(mySoundSystem.millisecondsPlayed("music"));
    	}
    }
}

I actually managed to make the song loop manually, using the millisecondsPlayed() method, but the loop isn’t seamless
Any ideas or reccomendations on audio libs?



 myMusicSystem.backgroundMusic("sourcename", "music/mymusic.ogg", true); /* last parameter tells to loop */


I tried that as well. Same results.

The mySoundSystem.setLooping(“music”, true); was just to emphatize it

Well it just works here. Maybe the coded you’re using is failing to notify end of stream.
Which codec you’re using?

CodecJOgg

But you are telling me it works. It got my hopes back :slight_smile:

EDIT: Switched to CodecJOrbis. No difference.

Another EDIT: Turns out it was JavaSound doing a poor work. Switched to LWJGLOpenAL and now it works flawlessly.