Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 593 Members - Latest Member: zhang

19. June 2013, 12:01:38 am
Xith3D CommunityGeneral CategoryBugs (Moderator: Marvin Fröhlich)3D sound update (solved)
Pages: [1]
Print
Author Topic: 3D sound update (solved)  (Read 3303 times)
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« on: 08. February 2009, 10:22:51 pm »

Hi, I guess I need a little help in using a PointSound in my scene. I placed my PointSound using a TransformGroup in my scene (loaded from a BSP file), and used a blue cube to have a visual representation. It works, the cube is at the right place and the sound is "coming" from the cube, but the problem is that the sound 3D is only updated if the cube is in the view, otherwise the volume and the position it seems to come from is not updated until the player is facing the cube again (at this moment it updates in one shot).

This is hard to explain, let me give an example : you approach the source by facing it, the volume is getting louder as you get closer. Then if you turn back (not seeing the source any more) and get away, the volume does not update. If you are far enough and then turn back, the volume gets down to the value it should have at this distance in one shot.

Maybe am I missing a parameter on the PointSound or loading it wrong, I am doing it this way :
Code:
        env.setSoundDriver(new org.xith3d.sound.drivers.joal.SoundDriverImpl());
        env.getSoundDriver().setListenerVolume(1f);
       
        SoundContainer sc = SoundLoader.getInstance().loadSound(ResourceLocator.getInstance().getResource("intro.ogg"));
        PointSound sound = new PointSound(sc, 1.0f);
        sound.setRolloffFactor(8f);
        sound.setEnabled(true);

        Cube cube = new Cube(1f, new Colorf(0f, 0f, 0.5f));
        Transform3D t3d = new Transform3D(968f, 344f, -328f);
        t3d.scaleTranslation(0.03f);
        TransformGroup tg = new TransformGroup(t3d);
        tg.addChild(cube);
        tg.addChild(sound);

        BranchGroup bg = new BranchGroup();
        bg.addChild(scene);
        bg.addChild(tg);

RenderPass rp = env.addPerspectiveBranch(bg);
        rp.getConfig().setFrontClipDistance(0.05f);
        rp.getConfig().setBackClipDistance(500f);

Thanks for your help.
« Last Edit: 08. February 2009, 10:47:56 pm by Agrv » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 09. February 2009, 03:54:40 am »

This looks like a bug. I will investigate it in the next days.

Marvin
Logged
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« Reply #2 on: 11. February 2009, 10:15:59 pm »

So far, I have found that sounds are added and removed from the SoundProcessor list by the FrustumCuller, when nodes are going in or out of the frustum. If I deactivate frumstum culling with
Code:
rp.setFrustumCullingEnabled(false);
there's no sound update problem any more, but I guess that slows down the rendering and increases the amount of memory used (I had to use the -Xmx parameter to increase the maximum heap size after disabling frustum culling in order to run the same app with the same sound data and models).

I think that sound nodes should not be impacted by the FrustumCuller because the sound the player hears does not depend of what he sees.
« Last Edit: 11. February 2009, 10:17:37 pm by Agrv » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #3 on: 12. February 2009, 01:31:01 am »

Yes, I know all that already. But I need time to write a fix.

Marvin
Logged
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« Reply #4 on: 12. February 2009, 06:29:23 am »

No problem, I was just playing around with the debugger to try to understand what is happening. I was not trying to hurry you, and for now the frustum culling deactivation workaround allows me to go on on my project. Thanks for your time and your great work on xith3d.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #5 on: 23. February 2009, 03:38:41 am »

I have fixed the sound system to play and update sounds independently of the FrustumCuller.

I have also fixed the JOAL sound driver to properly send the listener orientation to JOAL. Now it should work perfectly.

Marvin
Logged
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« Reply #6 on: 23. February 2009, 06:40:44 am »

Indeed, it works like a charm !
Thank you so much for fixing this.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic