Author Topic: 3D Sound System  (Read 296511 times)

Offline influt

  • byte
  • *
  • Posts: 25
    • View Profile
Re: 3D Sound System
« Reply #330 on: November 05, 2009, 03:53:26 pm »
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:
Code: [Select]
soundSystem.quickPlay( "menu.wav", false);unfortunately it fails showing me the following message:
Code: [Select]
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)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #331 on: November 05, 2009, 09:35:19 pm »
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #332 on: November 05, 2009, 11:53:37 pm »
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.


Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #333 on: February 26, 2010, 12:32:56 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: 3D Sound System
« Reply #334 on: April 05, 2010, 09:37:29 pm »
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #335 on: April 06, 2010, 02:30:52 am »
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #336 on: April 12, 2010, 03:51:12 am »
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).

Offline MarcusKyo

  • byte
  • *
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #337 on: May 25, 2010, 03:20:02 pm »
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #338 on: May 25, 2010, 05:53:00 pm »
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.
« Last Edit: May 26, 2010, 12:47:45 pm by paulscode »

Offline MarcusKyo

  • byte
  • *
  • Posts: 2
    • View Profile
Re: 3D Sound System
« Reply #339 on: May 26, 2010, 11:31:12 am »
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. :)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #340 on: August 10, 2010, 02:28:41 am »
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..).

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: 3D Sound System
« Reply #341 on: August 15, 2010, 05:55:47 pm »
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.
« Last Edit: August 15, 2010, 08:05:10 pm by zammbi »

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #342 on: August 15, 2010, 07:57:47 pm »
What'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:

Code: [Select]
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;
}

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: 3D Sound System
« Reply #343 on: August 15, 2010, 08:20:20 pm »
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?
« Last Edit: August 15, 2010, 08:25:58 pm by zammbi »

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #344 on: August 15, 2010, 09:41:58 pm »
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?

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..
« Last Edit: August 16, 2010, 01:51:26 am by paulscode »