I’m starting to work on sound implementation, and I have to say that the information on AudioManagers in the manual left me with a lot of questions.

If an AudioManager can only hold 16 sounds by default, and I want more sounds than that, I need more AudioManagers. How do I make more?

Alternatively I could alter the config.prc to allow more sounds per manager. Is there an advantage/disadvantage to doing this over creating more AudioManagers?

Also, what kind of clean up is necessary for audio? I notice that the AudioManager class has a shutdown method that isn’t documented at all.

No, I think you have misunderstood. You can create as many AudioSounds as you like with a single AudioManager. You just can’t have more than 16 of them playing simultaneously. (Well, you can, but you will only hear the first 16 of them.)

If you want to increase that limit, there’s a config variable you can change. I forget what it is offhand, but it shouldn’t be hard to find.

Cleanup is implicit. You can simply let go of your AudioSounds when you’re done with them.


So there’s no reason to make more AudioManagers, then? Even if you use:


If you are talking about “audio-cache-limit” config.prc setting, I was under the impression that this was only a limit on how many sounds would be kept in memory.
The real limit of how many simultaneous sounds can play should be a result of hardware.
If you really do want to add more AudioManagers it is done like this:

from pandac.PandaModules import AudioManager
audiomanager = AudioManager.createAudioManager()

If you are using 3D audio, be aware that (at least with FMOD) only one listener is supported by the API, so whichever listener you set last will be the one that is used for all 3D sounds.

Okay. I’m not using FMOD, I don’t have 3-6 thousand dollars to spend on a license for a commercial game.

Is the cleanup of audio managers implicit as well?

I’m not sure. But the design of the engine is that you should create all the AudioManagers you need at the beginning, and not destroy them for the lifetime of your application.

Normally, there’s no reason to create more than one AudioManager, except to make a logical distinction between different sounds. For instance, we create two of them by default, one for music and one for sound effects, so you have have a global volume control for each.


I was just asking because I’m going to use an Audio3DManager and a regular AudioManager to keep 3D sounds and none 3D-sounds, like the fanfare at the end of a level, separate.

You’re right though, I suppose there is no need to clean them up. I do have a question about

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

though. Does this call convert the AudioManager in base.sfxManagerList[0] into an Audio3DManager? Would using base.sfxManagerList[0] return the Audio3DManager later? Or does the Audio3DManager just use the regular AudioManager, without changing it?

I’d like to be able to access my Audio3DManager through base, so I don’t have to pass something into classes that will utilize it. If base.sfxManagerList[0] wouldn’t give me the Audio3DManager, could I add the Audio3DManager to base.sfxManagerList with base.addSfxManager?

Audio3DManager is just a Python class that sits on top of an AudioManager. It is the sounds themselves which are flagged as 3D or not depending how you load them.

So, if I used the code above to create an Audio3DManager, I would need to use a reference to it to load the sounds for them to be 3D. Therefore I have to pass the reference to it into the classes that will load the sounds?

That’s the way I’ve been doing it. I pass my “Game” class as the first argument of any class that needs access to higher-level stuff.