From : panda3d.org/manual/index.php/3DAudio
Yet when I try to access the 2nd element with this code:
self.mSoundFxMgr = base.sfxManagerList[0]
self.mMusicMgr = base.sfxManagerList[1]
I get the error :
What gives here?
From : panda3d.org/manual/index.php/3DAudio
Yet when I try to access the 2nd element with this code:
self.mSoundFxMgr = base.sfxManagerList[0]
self.mMusicMgr = base.sfxManagerList[1]
I get the error :
What gives here?
That is from a fairly complicated application that draws from several of my own libraries so … it would be a pain to post all of the code. I have reproduced the error using a very simple application and that code follows. This code should run stand-alone, just change the audio filename to a clip that you have.
# Standard imports
import sys
# Panda imports
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
import direct.directbase.DirectStart
from direct.showbase import Audio3DManager
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class World(DirectObject):
def __init__(self):
soundEffectsMgr = base.sfxManagerList[0]
musicMgr = base.sfxManagerList[1]
audio3d = \
Audio3DManager.Audio3DManager(
soundEffectsMgr,
camera
)
aFile = "music.wav"
mySound = audio3d.loadSfx(aFile)
mySound.play()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
world = World()
run()
This might be a documentation bug–I’m not sure what the intention here is. But we have always stored the Music manager in base.musicManager. The default Sound Effect manager is base.sfxManagerList[0].
By default, there do not appear to be additional entries created in base.sfxManagerList; but if there were, by its name, I would guess them to be intended as additional sound effect managers, not as a music manager.
Of course, all audio managers are equivalent and can play any sounds. The only reason to have more than one is so you can independently turn on and off different categories of sounds.
David
Thanks again David