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
virtual PN_stdfloat audio_3d_get_distance_factor(void) const
virtual PN_stdfloat audio_3d_get_doppler_factor(void) const
virtual PN_stdfloat audio_3d_get_drop_off_factor(void) const
virtual void audio_3d_get_listener_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz, PN_stdfloat *fx, PN_stdfloat *fy, PN_stdfloat *fz, PN_stdfloat *ux, PN_stdfloat *uy, PN_stdfloat *uz)
virtual void audio_3d_set_distance_factor(PN_stdfloat factor)

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.

virtual void audio_3d_set_doppler_factor(PN_stdfloat factor)

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

virtual void audio_3d_set_drop_off_factor(PN_stdfloat 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

virtual void audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat 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

virtual void clear_cache(void) = 0
virtual bool configure_filters(FilterProperties *config)
static PointerTo<AudioManager> create_AudioManager(void)
virtual bool get_active(void) const = 0
virtual unsigned int get_cache_limit(void) const = 0
static TypeHandle get_class_type(void)
virtual unsigned int get_concurrent_sound_limit(void) const = 0
static Filename get_dls_pathname(void)
PointerTo<AudioSound> get_null_sound(void)
virtual PointerTo<AudioSound> get_sound(Filename const &file_name, bool positional = false, int mode = SM_heuristic) = 0
virtual PointerTo<AudioSound> get_sound(MovieAudio *source, bool positional = false, int mode = SM_heuristic) = 0

Get a sound:

virtual int get_speaker_setup(void)
virtual PN_stdfloat get_volume(void) const = 0
virtual bool 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.

virtual void output(std::ostream &out) const
virtual void 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.

virtual void 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 beginning of their loop. Defaults to true.

virtual void set_cache_limit(unsigned int count) = 0
virtual void 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.

virtual void set_speaker_setup(AudioManager::SpeakerModeCategory cat)
virtual void set_volume(PN_stdfloat 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.

virtual void shutdown(void)
virtual void 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.

virtual void uncache_sound(Filename 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 poolcache.

virtual void update(void)

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

virtual void write(std::ostream &out) const