GPWiki.org
GPWiki.org
It is currently Thu Jun 20, 2013 3:46 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Slick 2d Sound problem
PostPosted: Sun Jun 17, 2012 8:27 am 
Prolific Poster

Joined: Sun Jan 08, 2012 10:26 pm
Posts: 22
I have gotten to the point in Ghost of John where I feel that I need music, but nothing seems to work. Here are the important bits:

Code:
package goj;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
import org.newdawn.slick.Sound;

public class Menu extends BasicGameState {

   Sound title;
   
   public Menu(int state) {
      
   }
   
   public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
      
      title = new Sound("res/audio/title.ogg");
      title.play();
   }
   
   public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
      
   }

   public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
      
   }
   
   public int getID() {
      return 0;
   }
}


I've taken out all the irrelevant code, but I'm wondering what I've done wrong. I'm certain the OGG is in the right place, and I've tried replaced the "Sound" with "Music", but nothing seems to work. I always get this:

Code:
Sun Jun 17 18:21:43 EST 2012 INFO:Slick Build #274
Sun Jun 17 18:21:43 EST 2012 INFO:LWJGL Version: 2.8.4
Sun Jun 17 18:21:43 EST 2012 INFO:OriginalDisplayMode: 1920 x 1080 x 32 @60Hz
Sun Jun 17 18:21:43 EST 2012 INFO:TargetDisplayMode: 640 x 480 x 0 @0Hz
Sun Jun 17 18:21:43 EST 2012 INFO:Starting display 640x480
Sun Jun 17 18:21:43 EST 2012 INFO:Use Java PNG Loader = true
Sun Jun 17 18:21:43 EST 2012 INFO:Controllers not available
Sun Jun 17 18:21:43 EST 2012 INFO:Initialising sounds..
Sun Jun 17 18:21:43 EST 2012 INFO:- Sound works
Sun Jun 17 18:21:43 EST 2012 INFO:- 64 OpenAL source available
Sun Jun 17 18:21:43 EST 2012 INFO:- Sounds source generated
AL lib: FreeContext: (0000000010B051F0) Deleting 64 Source(s)
Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jorbis/Info
   at org.newdawn.slick.openal.OggInputStream.<init>(OggInputStream.java:35)
   at org.newdawn.slick.openal.OggDecoder.getData(OggDecoder.java:311)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:835)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:793)
   at org.newdawn.slick.Sound.<init>(Sound.java:58)
   at goj.Menu.init(Menu.java:23)
   at goj.Game.initStatesList(Game.java:19)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
   at goj.Game.main(Game.java:30)
Caused by: java.lang.ClassNotFoundException: com.jcraft.jorbis.Info
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 11 more


I'm trying to work this out, and I've checked all the places listed, and even the Javadoc.

_________________
Ghost of John Trailer:

http://www.youtube.com/watch?v=W1Ddgec36Jk&feature=youtu.be


Top
 Profile  
 
PostPosted: Sun Jun 17, 2012 12:12 pm 
Shake'n'Baker

Joined: Sun May 27, 2012 6:01 pm
Posts: 62
l3gendArch3r wrote:
I have gotten to the point in Ghost of John where I feel that I need music, but nothing seems to work. Here are the important bits:

Code:
package goj;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
import org.newdawn.slick.Sound;

public class Menu extends BasicGameState {

   Sound title;
   
   public Menu(int state) {
      
   }
   
   public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
      
      title = new Sound("res/audio/title.ogg");
      title.play();
   }
   
   public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
      
   }

   public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
      
   }
   
   public int getID() {
      return 0;
   }
}


I've taken out all the irrelevant code, but I'm wondering what I've done wrong. I'm certain the OGG is in the right place, and I've tried replaced the "Sound" with "Music", but nothing seems to work. I always get this:

Code:
Sun Jun 17 18:21:43 EST 2012 INFO:Slick Build #274
Sun Jun 17 18:21:43 EST 2012 INFO:LWJGL Version: 2.8.4
Sun Jun 17 18:21:43 EST 2012 INFO:OriginalDisplayMode: 1920 x 1080 x 32 @60Hz
Sun Jun 17 18:21:43 EST 2012 INFO:TargetDisplayMode: 640 x 480 x 0 @0Hz
Sun Jun 17 18:21:43 EST 2012 INFO:Starting display 640x480
Sun Jun 17 18:21:43 EST 2012 INFO:Use Java PNG Loader = true
Sun Jun 17 18:21:43 EST 2012 INFO:Controllers not available
Sun Jun 17 18:21:43 EST 2012 INFO:Initialising sounds..
Sun Jun 17 18:21:43 EST 2012 INFO:- Sound works
Sun Jun 17 18:21:43 EST 2012 INFO:- 64 OpenAL source available
Sun Jun 17 18:21:43 EST 2012 INFO:- Sounds source generated
AL lib: FreeContext: (0000000010B051F0) Deleting 64 Source(s)
Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jorbis/Info
   at org.newdawn.slick.openal.OggInputStream.<init>(OggInputStream.java:35)
   at org.newdawn.slick.openal.OggDecoder.getData(OggDecoder.java:311)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:835)
   at org.newdawn.slick.openal.SoundStore.getOgg(SoundStore.java:793)
   at org.newdawn.slick.Sound.<init>(Sound.java:58)
   at goj.Menu.init(Menu.java:23)
   at goj.Game.initStatesList(Game.java:19)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
   at goj.Game.main(Game.java:30)
Caused by: java.lang.ClassNotFoundException: com.jcraft.jorbis.Info
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 11 more


I'm trying to work this out, and I've checked all the places listed, and even the Javadoc.


"Sound" is the correct Class to use, "Music" does not exist.
http://slick.cokeandcode.com/javadoc/or ... Sound.html
Your error message about "ClassNotFound" must be related to this?

It might be worth catching the error during the Sound creation. You currently propagate it to the caller of init? (Which is not listed in your post)

All the best,
cxzuk


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group