Panda3D
Public Types | Public Member Functions | Static Public Member Functions | List of all members
AudioManager Class Reference
Inheritance diagram for AudioManager:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

Public Types

enum  SpeakerId {
  SPK_none = 0, SPK_frontleft = 1, SPK_frontright = 2, SPK_center = 3,
  SPK_sub = 4, SPK_backleft = 5, SPK_backright = 6, SPK_sideleft = 7,
  SPK_sideright = 8, SPK_COUNT = 9
}
 
enum  SpeakerModeCategory {
  SPEAKERMODE_raw = 0, SPEAKERMODE_mono = 1, SPEAKERMODE_stereo = 2, SPEAKERMODE_quad = 3,
  SPEAKERMODE_surround = 4, SPEAKERMODE_5point1 = 5, SPEAKERMODE_7point1 = 6, SPEAKERMODE_max = 7,
  SPEAKERMODE_COUNT = 8
}
 
enum  StreamMode { SM_heuristic = 0, SM_sample = 1, SM_stream = 2 }
 

Public Member Functions

float audio3dGetDistanceFactor ()
 
float audio3dGetDopplerFactor ()
 
float audio3dGetDropOffFactor ()
 
 audio3dSetDistanceFactor (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. More...
 
 audio3dSetDopplerFactor (float factor)
 Control the presence of the Doppler effect. Default is 1.0 Exaggerated Doppler, use >1.0 Diminshed Doppler, use <1.0. More...
 
 audio3dSetDropOffFactor (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. More...
 
 audio3dSetListenerAttributes (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. More...
 
 clearCache ()
 
bool configureFilters (FilterProperties config)
 
bool getActive ()
 
unsigned int getCacheLimit ()
 
unsigned int getConcurrentSoundLimit ()
 
AudioSound getNullSound ()
 
AudioSound getSound (MovieAudio source, bool positional, int mode)
 
AudioSound getSound (str file_name, bool positional, int mode)
 Get a sound: More...
 
int getSpeakerSetup ()
 
float getVolume ()
 
bool isValid ()
 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. More...
 
 output (Ostream out)
 
 reduceSoundsPlayingTo (unsigned int count)
 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. More...
 
 setActive (bool flag)
 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. inits to true. More...
 
 setCacheLimit (unsigned int count)
 
 setConcurrentSoundLimit (unsigned int limit)
 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. More...
 
 setSpeakerConfiguration (LVecBase3 speaker1, LVecBase3 speaker2, LVecBase3 speaker3, LVecBase3 speaker4, LVecBase3 speaker5, LVecBase3 speaker6, LVecBase3 speaker7, LVecBase3 speaker8, LVecBase3 speaker9)
 set_speaker_configuration is a Miles only method. More...
 
 setSpeakerSetup (AudioManager::SpeakerModeCategory cat)
 
 setVolume (float volume)
 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. More...
 
 shutdown ()
 
 stopAllSounds ()
 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. More...
 
 uncacheSound (str file_name)
 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. More...
 
 update ()
 This should be called every frame. Failure to call could cause problems. More...
 
 write (Ostream out)
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 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(). More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 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. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 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.) However, see the helper function unref_delete(). More...
 

Static Public Member Functions

static AudioManager createAudioManager ()
 
static TypeHandle getClassType ()
 
static Filename getDlsPathname ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Member Enumeration Documentation

◆ SpeakerId

enum SpeakerId
Enumerator
SPK_none 
SPK_frontleft 
SPK_frontright 
SPK_center 
SPK_sub 
SPK_backleft 
SPK_backright 
SPK_sideleft 
SPK_sideright 
SPK_COUNT 

◆ SpeakerModeCategory

Enumerator
SPEAKERMODE_raw 

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

SPEAKERMODE_mono 
SPEAKERMODE_stereo 
SPEAKERMODE_quad 
SPEAKERMODE_surround 
SPEAKERMODE_5point1 
SPEAKERMODE_7point1 
SPEAKERMODE_max 
SPEAKERMODE_COUNT 

◆ StreamMode

enum StreamMode
Enumerator
SM_heuristic 
SM_sample 
SM_stream 

Member Function Documentation

◆ audio3dGetDistanceFactor()

float audio3dGetDistanceFactor ( )

◆ audio3dGetDopplerFactor()

float audio3dGetDopplerFactor ( )

◆ audio3dGetDropOffFactor()

float audio3dGetDropOffFactor ( )

◆ audio3dSetDistanceFactor()

audio3dSetDistanceFactor ( 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()

audio3dSetDopplerFactor ( float  factor)

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

◆ audio3dSetDropOffFactor()

audio3dSetDropOffFactor ( 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()

audio3dSetListenerAttributes ( 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()

clearCache ( )

◆ configureFilters()

bool configureFilters ( FilterProperties  config)

◆ createAudioManager()

static AudioManager createAudioManager ( )
static

◆ getActive()

bool getActive ( )

◆ getCacheLimit()

unsigned int getCacheLimit ( )

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getConcurrentSoundLimit()

unsigned int getConcurrentSoundLimit ( )

◆ getDlsPathname()

static Filename getDlsPathname ( )
static

◆ getNullSound()

AudioSound getNullSound ( )

◆ getSound() [1/2]

AudioSound getSound ( MovieAudio  source,
bool  positional,
int  mode 
)

◆ getSound() [2/2]

AudioSound getSound ( str  file_name,
bool  positional,
int  mode 
)

Get a sound:

◆ getSpeakerSetup()

int getSpeakerSetup ( )

◆ getVolume()

float getVolume ( )

◆ isValid()

bool isValid ( )

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()

output ( Ostream  out)

◆ reduceSoundsPlayingTo()

reduceSoundsPlayingTo ( unsigned int  count)

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()

setActive ( bool  flag)

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. inits to true.

◆ setCacheLimit()

setCacheLimit ( unsigned int  count)

◆ setConcurrentSoundLimit()

setConcurrentSoundLimit ( unsigned int  limit)

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()

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

set_speaker_configuration is a Miles only method.

◆ setSpeakerSetup()

setSpeakerSetup ( AudioManager::SpeakerModeCategory  cat)

◆ setVolume()

setVolume ( float  volume)

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()

shutdown ( )

◆ stopAllSounds()

stopAllSounds ( )

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()

uncacheSound ( str  file_name)

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()

update ( )

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

◆ write()

write ( Ostream  out)