Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions

AudioVolumeAttrib Class Reference

Applies a scale to audio volume for positional sounds in the scene graph. More...

#include "audioVolumeAttrib.h"

Inheritance diagram for AudioVolumeAttrib:
RenderAttrib TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 CPT (RenderAttrib) set_volume(float volume) const
virtual TypeHandle force_init_type ()
virtual int get_slot () const
virtual TypeHandle get_type () const
float get_volume () const
 Returns the volume to be applied to sounds.
bool has_volume () const
 Returns true if the AudioVolumeAttrib has a non-identity volume, false otherwise (in which case it might be an off attrib or an identity attrib).
bool is_off () const
 Returns true if the AudioVolumeAttrib will ignore any color scales inherited from above, false otherwise.
virtual void output (ostream &out) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

Static Public Member Functions

static CPT (RenderAttrib) make_identity()
static CPT (RenderAttrib) make(float volume)
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make_off()
static int get_class_slot ()
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type AudioVolumeAttrib.

Protected Member Functions

 AudioVolumeAttrib (bool off, float volume)
 Use AudioVolumeAttrib::make() to construct a new AudioVolumeAttrib object.
 AudioVolumeAttrib (const AudioVolumeAttrib &copy)
 Use AudioVolumeAttrib::make() to construct a new AudioVolumeAttrib object.
virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived AudioVolumeAttrib types to return a unique number indicating whether this AudioVolumeAttrib is equivalent to the other one.
virtual CPT (RenderAttrib) compose_impl(const RenderAttrib *other) const
virtual CPT (RenderAttrib) invert_compose_impl(const RenderAttrib *other) const
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new AudioVolumeAttrib.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type AudioVolumeAttrib is encountered in the Bam file.

Detailed Description

Applies a scale to audio volume for positional sounds in the scene graph.

Definition at line 30 of file audioVolumeAttrib.h.


Constructor & Destructor Documentation

AudioVolumeAttrib::AudioVolumeAttrib ( bool  off,
float  volume 
) [protected]

Use AudioVolumeAttrib::make() to construct a new AudioVolumeAttrib object.

Definition at line 35 of file audioVolumeAttrib.cxx.

Referenced by make_from_bam().

AudioVolumeAttrib::AudioVolumeAttrib ( const AudioVolumeAttrib copy) [inline, protected]

Use AudioVolumeAttrib::make() to construct a new AudioVolumeAttrib object.

Definition at line 23 of file audioVolumeAttrib.I.


Member Function Documentation

int AudioVolumeAttrib::compare_to_impl ( const RenderAttrib other) const [protected, virtual]

Intended to be overridden by derived AudioVolumeAttrib types to return a unique number indicating whether this AudioVolumeAttrib is equivalent to the other one.

This should return 0 if the two AudioVolumeAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.

This will only be called with two AudioVolumeAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 149 of file audioVolumeAttrib.cxx.

References is_off().

void AudioVolumeAttrib::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new AudioVolumeAttrib.

Reimplemented from RenderAttrib.

Definition at line 281 of file audioVolumeAttrib.cxx.

References DatagramIterator::get_bool(), and DatagramIterator::get_float32().

Referenced by make_from_bam().

float AudioVolumeAttrib::get_volume ( ) const [inline]

Returns the volume to be applied to sounds.

Definition at line 62 of file audioVolumeAttrib.I.

Referenced by NodePath::get_audio_volume(), and NodePath::get_net_audio_volume().

bool AudioVolumeAttrib::has_volume ( ) const [inline]

Returns true if the AudioVolumeAttrib has a non-identity volume, false otherwise (in which case it might be an off attrib or an identity attrib).

Definition at line 52 of file audioVolumeAttrib.I.

bool AudioVolumeAttrib::is_off ( ) const [inline]

Returns true if the AudioVolumeAttrib will ignore any color scales inherited from above, false otherwise.

This is not the same thing as !has_scale(); a AudioVolumeAttrib may have the "off" flag set and also have another scale specified.

Definition at line 40 of file audioVolumeAttrib.I.

Referenced by compare_to_impl().

TypedWritable * AudioVolumeAttrib::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type AudioVolumeAttrib is encountered in the Bam file.

It should create the AudioVolumeAttrib and extract its information from the file.

Definition at line 262 of file audioVolumeAttrib.cxx.

References AudioVolumeAttrib(), and fillin().

Referenced by register_with_read_factory().

void AudioVolumeAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type AudioVolumeAttrib.

Definition at line 232 of file audioVolumeAttrib.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void AudioVolumeAttrib::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from RenderAttrib.

Definition at line 243 of file audioVolumeAttrib.cxx.

References Datagram::add_bool(), and Datagram::add_float32().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations