Regarding 3d sound

Hi everyone.

I’m trying to use 3d sound in my game and have custom drop off values for each sound. But the problem is that I don’t know how to do that. :smiley: I’ve made a function which loads a sound, sets drop off value (well, tries to) and then plays it. But it appears that all sounds uses same drop off value, which is kinda strange. How could I set custom drop off values for each sound I play, so I could hear some sounds from bigger distance than others, etc. It may be very easy, but I’m still trying to get used to Panda3d.

Thanks in advance.

Can anyone help me out?

There is 3 sound backends for panda3d. Not all of the features are implemented for all backends. What are you using? Code?

Using Panda3d default sound engine. Here’s the code :

from direct.showbase import Audio3DManager

Audio3d = Audio3DManager.Audio3DManager( base.sfxManagerList[0], camera )

def PlaySound( File, DropOff ) :

    Sound = Audio3d.loadSfx( File )

    Audio3d.setSoundVelocityAuto( Sound )
    Audio3d.setListenerVelocityAuto()
    Audio3d.setDropOffFactor( DropOff ) # Here is the function which should set drop off factor for this specific sound

    Sound.setLoop(True)
    Sound.play()

Here’s how I call it :

PlaySound( 'sounds/sound.wav', 5 )

This sets drop off factor for all sounds, not the sound I’m playing :

Audio3d.setDropOffFactor( DropOff )

I think you need to use:

To set proper drop offs per sound.

from direct.showbase import Audio3DManager

Audio3d = Audio3DManager.Audio3DManager( base.sfxManagerList[0], camera )

def PlaySound( File, Min ) :

    Sound = Audio3d.loadSfx( File )

    Audio3d.setSoundVelocityAuto( Sound )
    Audio3d.setListenerVelocityAuto()
    Audio3d.setDistanceFactor( 1 )

    Audio3d.setSoundMinDistance( Sound, Min )

    Sound.setLoop( True )
    Sound.play()

Added function setSoundMinDistance, but in the manual it says that I shouldn’t change setSoundMaxDistance default value. Thanks, it works now, but the sound never stops playing, it only gets quiet and I can still hear it, no matter how far I am. Maybe I wouldn’t hear it if I was using speakers, not headphones. Any ideas?