# AudioManager

from pandac.PandaModules import AudioManager

## Inheritance:

AudioManager: TypedReferenceCount
TypedReferenceCount: TypedObject ReferenceCount
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase

## Methods of AudioManager:

audio3dGetDistanceFactor
audio3dGetDopplerFactor
audio3dGetDropOffFactor
audio3dGetListenerAttributes
audio3dSetDistanceFactor
audio3dSetDopplerFactor
audio3dSetDropOffFactor
audio3dSetListenerAttributes
clearCache
configureFilters
createAudioManager
getActive
getCacheLimit
getClassType
getConcurrentSoundLimit
getDlsPathname
getNullSound
getSound
getSpeakerSetup
getVolume
isValid
output
reduceSoundsPlayingTo
setActive
setCacheLimit
setConcurrentSoundLimit
setSpeakerSetup
setVolume
shutdown
stopAllSounds
uncacheSound
update
write

## Methods of TypedReferenceCount:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

## Constants in AudioManager:

SPEAKERMODERaw | (SpeakerModeCategory)
SPEAKERMODEMono | (SpeakerModeCategory)
SPEAKERMODEStereo | (SpeakerModeCategory)
SPEAKERMODEQuad | (SpeakerModeCategory)
SPEAKERMODESurround | (SpeakerModeCategory)
SPEAKERMODE5point1 | (SpeakerModeCategory)
SPEAKERMODE7point1 | (SpeakerModeCategory)
SPEAKERMODEPrologic | (SpeakerModeCategory)
SPEAKERMODEMax | (SpeakerModeCategory)
SPEAKERMODECOUNT | (SpeakerModeCategory)
SPKNone | (SpeakerId)
SPKFrontleft | (SpeakerId)
SPKFrontright | (SpeakerId)
SPKCenter | (SpeakerId)
SPKSub | (SpeakerId)
SPKBackleft | (SpeakerId)
SPKBackright | (SpeakerId)
SPKSideleft | (SpeakerId)
SPKSideright | (SpeakerId)
SPKCOUNT | (SpeakerId)
SMHeuristic | (StreamMode)
SMSample | (StreamMode)
SMStream | (StreamMode)

audio3dGetDistanceFactor virtual float AudioManager::audio_3d_get_distance_factor(void) const; Control the "relative scale that sets the distance factor" units for 3D spacialized audio. Default is 1.0 Fmod uses meters internally, so give a float in Units-per meter Don't know what Miles uses. Default is 1.0 which is adjust in panda to be feet.

audio3dGetDopplerFactor virtual float AudioManager::audio_3d_get_doppler_factor(void) const; Control the presence of the Doppler effect. Default is 1.0 Exaggerated Doppler, use >1.0 Diminshed Doppler, use <1.0

audio3dGetDropOffFactor virtual float AudioManager::audio_3d_get_drop_off_factor(void) const; 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

audio3dGetListenerAttributes virtual void AudioManager::audio_3d_get_listener_attributes(float *px, float *py, float *pz, float *vx, float *vy, float *vz, float *fx, float *fy, float *fz, float *ux, float *uy, float *uz); Undocumented function.

audio3dSetDistanceFactor virtual void AudioManager::audio_3d_set_distance_factor(float factor); Control the "relative scale that sets the distance factor" units for 3D spacialized audio. Default is 1.0 Fmod uses meters internally, so give a float in Units-per meter Don't know what Miles uses. Default is 1.0 which is adjust in panda to be feet.

audio3dSetDopplerFactor virtual void AudioManager::audio_3d_set_doppler_factor(float factor); Control the presence of the Doppler effect. Default is 1.0 Exaggerated Doppler, use >1.0 Diminshed Doppler, use <1.0

audio3dSetDropOffFactor virtual void AudioManager::audio_3d_set_drop_off_factor(float factor); 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 virtual void AudioManager::audio_3d_set_listener_attributes(float px, float py, float pz, float vx, float vy, float vz, float fx, float fy, float fz, float ux, float uy, float uz); 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

clearCache virtual void AudioManager::clear_cache(void) = 0; 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 get_sound() from this manager. It's only affecting whether the AudioManager keeps a copy of the sound in its pool/cache.

configureFilters virtual bool AudioManager::configure_filters(FilterProperties *config); Undocumented function.

createAudioManager static PointerTo< AudioManager > AudioManager::create_AudioManager(void); Create an AudioManager for each category of sounds you have. E.g. MySoundEffects = create_AudioManager::AudioManager(); MyMusicManager = create_AudioManager::AudioManager(); ... my_sound = MySoundEffects.get_sound("neatSfx.mp3"); my_music = MyMusicManager.get_sound("introTheme.mid");

getActive virtual bool AudioManager::get_active(void) const = 0; 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 begining of their loop. inits to true.

getCacheLimit virtual unsigned int AudioManager::get_cache_limit(void) const = 0; Undocumented function.

getClassType static TypeHandle AudioManager::get_class_type(void); Undocumented function.

getConcurrentSoundLimit virtual unsigned int AudioManager::get_concurrent_sound_limit(void) const = 0; 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.

getDlsPathname static Filename AudioManager::get_dls_pathname(void); Undocumented function.

getNullSound PointerTo< AudioSound > AudioManager::get_null_sound(void); Undocumented function.

getSound virtual PointerTo< AudioSound > AudioManager::get_sound(string const &file_name, bool positional = (0), int mode = (SM_heuristic)) = 0; Get a sound:

getSpeakerSetup virtual int AudioManager::getSpeakerSetup(void); Undocumented function.

getVolume virtual float AudioManager::get_volume(void) const = 0; 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.

isValid virtual bool AudioManager::is_valid(void) = 0; 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 virtual void AudioManager::output(ostream &out) const; Undocumented function.

reduceSoundsPlayingTo virtual void AudioManager::reduce_sounds_playing_to(unsigned int count) = 0; 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 virtual void AudioManager::set_active(bool flag) = 0; 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 begining of their loop. inits to true.

setCacheLimit virtual void AudioManager::set_cache_limit(unsigned int count) = 0; Undocumented function.

setConcurrentSoundLimit virtual void AudioManager::set_concurrent_sound_limit(unsigned int limit = (0)) = 0; 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.

setSpeakerSetup virtual void AudioManager::setSpeakerSetup(AudioManager::SpeakerModeCategory cat); Undocumented function.

setVolume virtual void AudioManager::set_volume(float volume) = 0; 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.

shutdown virtual void AudioManager::shutdown(void); Undocumented function.

stopAllSounds virtual void AudioManager::stop_all_sounds(void) = 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 virtual void AudioManager::uncache_sound(string const &file_name) = 0; 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 get_sound() from this manager. It's only affecting whether the AudioManager keeps a copy of the sound in its pool/cache.

update virtual void AudioManager::update(void); This should be called every frame. Failure to call could cause problems.

write virtual void AudioManager::write(ostream &out) const; Undocumented function.

getClassType static TypeHandle TypedReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.