578

Adding sound
ConeSound example code

  • Create a sound
    ConeSound mySound = new ConeSound( );
    mySound.setSoundData( myWave );
    mySound.setEnable( true );
    mySound.setInitialGain( 1.0f );
    mySound.setLoop( -1 );  // Loop forever
    mySound.setPosition( new Point3f( 0.0f, 1.0f, 0.0f ) );
    mySound.setDirection( new Vector3f( 0.0f, 0.0f, 1.0f ) );
    mySound.setDistanceGain( myFrontAtten, myBackAtten );
    mySound.setAngularAttenuation( myAngular );

  • Set the scheduling bounds
    BoundingSphere myBounds = new BoundingSphere(
        new Point3d( ), 1000.0 );
    mySound.setSchedulingBounds( myBounds );