matachi / Robots-Stole-My-Girlfriend

2 stars 1 forks source link

Crashes when playing .ogg sounds #5

Open matachi opened 12 years ago

matachi commented 12 years ago

It's possible to play .wav sound files in the game, but not .ogg. In LevelState I have the following code:

    /**
     * Play a sound if the character has fired his weapon.
     */
    if (level.getCharacter().getWeapon().shot())
        new Sound("res/sounds/shot.wav").play();

But if I change it to:

    /**
     * Play a sound if the character has fired his weapon.
     */
    if (level.getCharacter().getWeapon().shot())
        new Sound("res/sounds/shot.ogg").play();

the game crashes when I fire the weapon. (I have only changed .wav to .ogg)

I suppose we can use .wav files instead, but those take about 3 times as much hard drive space.

It would be nice if anybody else could also try to play the .ogg file. Maybe it's just something wrong with my computer. :P

matachi commented 12 years ago

This is the crash message it outputs:

Sat Apr 07 19:05:04 CEST 2012 ERROR:/ by zero java.lang.ArithmeticException: / by zero at org.newdawn.slick.openal.AudioImpl.(AudioImpl.java:38) at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:854) at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:793) at org.newdawn.slick.Sound.(Sound.java:58) at rsmg.controller.LevelState.update(LevelState.java:232) at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:268) at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:657) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at rsmg.controller.Window.(Window.java:25) at rsmg.Main.main(Main.java:13) Sat Apr 07 19:05:04 CEST 2012 ERROR:Failed to load sound: res/sounds/shot.ogg org.newdawn.slick.SlickException: Failed to load sound: res/sounds/shot.ogg at org.newdawn.slick.Sound.(Sound.java:70) at rsmg.controller.LevelState.update(LevelState.java:232) at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:268) at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:657) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at rsmg.controller.Window.(Window.java:25) at rsmg.Main.main(Main.java:13) Sat Apr 07 19:05:04 CEST 2012 ERROR:Game.update() failure - check the game code. org.newdawn.slick.SlickException: Game.update() failure - check the game code. at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:663) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at rsmg.controller.Window.(Window.java:25) at rsmg.Main.main(Main.java:13) AL lib: FreeContext: (044C2E20) Deleting 64 Source(s)

Zapray commented 12 years ago

No sound is playing for me at all anymore : o I might have screwed something up though

Zapray commented 12 years ago

Nevermind works fine now!