3D Sound System

Started by paulscode, March 11, 2008, 02:38:51 AM

Previous topic - Next topic

paulscode

Quote from: Marlon on February 07, 2012, 09:05:03 PM
java.lang.NullPointerException
at paulscode.sound.SoundSystemJPCT.tick(SoundSystemJPCT.java:270)
at graphic.Graphic3DController.update(Graphic3DController.java:708)
Aha, I can see that if it is hitting the exception at the beginning of the loop, then the subsequent source positions wouldn't get updated.  This most likely is the cause for your sounds not panning.  I'll see if I can verify that this is what's happening, and fix the problem if it is.  I'm not sure why the null pointer exception is happening in the first place, though.  This used to happen when using quickPlay, because I wasn't making sure when a temporary source is destroyed, that it gets removed from any objects it is bound to.  I thought I had fixed this problem, but I'll take another look at the code to see if I missed something.  Could be a thread synchronization problem.


Quote from: Marlon on February 07, 2012, 09:05:03 PMAnd at the beginning there is this exception:

Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
Error in class 'LibraryLWJGLOpenAL'
    Unable to initialize OpenAL.  Probable cause: OpenAL not supported.
    ERROR MESSAGE:
        Could not locate OpenAL library.
    STACK TRACE:
        org.lwjgl.openal.AL.create(AL.java:151)
        org.lwjgl.openal.AL.create(AL.java:102)
        org.lwjgl.openal.AL.create(AL.java:201)
        paulscode.sound.libraries.LibraryLWJGLOpenAL.init(LibraryLWJGLOpenAL.java:164)
        paulscode.sound.SoundSystem.CommandNewLibrary(SoundSystem.java:1576)
        paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2572)
        paulscode.sound.CommandThread.run(CommandThread.java:121)
    ERROR MESSAGE:
        Could not locate OpenAL library.

Starting up SoundSystemJPCT...
Switching to Java Sound
    (The Java Sound API.  For more information, see http://java.sun.com/products/java-media/sound/)
JavaSound initialized.

Do you get that same exception with the applet?  Make sure the OpenAL native library is on your system somewhere.


Quote from: Marlon on February 07, 2012, 09:05:03 PMI am initializing this way:

public void initSoundSystem() {
        try
        {
            // add some plug-ins:
            SoundSystemConfig.addLibrary( LibraryLWJGLOpenAL.class );
            SoundSystemConfig.addLibrary( LibraryJavaSound.class );
            SoundSystemConfig.setCodec( "wav", CodecWav.class );
        }
        catch( SoundSystemException e )
        {}
soundSystem=new SoundSystemJPCT();
SoundSystemConfig.setSoundFilesPackage("");
}
With SoundSystemJPCT you do not need the calls to addLibrary and setCodec (these are done automatically in the background when you instantiate the SoundSystemJPCT object -- those calls are only a requirement for the core SoundSystem library).  That being said, even though calling these again is redundant, it shouldn't have any negative effects.

Since your problem is happening in JavaSound, I re-uploaded that test applet using JavaSound instead of OpenAL, just to make sure the problem isn't there.  The above link is the same.

Marlon

Oh I only downloaded the OpenAl jar, that you provided.
What OpenAl file(s) should I take? I want other users (which run my code) automatically download this file.

I just tested the new applet you uploaded.
Mhhh.. the sound is panned in the middle, no 3D effect.
www.forgottenelements.com
Free Action JAVA MMORPG

paulscode

Oh, ok.  It is a problem with JavaSound then.  Oracle has royally screwed up JavaSound in recent versions by their decision to remove the "Java Sound Audio Engine" software mixer (requiring developers to choose one of the hardware mixers, which are all different with different capabilities for different sound cards).  I'm in the process of writing my own software mixer, but it will probably be some time before it is complete (I don't have much free time for programming any more, and what little I do have I am busy working on my N64 emulator project).  In the mean time, I would suggest using OpenAL, as it is more reliable (used to be JavaSound was more reliable, but not any more).

For the native OpenAL library, it ships with LWJGL (which I assume your application is using since you are writing it for jPCT, unless you are going with the software renderer)  It is included with all the other native libraries.

Marlon

Thanks for your tipps and your help!

I am planning to release a first 3D Test Version for my game Forgotten Elements very soon (probably this week).
Yes, you're right, I am using JPCT and the hardware renderer.
So you suggest to use SoundSystemJPCT and provide the OpenAl version for the players, who download the game?
www.forgottenelements.com
Free Action JAVA MMORPG

Marlon

#439
With the integrated OpenAl32.dll it works!
Unfortunately sometimes the Nullpointer Exception I mentioned before still occurs.
But I catch it and its ok.
Thanks again!
Marlon

Edit:
Everytime I exit my program (running at eclipse) the program crashes and I get the following error code:

