AudioSound

class AudioSound

Bases: TypedReferenceCount

Inheritance diagram

Inheritance diagram of AudioSound

enum SoundStatus
enumerator BAD = 0
enumerator READY = 1
enumerator PLAYING = 2
virtual bool configure_filters(FilterProperties *config)
virtual void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz)
virtual PN_stdfloat get_3d_max_distance(void) const
virtual PN_stdfloat get_3d_min_distance(void) const
virtual bool get_active(void) const = 0
virtual PN_stdfloat get_balance(void) const = 0
static TypeHandle get_class_type(void)
virtual std::string const &get_finished_event(void) const = 0
virtual bool get_loop(void) const = 0
virtual unsigned long int get_loop_count(void) const = 0
virtual std::string const &get_name(void) const = 0

There is no set_name(), this is intentional.

virtual PN_stdfloat get_play_rate(void) const = 0
virtual int get_priority(void)
virtual PN_stdfloat get_speaker_mix(int speaker)

speaker_mix is for use with FMOD.

virtual PN_stdfloat get_time(void) const = 0
virtual PN_stdfloat get_volume(void) const = 0
virtual PN_stdfloat length(void) const = 0

return: playing time in seconds.

virtual void output(std::ostream &out) const
virtual void play(void) = 0

For best compatibility, set the loop_count, volume, and balance, prior to calling play(). You may set them while they’re playing, but it’s implementation specific whether you get the results. - Calling play() a second time on the same sound before it is finished will start the sound again (creating a skipping or stuttering effect).

virtual void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz)

Controls the position of this sound’s emitter. px, py and pz are the emitter’s position. vx, vy and vz are the emitter’s velocity in UNITS PER SECOND (default: meters).

virtual void set_3d_max_distance(PN_stdfloat dist)

Controls the maximum distance (in units) that this sound stops falling off. The sound does not stop at that point, it just doesn’t get any quieter. You should rarely need to adjust this. Default is 1000000000.0

virtual void set_3d_min_distance(PN_stdfloat dist)

Controls the distance (in units) that this sound begins to fall off. Also affects the rate it falls off. Default is 1.0 CloserFaster, <1.0 FartherSlower, >1.0

virtual void set_active(bool flag = true) = 0

inits to manager’s state.

virtual void set_balance(PN_stdfloat balance_right = 0.0) = 0

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0.

virtual void set_finished_event(std::string const &event) = 0

Set (or clear) the event that will be thrown when the sound finishes playing. To clear the event, pass an empty string.

virtual void set_loop(bool loop = true) = 0

loop: false = play once; true = play forever. inits to false.

virtual void set_loop_count(unsigned long int loop_count = 1) = 0

loop_count: 0 = forever; 1 = play once; n = play n times. inits to 1.

virtual void set_play_rate(PN_stdfloat play_rate = 1.0) = 0

play_rate is any positive PN_stdfloat value. inits to 1.0.

virtual void set_priority(int priority)
virtual void set_speaker_mix(PN_stdfloat frontleft, PN_stdfloat frontright, PN_stdfloat center, PN_stdfloat sub, PN_stdfloat backleft, PN_stdfloat backright, PN_stdfloat sideleft, PN_stdfloat sideright)
virtual void set_time(PN_stdfloat start_time = 0.0) = 0

Control time position within the sound, in seconds. This is similar (in concept) to the seek position within a file. The value starts at 0.0 (the default) and ends at the value given by the length() method.

In the past, this call did nothing if the sound was currently playing, and it was necessary to call play() to effect the change. This is no longer the case; the time change takes effect immediately.

If a sound is playing, calling get_time() repeatedly will return different results over time. e.g.

PN_stdfloat percent_complete = s.get_time() / s.length();
virtual void set_volume(PN_stdfloat volume = 1.0) = 0

0 = minimum; 1.0 = maximum. inits to 1.0.

virtual SoundStatus status(void) const = 0
virtual void stop(void) = 0
virtual void write(std::ostream &out) const