3D Sound System

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

Previous topic - Next topic

influt

Hello. It's my first try to tickle SoundSystemJPCT so I might miss something.
I tried playing sounds with the quickPlay() method. The code is exactly the same as in the Helicopter.java with the only difference - I do'not assign the sound to an Object3D:
soundSystem.quickPlay( "menu.wav", false);
unfortunately it fails showing me the following message:
Exception in thread "Thread-290" java.lang.ClassCastException: java.lang.String cannot be cast to paulscode.sound.FilenameURL
at paulscode.sound.SoundSystem.ManageSources(SoundSystem.java:2153)
at paulscode.sound.CommandThread.run(CommandThread.java:118)

paulscode

Oops, sorry about that - I think I know what caused that part to break - I never updated the SoundSystemJPCT extension after making the String/URL changes to SoundSystem.  Let me take a look at the code, and I'll upload an update this evening.

paulscode

Ok, I fixed the problem.  There are also a few minor fixes to the SoundSystem core itself since the last version I posted.

I haven't updated the JavaDoc yet - there seems to be a bug in NetBeans that is preventing me from producing any JavaDocs, and I haven't had time to search for a fix.

Updated packages:
Sound System jPCT
Sound System


- Corrected a problem in the SoundSystemJPCT extension where source creation methods requiring a String filename parameter stopped working after a previous core library update.
- Added additional methods that take URL file references.
- Simplified thread synchronization in the core library, making it easy for users to manually manipulate sources by synchronizing on SoundSystemConfig.THREAD_SYNC object.


paulscode

I've discovered that the latest release of LWJGL breaks the SoundSystem library, because they no longer support indirect buffers.  I've already figured out a solution and I am in the process of implementing it.  I've been really busy lately so it might be a couple of weeks before I'm ready to post an update.

EgonOlsen

Damn...i just tried to update Robombs with the latest LWJGL and ran into this problem. I haven't updated the SoundSystem for ages, because it just worked for me in the way it was. I guess i have to do it now once you finish the fix.

paulscode

I am hoping to solve a few unrelated problems when running with the 64-bit sun Java plug-in for Firefox in Linux, before I post the next big release.  However, if I can't get these fixed in the next few days, I'll go ahead and post what I have now and post another update later.

paulscode

The switching problem is in fact not limited to 64-bit sun Java like I thought.  It also happens in 32-bit applets and applications.  The problem occurs depending on the order you load/switch between library plug-ins - I just hadn't set up my test cases correctly to notice this, so I came to the wrong conclusion about the cause.  This is a serious problem which must be solved before I can upload the library for use (it would almost certainly break legacy code).  I am 99% certain the problem was caused by a recent bug-fix to solve the library-switch source-copy issue when samples are loaded via URL.  This is a relatively small section of code, so hopefully it won't be too difficult to track down now that I know were to focus my attention (I got off-track assuming it was a 64-bit/32-bit issue).

MarcusKyo

Hi Paul. I've been using the library and I'm loving it! Just one question though...

I like the "turnListener" method, but I was wondering if you were going to put in anything that would actually turn the direction the listener would be moving towards. "turnListener" just turns the "head" of the listener which doesn't really help when I want to turn and walk into a different direction. Sure, I guess I could write my own method, but I'm pretty lazy. :)

What do you think? I think it'd be a nice option to have seeing as how right now you can only have the listener strafe left and right on the x axis.

paulscode

#338
There is the method "setListenerOrientation" (been around since the very first release, actually).  With this method you specify the "look" and "up" directions for the listener.  If you are writing a first-person shooter where "up" doesn't change, then you could use your direction parallel to the ground for "look", and for "up" you'd just use floats 0,1,0 (core SoundSystem) or SimpleVector 0,-1,0 (SoundSystemJPCT).  If your game is not as simple as a first-person shooter like Wolfenstein and you need "up" to change, then you'll need to use "setListenerOrientation" to specify both the "look" and "up" directions, since there are an infinite number of possible orientations if you only know one axis.  Of course they don't necessarily have to be "look" and "up" - if you know any two directions then you can use a little vector math to calculate "look" and "up" and plug that information into the "setListenerOrientation" method.  You could also get this information from the Camera (SoundSystemJPCT has a version of "setListenerOrientation" that takes a Camera argument, and also has automatic Camera/listener syncing if that is something you need).

If the "setListenerOrientation" method is not what you are after, let me know what kind of method you'd like to see, and I'll see if it is something worth adding.

BTW, to anyone waiting for the next release of SoundSystem, it may be a couple months - I've had no time for programming between school, work, and the baby.  When I finish the class I'm in, maybe things will slow down a bit and I'll have more time for fun.

MarcusKyo

Oh, sorry! I knew about the "setListenerOrientation", but I had thought for some reason that it only let you orient the listener up and down. My mistake.

I should have used that. Right now I have it so that after I turn the listener, I calculate the new position to that angle.

Sorry for the trouble. I'll get back to enjoying the library now. :)

paulscode

Ok, I'm finally back to working on the SoundSystem again.  I sat down today to go back trough the code and familiarize myself with it.  One user reported a thread synchronization problem, which I am trying to track down.  I expect to post the next release later this week (although I'm sure I've said that before..).

zammbi

#341
This library is so handy. Its the only sound one that I've tested that just works.

What's the best way to create a music list? I couldn't see a "soundSystem.backgroundMusic(String[] filename)" method.

paulscode

Quote from: zammbi on August 15, 2010, 05:55:47 PMWhat's the best way to create a music list? I couldn't see a "soundSystem.backgroundMusic(String[] filename)" method.

You could use something like this:

public String backgroundMusic( String[] filename )
{
    if( filename == null || filename.length < 1 )
        return null;

    String sourcename = "Background_"
        + mySoundSystem.randomNumberGenerator.nextInt()
        + "_" + mySoundSystem.randomNumberGenerator.nextInt();

    mySoundSystem.backgroundMusic( sourcename, filename[0], false );

    for( x = 1; x < filename.length; x++ )
        mySoundSystem.queueSound( sourcename, filename[x] );

    return sourcename;
}


zammbi

#343
Works great thanks.

Edit: What if I want to keep this list repeating? Is there some kind of background music finished event that I can put a listener too or something like that?

paulscode

#344
Quote from: zammbi on August 15, 2010, 08:20:20 PMWhat if I want to keep this list repeating? Is there some kind of background music finished event that I can put a listener too or something like that?

I've added stream listening to the upcoming version update.

--EDIT--
The final code clean-up is taking a bit longer than I anticipated.  I'll have this thing finished soon..