This is from the manual:
mySound.setLoopCount(n) where 'n' can be any number. 0 will cause it to loop forever and any other number will loop it that many times.
I think you have to write
self.mySound.setLoopCount(0) self.mySound.play( )
Hope its correct
Try wrapping a SoundInterval around self.mySound. Then, you can call any interval methods, including loop(), on the SoundInterval.
self.audio3d.attachSoundToObject( self.mySound, self.spaceShipModel ) self.mySoundInt = SoundInterval(self.mySound) self.mySoundInt.loop( )
Note that the actual sound, not the interval, is still attached to the object.
this works in 1.0.5, I assume in 1.1 also…
import direct.directbase.DirectStart from direct.interval.SoundInterval import SoundInterval from direct.showbase.Audio3DManager import Audio3DManager from direct.task import Task audio3d = Audio3DManager(base.sfxManagerList, camera) mySound = base.sfxManagerList.getSound('generic.wav', 1) mySoundNodePath = render.attachNewNode('mySoundNode') mySoundNodePath.setPos(0.000, 20.000, 0.000) mySoundInterval = SoundInterval(mySound) #see where the sound is supposed to be located smiley = loader.loadModel('smiley') smiley.reparentTo(mySoundNodePath) audio3d.attachSoundToObject( mySound, mySoundNodePath ) mySoundInterval.loop() def updateSound(task): audio3d.update() return Task.cont taskMgr.add(updateSound, 'updateSound') run()
However, I did notice a bug in the 3d audio. I set the position of mySoundNodePath in different locations, and then moved the camera around to listen for it. The actual sound seems to be located somewhere in between (I am guessing halfway) the position its supposed to be, and the origin. This might be part of the problem if your space ship is positioned away from the origin (or moves away from it). The 3d sound would then be located some distance away from the space ship causing you not to hear it.
Should the be any sound in space at all?
Sorry, couldn’t resist…
You can have sound in a space game, you just need a good reason for it. That seems to be the case.