void createPointsound(XBranchGroup MyBranch)
{
Shape3D DirObject=new PointObj();
DirObject.getAppearance().setMaterial(new Material(new Color3f(0f,0f,1.0f),new Color3f(0f,0f,1.0f),new Color3f(0f,0f,1.0f),new Color3f(0f,0f,1.0f),1f));
if (PSnd!=null) PSnd.setEnable(false);
MyBranch.addChild(newSymbolSwitch(DirObject));
if (!GlobalSettings.GlobData.noAudioStreamMode)
{
float[] dist,gain;
InputStream is=MainWin.Win.UniPanel.DLCacheMan.getFileStream(MainWin.Win.MainThreadMsgPipe,Cmd,DownloadCacheManager.SOUNDSTREAM|DownloadCacheManager.BLOCKING,false,true);
StreamMC=new MediaContainer(is);
PSnd=new PointSound(StreamMC,1.0f,new Point3f());
PSnd.setCapability(PointSound.ALLOW_ENABLE_WRITE);
if ((Flags & 0x00FF)==0x00) // linear attenuation
{
dist=new float[2]; gain=new float[2];
dist[0]=0; gain[0]=1.0f;
dist[1]=this.cobject_p2+0.1f; gain[1]=0f;
}
else if ((Flags & 0x00FF)==0x01) // (nearly) logarithmic attenuation
{
dist=new float[3]; gain=new float[3];
dist[0]=0; gain[0]=1.0f;
dist[1]=this.cobject_p2*0.75f; gain[1]=0.5f;
dist[2]=this.cobject_p2+0.1f; gain[2]=0f;
}
else // sharp attenuation
{
dist=new float[3]; gain=new float[3];
dist[0]=0; gain[0]=1.0f;
dist[1]=this.cobject_p2*0.8f; gain[1]=0.8f;
dist[2]=this.cobject_p2+0.1f; gain[2]=0f;
}
PSnd.setDistanceGain(dist,gain);
PSnd.setInitialGain((float)(cobject_p4/100.0));
PSnd.setSchedulingBounds(new BoundingSphere(new Point3d(),this.cobject_p2+0.1f));
PSnd.setLoop((int)cobject_p1-1);
PSnd.setEnable(true);
MyBranch.addChild(PSnd); // insert the sound object
}
}