java3D sound

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

java3D sound

Poehli
 Hi,

now I'm trying to bring sound to the game, but I face a problem with the PointSound Class.
When I create an object, where I load the soundfile, set the scheduling bounds and set the distance gain using an array of point2f's (values: 10, 0.5f; 5, 1.0f), I still cannot notice a difference between beeing 10 units from the object and 5 units from the object. Did I missunderstood something or is it a bug, that should be reported?
Here is the code, where I set the values:
               
                sound.setSoundData(soundContainer);
		sound.setInitialGain(1f);
		sound.setPosition(new Point3f(objPosition));
		sound.setCapability(PointSound.ALLOW_ENABLE_READ);
		sound.setCapability(PointSound.ALLOW_ENABLE_WRITE);
		sound.setCapability(PointSound.ALLOW_POSITION_WRITE);
		sound.setCapability(PointSound.ALLOW_POSITION_READ);
		sound.setSchedulingBounds(tg.getBounds());
		sound.setEnable(false);
		sound.setLoop(BackgroundSound.INFINITE_LOOPS);
		Point2f[] attenuation = { new Point2f(10, 0.5f),
				new Point2f(5f, 1.0f) };
		sound.setDistanceGain(attenuation);
where sound is a PointSound and soundContainer is a MediaContainer.
Again the sound is triggering in the bounds, but does not increase as I go nearer.

Hope you can help.
Reply | Threaded
Open this post in threaded view
|

Re: java3D sound

gouessej
Administrator
Maybe look at the attenuation model.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: java3D sound

Poehli
Didn't notice, that anybody wrote back...

gouessej wrote
Maybe look at the attenuation model.
What is it and where can I find information about it?
Googled a while now and only found, how attenuation should work with one array of Point2f or two arrays of floats. Both ways don't seem to work.

Reply | Threaded
Open this post in threaded view
|

Re: java3D sound

Poehli
Actually it's not a specific porblem with attenuation, but more a general problem with setting volume. I don't know, how I missed it, but setting the initialgail doesn't effect the volume at all either.
Hope anyone can explain, why and how to fix it.