1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| 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"; mySoundSystem.backgroundMusic("music", getClass().getResource(filename), filename, false); mySoundSystem.setLooping("music", true); mySoundSystem.play("music"); mySoundSystem.newSource(false, "music", getClass().getResource(filename), filename, false, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff()); mySoundSystem.setLooping("music", true); mySoundSystem.play("music");
mySoundSystem.quickPlay(false, filename, true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff()); mySoundSystem.quickStream(false, getClass().getResource(filename), filename, true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, SoundSystemConfig.getDefaultRolloff());
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")); } } } |