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(PN_stdfloat volume) const
virtual TypeHandle force_init_type ()
virtual int get_slot () const
virtual TypeHandle get_type () const
PN_stdfloat 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(PN_stdfloat 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, PN_stdfloat 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.
virtual size_t get_hash_impl () const
 Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

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,
PN_stdfloat  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.

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 290 of file audioVolumeAttrib.cxx.

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

Referenced by make_from_bam().

size_t AudioVolumeAttrib::get_hash_impl ( ) const [protected, virtual]

Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.

Reimplemented from RenderAttrib.

Definition at line 175 of file audioVolumeAttrib.cxx.

References floating_point_hash< Key >::add_hash(), and integer_hash< Key, Compare >::add_hash().

PN_stdfloat 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.

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 271 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 241 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 252 of file audioVolumeAttrib.cxx.

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


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