PointSound java 3d
Posted by Davidave on Nov 25, 2014; 12:32am
URL: https://forum.jogamp.org/PointSound-java-3d-tp4033626.html
Hey guys !
I hope someone can help me to modify my PointSound in java3d. i have created a small scene in Java3D with one house. when i start my program im looking at the front of my house ! when i press a key the camera is moving towards the house.
what i want is: the nearer i get the quieter should the music get. when im in front of the house the music should be turned off.
my house has the coordinates (0.0f , 0.0f , 6.0f)
when i run my programm the camera coordinates are (0f,0f,-4.5f)
this is my code for the pointSound
MediaContainer myWave = null;
try {
myWave = new MediaContainer(new URL("file:C:/Users/David/Desktop/Castle/pte.wav"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Point2f[] myAtten = {
new Point2f( 0.0f, 0.0f ),
new Point2f( 0.0f, 0.0f ),
new Point2f( 0.0f, 0.0f )
};
PointSound mySound = new PointSound( );
mySound.setSoundData( myWave );
mySound.setEnable( true );
mySound.setCapability(PointSound.ALLOW_ENABLE_READ);
mySound.setCapability(PointSound.ALLOW_ENABLE_WRITE);
mySound.setInitialGain( 1.0f );
mySound.setLoop(-1); // Loop forever
mySound.setPosition( new Point3f( -1.27f, -0.55f, -4f ) );
mySound.setDistanceGain( myAtten );
BoundingSphere myBounds = new BoundingSphere(
new Point3d(), 1.0 );
mySound.setSchedulingBounds( myBounds );
return mySound;
(i dont know what to do with the point2f[] )
sry for my bad english i h0pe you anderstand what i need =)
thanks in advance
david