from panda3d.core import AudioManager
class AudioManager


Bases: TypedReferenceCount

Inheritance diagram

Inheritance diagram of AudioManager

enum SpeakerId
enumerator SPK_none = 0
enumerator SPK_frontleft = 1
enumerator SPK_frontright = 2
enumerator SPK_center = 3
enumerator SPK_sub = 4
enumerator SPK_backleft = 5
enumerator SPK_backright = 6
enumerator SPK_sideleft = 7
enumerator SPK_sideright = 8
enumerator SPK_COUNT = 9
enum SpeakerModeCategory
enumerator SPEAKERMODE_raw = 0

These enumerants line up one-to-one with the FMOD SPEAKERMODE enumerants.

enumerator SPEAKERMODE_mono = 1
enumerator SPEAKERMODE_stereo = 2
enumerator SPEAKERMODE_quad = 3
enumerator SPEAKERMODE_surround = 4
enumerator SPEAKERMODE_5point1 = 5
enumerator SPEAKERMODE_7point1 = 6
enumerator SPEAKERMODE_max = 7
enumerator SPEAKERMODE_COUNT = 8
enum StreamMode
enumerator SM_heuristic = 0
enumerator SM_sample = 1
enumerator SM_stream = 2
audio3dGetDistanceFactor() float
audio3dGetDopplerFactor() float
audio3dGetDropOffFactor() float
audio3dSetDistanceFactor(factor: float)

Control the “relative scale that sets the distance factor” units for 3D spacialized audio. This is a float in units-per-meter. Default value is 1.0, which means that Panda units are understood as meters; for e.g. feet, set 3.28. This factor is applied only to Fmod and OpenAL at the moment.

audio3dSetDopplerFactor(factor: float)

Control the presence of the Doppler effect. Default is 1.0 Exaggerated Doppler, use >1.0 Diminshed Doppler, use <1.0

audio3dSetDropOffFactor(factor: float)

Exaggerate or diminish the effect of distance on sound. Default is 1.0 Valid range is 0 to 10 Faster drop off, use >1.0 Slower drop off, use <1.0

audio3dSetListenerAttributes(px: float, py: float, pz: float, vx: float, vy: float, vz: float, fx: float, fy: float, fz: float, ux: float, uy: float, uz: float)

This controls the “set of ears” that listens to 3D spacialized sound px, py, pz are position coordinates. vx, vy, vz are a velocity vector in UNITS PER SECOND (default: meters). fx, fy and fz are the respective components of a unit forward-vector ux, uy and uz are the respective components of a unit up-vector

configureFilters(config: FilterProperties) bool
static createAudioManager() AudioManager
property dls_pathname Filename
getActive() bool
getCacheLimit() int
static getClassType() TypeHandle
getConcurrentSoundLimit() int
static getDlsPathname() Filename
getNullSound() AudioSound
getSound(file_name: Filename, positional: bool, mode: int) AudioSound

Get a sound:

getSound(source: MovieAudio, positional: bool, mode: int) AudioSound
getSpeakerSetup() int
getVolume() float
isValid() bool

If you’re interested in knowing whether this audio manager is valid, here’s the call to do it. It is not necessary to check whether the audio manager is valid before making other calls. You are free to use an invalid sound manager, you may get silent sounds from it though. The sound manager and the sounds it creates should not crash the application even when the objects are not valid.

output(out: ostream)
reduceSoundsPlayingTo(count: int)

This is likely to be a utility function for the concurrent_sound_limit options. It is exposed as an API, because it’s reasonable that it may be useful to be here. It reduces the number of concurrently playing sounds to count by some implementation specific means. If the number of sounds currently playing is at or below count then there is no effect.

setActive(flag: bool)

Turn the manager on or off. If you play a sound while the manager is inactive, it won’t start. If you deactivate the manager while sounds are playing, they’ll stop. If you activate the manager while looping sounds are playing (those that have a loop_count of zero), they will start playing from the beginning of their loop. Defaults to true.

setCacheLimit(count: int)
setConcurrentSoundLimit(limit: int)

This controls the number of sounds that you allow at once. This is more of a user choice – it avoids talk over and the creation of a cacophony. It can also be used to help performance. 0 == unlimited. 1 == mutually exclusive (one sound at a time). Which is an example of: n == allow n sounds to be playing at the same time.

setSpeakerConfiguration(speaker1: LVecBase3, speaker2: LVecBase3, speaker3: LVecBase3, speaker4: LVecBase3, speaker5: LVecBase3, speaker6: LVecBase3, speaker7: LVecBase3, speaker8: LVecBase3, speaker9: LVecBase3)

setSpeakerConfiguration() is a Miles only method.

setSpeakerSetup(cat: SpeakerModeCategory)
setVolume(volume: float)

Control volume: FYI: If you start a sound with the volume off and turn the volume up later, you’ll hear the sound playing at that late point. 0 = minimum; 1.0 = maximum. inits to 1.0.


Stop playback on all sounds managed by this manager. This is effectively the same as reduce_sounds_playing_to(0), but this call may be for efficient on some implementations.

uncacheSound(file_name: Filename)

Tell the AudioManager there is no need to keep this one cached. This doesn’t break any connection between AudioSounds that have already given by getSound() from this manager. It’s only affecting whether the AudioManager keeps a copy of the sound in its poolcache.


This should be called every frame. Failure to call could cause problems.

write(out: ostream)