Problemsignatur:
  Problemereignisname: BEX
  Anwendungsname: javaw.exe
  Anwendungsversion: 7.0.10.8
  Anwendungszeitstempel: 4e897db7
  Fehlermodulname: OpenAL32.dll_unloaded
  Fehlermodulversion: 0.0.0.0
  Fehlermodulzeitstempel: 4e894548
  Ausnahmeoffset: 0945d03f


Any ideas?
www.forgottenelements.com
Free Action JAVA MMORPG

paulscode

I haven't seen that error before.  Do you know if cleanup is able to successfully finish before that error appears? (it should print a short blurb into the console stating I am the author once cleanup is complete)

Marlon

Quote from: paulscode on February 09, 2012, 05:08:52 AM
I haven't seen that error before.  Do you know if cleanup is able to successfully finish before that error appears? (it should print a short blurb into the console stating I am the author once cleanup is complete)

Yes, your name is written and it should clean up successfully.
By the way... is it possible to deactivate any console output?
www.forgottenelements.com
Free Action JAVA MMORPG

paulscode

Quote from: Marlon on February 09, 2012, 01:23:24 PMYes, your name is written and it should clean up successfully.
By the way... is it possible to deactivate any console output?
You can deactivate the console output by creating a minimal extension of the Logger class with all the printing methods overridden (take a look at the sourcecode to see which methods).  If cleanup is completed successfully, I'm not sure what would be causing that crash.  You aren't trying to play any other sounds (like in the menus or on exit)?

Marlon

Quote from: paulscode on February 10, 2012, 11:33:55 AM
Quote from: Marlon on February 09, 2012, 01:23:24 PMYes, your name is written and it should clean up successfully.
By the way... is it possible to deactivate any console output?
You can deactivate the console output by creating a minimal extension of the Logger class with all the printing methods overridden (take a look at the sourcecode to see which methods).  If cleanup is completed successfully, I'm not sure what would be causing that crash.  You aren't trying to play any other sounds (like in the menus or on exit)?

I play sounds from the menu, but then I call quickPlay() without an Object3D.
I play an mp3 as stream as well, but I don't think that this causes the problem.
Is it possible to play mp3s as background music via your SoundSystem as well?
www.forgottenelements.com
Free Action JAVA MMORPG

paulscode

Quote from: Marlon on February 10, 2012, 01:35:49 PMI play sounds from the menu, but then I call quickPlay() without an Object3D.
You should be fine as long as sounds aren't queued to play after the call to cleanup.  I'm not sure what would be causing that crash.  I can't seem to replicate it on my computer.

Quote from: Marlon on February 10, 2012, 01:35:49 PMIs it possible to play mp3s as background music via your SoundSystem as well?
There is no mp3 codec plugin at the moment (must use the .ogg format instead)

Marlon

On my other computer SoundSystemJPCT seems to run fine (which is having other problems though).
There seem to be big differences between a Win 7 System and a Win XP System. :/
www.forgottenelements.com
Free Action JAVA MMORPG

Marlon

Hello, its me again.
I decided to use SoundSystemJPCT in the testing phase of my project.
However, there are some problems left:
1. As I mentioned before, on my Windows 7 Notebook the whole program crashes, when using the SoundSystem.
It crashes when I call SoundSystem.cleanUp(), when trying to close the program.
While running the program, there is no problem.
There is no error log, only a "JAVA(TM) Platform SE binary" window, after returning to windows.
It says:

Problemereignisname: BEX
  Anwendungsname: javaw.exe
  Anwendungsversion: 7.0.10.8
  Anwendungszeitstempel: 4e897db7
  Fehlermodulname: OpenAL32.dll_unloaded
  Fehlermodulversion: 0.0.0.0
  Fehlermodulzeitstempel: 4e894548
  Ausnahmeoffset: 0695d03f
  Ausnahmecode: c0000005
  Ausnahmedaten: 00000008
  Betriebsystemversion: 6.1.7600.2.0.0.768.3
  Gebietsschema-ID: 1031
  Zusatzinformation 1: 0a9e
  Zusatzinformation 2: 0a9e372d3b4ad19135b953a78882e789
  Zusatzinformation 3: 0a9e
  Zusatzinformation 4: 0a9e372d3b4ad19135b953a78882e789

On my other pc it runs without problems.

2. I want to play an ogg file as backgroundmusic. How can I load the ogg file (absolute path) from the disk and play it?
3. Is there a way to set a mastervolume for all sounds (played with quickplay()) and a mastervolume for the background music in a separate way?

Thanks for your help!
Marlon
www.forgottenelements.com
Free Action JAVA MMORPG

Marlon

#447
Forgotten Elements 3D Test Version was just released!
Feel free to check it out.
Tell me if the sound is running on your computer and the program exits without any problems.

http://www.forgottenelements.com
www.forgottenelements.com
Free Action JAVA MMORPG