org.newdawn.slick.Music Java Examples
The following examples show how to use
org.newdawn.slick.Music.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoundTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { SoundStore.get().setMaxSources(32); myContainer = container; sound = new Sound("testdata/restart.ogg"); charlie = new Sound("testdata/cbrown01.wav"); try { engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav")); } catch (IOException e) { throw new SlickException("Failed to load engine", e); } music = musica = new Music("testdata/SMB-X.XM"); //music = musica = new Music("testdata/theme.ogg", true); musicb = new Music("testdata/kirby.ogg", true); burp = new Sound("testdata/burp.aif"); music.play(); }
Example #2
Source File: DeferredLoadingTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { LoadingList.setDeferredLoading(true); new Sound("testdata/cbrown01.wav"); new Sound("testdata/engine.wav"); sound = new Sound("testdata/restart.ogg"); new Music("testdata/testloop.ogg"); music = new Music("testdata/SMB-X.XM"); new Image("testdata/cursor.png"); new Image("testdata/cursor.tga"); new Image("testdata/cursor.png"); new Image("testdata/cursor.png"); new Image("testdata/dungeontiles.gif"); new Image("testdata/logo.gif"); image = new Image("testdata/logo.tga"); new Image("testdata/logo.png"); new Image("testdata/rocket.png"); new Image("testdata/testpack.png"); font = new AngelCodeFont("testdata/demo.fnt", "testdata/demo_00.tga"); }
Example #3
Source File: ResourceHolderSlick.java From nullpomino with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Specified numberOfBGMRead into memory * @param no BGM number * @param showerr displayed on the console when an exception occurs */ public static void bgmLoad(int no, boolean showerr) { if(NullpoMinoSlick.propConfig.getProperty("option.bgm", false) == false) return; if(bgm[no] == null) { if(showerr) log.info("Loading BGM" + no); try { String filename = NullpoMinoSlick.propMusic.getProperty("music.filename." + no, null); if((filename == null) || (filename.length() < 1)) { if(showerr) log.info("BGM" + no + " not available"); return; } boolean streaming = NullpoMinoSlick.propConfig.getProperty("option.bgmstreaming", true); bgm[no] = new Music(filename, streaming); if(!showerr) log.info("Loaded BGM" + no); } catch(Throwable e) { if(showerr) log.error("BGM " + no + " load failed", e); else log.warn("BGM " + no + " load failed"); } } }
Example #4
Source File: SoundURLTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { sound = new Sound(ResourceLoader.getResource("testdata/restart.ogg")); charlie = new Sound(ResourceLoader.getResource("testdata/cbrown01.wav")); engine = new Sound(ResourceLoader.getResource("testdata/engine.wav")); //music = musica = new Music("testdata/SMB-X.XM"); music = musica = new Music(ResourceLoader.getResource("testdata/restart.ogg"), false); musicb = new Music(ResourceLoader.getResource("testdata/kirby.ogg"), false); burp = new Sound(ResourceLoader.getResource("testdata/burp.aif")); }
Example #5
Source File: SoundPositionTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { SoundStore.get().setMaxSources(32); myContainer = container; music = new Music("testdata/kirby.ogg", true); music.play(); }
Example #6
Source File: MusicListenerTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { music = new Music("testdata/restart.ogg", false); stream = new Music("testdata/restart.ogg", false); music.addListener(this); stream.addListener(this); }
Example #7
Source File: MusicListenerTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.MusicListener#musicEnded(org.newdawn.slick.Music) */ public void musicEnded(Music music) { musicEnded = true; }
Example #8
Source File: MusicListenerTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.MusicListener#musicSwapped(org.newdawn.slick.Music, org.newdawn.slick.Music) */ public void musicSwapped(Music music, Music newMusic) { musicSwapped = true; }