Hello Guest

openal tutorial on osx tiger ppc

  • 3 Replies
  • 7258 Views
*

Offline jmo

  • *
  • 2
openal tutorial on osx tiger ppc
« on: October 25, 2006, 05:49:57 »
Hi,
I have just begun using lwjgl and wanted to try out some of the openal tutorials.  I have no problem compiling but when I attempt to run them I receive the following error:

java Lesson2
DigiCoreAudioDriver> Found 8 entries in 'SupportedApps.txt'.
java.lang.NullPointerException
        at org.lwjgl.util.WaveData.create(WaveData.java:95)
        at org.lwjgl.util.WaveData.create(WaveData.java:112)
        at Lesson2.loadALData(Lesson2.java:105)
        at Lesson2.execute(Lesson2.java:174)
        at Lesson2.main(Lesson2.java:208)
Exception in thread "main" java.lang.NullPointerException
        at Lesson2.loadALData(Lesson2.java:106)
        at Lesson2.execute(Lesson2.java:174)
        at Lesson2.main(Lesson2.java:208)

Is there an easy way to get the tutorials working?  I have found other lwjgl openal code that complies and works fine, but it's a little more than basic which makes it harder to learn from.

Thanks,
Joe

*

Offline Matzon

  • *****
  • 2242
openal tutorial on osx tiger ppc
« Reply #1 on: October 25, 2006, 06:50:13 »
if you copy the lesson2 folder to the root of your lwjgl installation and compile it, then enter the dir.
Then you should be able to issue this command to run it:
Quote
java -cp .;..\bin -Djava.library.path=..\libs\win32 Lesson2


due to some time changes you might want to change execute to this:

Code: [Select]
public void execute() {
    // Initialize OpenAL and clear the error bit.
    try {
    AL.create();
    } catch (LWJGLException le) {
    le.printStackTrace();
      return;
    }
    AL10.alGetError();

    // Load the wav data.
    if(loadALData() == AL10.AL_FALSE) {
      System.out.println("Error loading data.");
      return;
    }

    setListenerValues();

    AL10.alSourcePlay(source.get(0));
   
    // loop
    long timeout = Sys.getTime() + (long)(0.1f * Sys.getTimerResolution());

    System.out.println("Press ENTER to exit");
   
    while(!kbhit()) {
    if(Sys.getTime() > timeout) {
    timeout = Sys.getTime() + (long)(0.1f * Sys.getTimerResolution());
    System.out.println("move");
   
    sourcePos.put(0, sourcePos.get(0) + sourceVel.get(0));
    sourcePos.put(1, sourcePos.get(1) + sourceVel.get(1));
    sourcePos.put(2, sourcePos.get(2) + sourceVel.get(2));
   
    AL10.alSource(source.get(0), AL10.AL_POSITION, sourcePos);
    }
    }
   
    killALData();
  }

*

Offline jmo

  • *
  • 2
openal tutorial on osx tiger ppc
« Reply #2 on: October 25, 2006, 15:12:26 »
I was able to recompile in the in the lwjgl installation directory and run it with just:
java lesson2
I know this is a noob question, but why wouldn't compiling and running the program from another directory work?  I have all my lwjgl .jars .dylibs and .jnilibs available in the classpath.
Thanks again for the help.  Everyone has obviously put a TON of time into the project.
Best,
Joe

*

Offline Matzon

  • *****
  • 2242
openal tutorial on osx tiger ppc
« Reply #3 on: October 25, 2006, 17:30:25 »
you can run it from whatever directory you like - however you need to make sure that the classfiles and/or jars are on the classpath AND that the native files are in the dir specified by java.library.path. This path is NOT the same as the classpath.