3D Sound System

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

Previous topic - Next topic

paulscode

Quote from: EgonOlsen on April 17, 2008, 06:53:34 AM
What are you doing, when the user presses escape?

In the no-sound applet, I am doing nothing (just setting "loop = false" to end the game loop.  Is there some "shut down" stuff I need to do to jPCT?  That could be the problem.

EgonOlsen

Maybe removing the canvas from the applet helps...IIRC, we had some thread about this here, but i can't remember the outcome.

paulscode

#77
Quote from: EgonOlsen on April 17, 2008, 02:53:43 PM
Maybe removing the canvas from the applet helps...IIRC, we had some thread about this here, but i can't remember the outcome.

Ok, good idea.  I added in the line this.remove( myCanvas ); in the shutdown method, and I re-uploaded the Helicopter applet.  Hopefully that will fix the problem.  The link again:
LINK NO LONGER EXISTS

Oh, BTW, I finally managed to clean the virus off my main pc.  I ended up loosing a bunch of stuff after returning to a previous restore point.  Last scans with updated AVG, spybot, and adaware all came out clean, so hopefuly it is finally gone.  It was a nasty one that locked out my administrator privilages and created a new administrator account (I assume to let someone connect to my computer remotely).  I detected the virus immediatly and quickly disconnected the network cable, so I doubt they got much.  I hate hackers - got nothing better to do with their lives than mess with other people's.  >:(

JavaMan

#78
Well, I suppose your probably sick of me giving bad news concerning this applet, but things are even stranger now.
When I press escape firefox's and IE's windows both close out. But if I simple close the tab of the applet in firefox, the other tab continues to run ok.  ::)

I was thinking maybe you should post this on the lwjgl forums to see if anyone else has this problem. Or maybe did you already do that?

QuoteMaybe removing the canvas from the applet helps...IIRC, we had some thread about this here, but i can't remember the outcome.
I think that was me, and no it never got resolved, but that was on a different pc. I just decided to tell the user to choose gl or software.

Jman

paulscode

Hey, just wanted to let anyone who is waiting for the next release of SoundManager know, I am taking a break from programming for a month and a half.

I managed to obtain a (hard to get) waiver allowing me to take my Air Force promotion test a year earlier than expected :D  I'll be testing the beginning of next month, so between now and then I will be spending all my free time studying.

After that, if all goes according to plan, I am taking two weeks of leave to visit family in Kansas and California, so I won't be doing any programming until I get back home to Maryland.

fireside

click here->Fireside 7 Games<-

JavaMan

Have a nice time in California! The land of tech. ;D

Jman

paulscode

Ok, I know I said I was going to spend all my free time studying.
But I have alway heard that it is good to take a break every now and then...

Ok, fine - I'm really just a programming junkie  ;D

Anyway, I have been looking more closely at Java Sound, and it looks like it is every bit as capable a library as OpenAL.  I am going to continue looking into the differences between them, but initially I am kind of wondering if it might be a good idea to just use Java Sound and forget about OpenAL.  I have posted the following question on other forums as well, and thought I would post it here too, in case any of you have input on the subject:

Is there any advantage to using OpenAL vs Java Sound (specifically performance or compatibility issues), and would there be a real benifit to having SoundManager capable of both?  Or would using only Java Sound make more sense, in order to reduce complexity?

I suppose I will know more when I create some test applets and compare performance.

EgonOlsen

My experience from Paradroidz was, that Javasound was:

a) more compatible when using software mixing
b) less compatible (close to 0%) when using hardware mixing
c) slightly slower

than OpenAL.

paulscode

Quote from: EgonOlsen on May 10, 2008, 10:38:07 AM
My experience from Paradroidz was, that Javasound was:

a) more compatible when using software mixing
b) less compatible (close to 0%) when using hardware mixing
c) slightly slower

than OpenAL.

Sounds like there would be a benifit to including both into my library, then.

paulscode

I have started working on a new class today, called SoundSystem.  It is basically going to be an interface class that will handle all calls to both sound libraries, and allow switching between them.  In other words, the SoundManager and SourceManager classes will be able to call methods like SoundSystem.initialize(...), SoundSystem.play(...), etc, without directly accessing methods from either library.  This will not only make things more organized, but it will also make future expansions much easier.  It should also help in simplifying thread synchronization and tracking down thread conflicts, by keeping all the synchronized sound-related methods together in a single class rather than spread out in three classes as they are now.

SoundSystem will initially support only OpenAL, until I get it incorporated into my library and debugged.  I will then expand it to support Javasound.


paulscode

#87
Progress update

After doing some work on the SoundSystem class, I am starting to see how useful this interface is actually going to be.  So I've decided to make SoundSystem a library that can be used separately from SoundManager.  I think it could be useful for people who want to use both OpenAL and Javasound in their project, but they don't want the high-level components of SoundManager, such as source management.  With SoundSystem, you wouldn't have to learn the syntax for two seperate libraries, or worry about thread issues.

Therefore, I my plan now is to implement and debug the SoundSystem library before reworking SoundManager to use it (contradicting what I said in my last post).  I'll keep everyone updated, and I'll post the JAR and source for the library when I finish it.

paulscode

#88
I am trying to write a logrithmic attenuation algorithm for Javasound, since it doesn't have one built into it by default like OpenAL does.

My understanding of how attenuation works in the real world, is that waves attenuate according to the inverse of the distance squared:

intensity = initialIntensity / (1 + distance * distance);

So with sound waves, volume should be:

volume = initialVolume / (1 + distance * distance);

And then adding in a rollOff factor:

volume = initialVolume / (1 + rollOff * distance * distance);

Now here is were I am stumped.  From what I understand, the "logrithmic" part of a logrithmic attinuation algorithm is there to compensate for the fact that the "loudness" of a sound detected by the human ear is not a linear function of that sound's decible value.  I've been searching the internet, but I can't figure out exactly what I need to add to my formula for it to match what OpenAL does.

I thought I would post this here in case anyone happens to know anything about this topic.  If not, I will just use the formula as is.  Only drawback is my algorithm doesn't match the OpenAL algorithm, so you'd have to use different rolloff factors depending on whether you were in OpenAL or Javasound mode, and the attinuation effect would not be the same for both libraries (which may complicate things for the user).

Other solution would be to not use the built-in OpenAL logrithmic attenuation model, and use my algorithm for both Javasound and OpenAL.  This would reduce the realism achieved with OpenAL, but it would ensure that both libraries have the same behavior.

EgonOlsen

Personally, i could happily live with both solutions giving a little different results. I would leave OpenAL as it is and add your own solution to JavaSound until you can come up with the correct solution. Nobody will hear the difference anyway... ;)