osgAL::SoundState Class Reference

Class that encapsulate the settings valid for a soundsource. More...

List of all members.

Public Member Functions

 SoundState ()
 may be only used for clone methods of osg
 SoundState (const std::string &name)
 ~SoundState ()
 Destructor, releases any allocated sound sources.
 SoundState (const SoundState &state)
 Copy constructor.
virtual osg::Object * cloneType () const
virtual osg::Object * clone (const osg::CopyOp &copyop) const
virtual const char * libraryName () const
virtual const char * className () const
void setName (const std::string &name)
 Change the name of the SoundState to name.
SoundStateoperator= (const SoundState &state)
 Assignment operator.
std::string getName () const
 Return the name of this soundstate.
bool hasSource () const
 Returns true if the SoundState has allocated a soundsource.
void setSample (openalpp::Sample *sample)
 Set the sample that this state will play.
void setStream (openalpp::Stream *stream)
 Set the stream that this state will play.
const openalpp::Sample * getSample () const
 Returns the sample if used.
const openalpp::Stream * getStream () const
 Returns the stream if used.
void setPosition (const osg::Vec3 &pos)
 Set the position of SoundState.
osg::Vec3 getPosition () const
 Get the position of SoundState.
void setVelocity (const osg::Vec3 &vel)
 Set the velocity of the SoundState.
osg::Vec3 getVelocity () const
 Get the velocity of the SoundState.
void setDirection (const osg::Vec3 &dir)
 Set the direction of the SoundState.
osg::Vec3 getDirection () const
 Get the direction of the SoundState.
void setGain (float gain)
 Set the gain (volume) of the soundstate (1.0 is default).
float getGain () const
 Get the gain (volume) of the soundstate (1.0 is default).
bool getLooping () const
 Return true if the sound state is in looping mode.
void setLooping (bool flag)
 Set the SoundState in looping mode.
void setAmbient (bool flag)
 Set the soundstate in ambient (no attenuation will be calculated).
bool getAmbient () const
 Get the soundstate in ambient (no attenuation will be calculated).
void setRelative (bool flag)
 Set the soundstate so it will always be relative to the listener in position.
bool getRelative () const
 Get the soundstate so it will always be relative to the listener in position.
void setSoundCone (float innerAngle, float outerAngle, float outerGain)
float getInnerAngle () const
 Get the the inner angle of the cone for the SoundState in degrees.
float getOuterAngle () const
 Get the the outer angle of the cone for the SoundState in degrees.
float getOuterGain () const
 Get the the outer gain of the cone for the SoundState.
bool isActive ()
void setReferenceDistance (float distance)
 Set the reference distance for the SoundState.
float getReferenceDistance () const
 Get the reference distance for the SoundState.
void setMaxDistance (float max)
float getMaxDistance () const
void setRolloffFactor (float roll)
 Specifies the roll of factor for the SoundState, 1.0 is default.
float getRolloffFactor () const
 Return the roll of factor for the SoundState, 1.0 is default.
void setPitch (float pitch)
 Set the pitch (rate) for the SoundState (1.0 is default).
float getPitch () const
 Get the pitch (rate) for the SoundState (1.0 is default).
void setPlay (bool flag)
 Starts to play the SoundState.
bool getPlay ()
 Return if the soundstate will play.
void setOccludeDampingFactor (float d)
float getOccludeDampingFactor () const
void setOccludeScale (float d)
float getOccludeScale () const
void setOccluded (bool f)
bool getOccluded () const
void setStopMethod (openalpp::SourceState s)
 Set whether paus or stop should be used when calling setPlay(false).
bool isPlaying ()
 Returns true if there is a source and it is playing.
bool isPlaying () const
 Returns with const true if there is a source and it is playing.
openalpp::SourceState getStopMethod () const
bool allocateSource (unsigned int priority=0, bool registrate_as_active=true)
unsigned int getPriority () const
 Return the priority set for this SoundState.
void setSource (openalpp::Source *source)
 Set the Source for this SoundState.
const openalpp::Source * getSource () const
 Return the Source for this SoundState.
void releaseSource ()
 Release the Source that is allocated for this SoundState.
void apply ()
 Performs the actual modification to the allocated Source.


Detailed Description

Class that encapsulate the settings valid for a soundsource.

This class stores the attributes for a sound source. It can exist with a sound source allocated to it, (hasSource() == true) which makes it the same thing as a sound source. Otherwise, it works as a placeholder (state) for a sound source. It can be assigned a sound source at anytime. Then apply() is called and it has a sound source the actual settings will be performed. It a state has a sound source all the set*() method calls apply automatically.


Constructor & Destructor Documentation

osgAL::SoundState::SoundState (  ) 

may be only used for clone methods of osg

Constructor

osgAL::SoundState::SoundState ( const std::string &  name  ) 

Constructor

Parameters:
name - The identifier of the SoundState

osgAL::SoundState::~SoundState (  ) 

Destructor, releases any allocated sound sources.

osgAL::SoundState::SoundState ( const SoundState state  )  [inline]

Copy constructor.


Member Function Documentation

bool osgAL::SoundState::allocateSource ( unsigned int  priority = 0,
bool  registrate_as_active = true 
)

Allocates a soundsource for this soundstate

Parameters:
priority - This priority is used when fighting with other active soundstates for the limited resource of SoundSources. If a active (playing) SoundState has a lower priority than this, it will be discarded, and the sound source will be used for this SoundState
priority - The priority of this state. The higher, the better chance of actually get a Sound source allocated.
registrate_as_active - This specifies wether the Allocated SoundSource will be added to the list of active SoundSources, in that case it can be
Returns:
true if a source was successfully allocated.

void osgAL::SoundState::apply (  ) 

Performs the actual modification to the allocated Source.

virtual const char* osgAL::SoundState::className (  )  const [inline, virtual]

virtual osg::Object* osgAL::SoundState::clone ( const osg::CopyOp &  copyop  )  const [inline, virtual]

virtual osg::Object* osgAL::SoundState::cloneType (  )  const [inline, virtual]

bool osgAL::SoundState::getAmbient (  )  const [inline]

Get the soundstate in ambient (no attenuation will be calculated).

osg::Vec3 osgAL::SoundState::getDirection (  )  const [inline]

Get the direction of the SoundState.

float osgAL::SoundState::getGain (  )  const [inline]

Get the gain (volume) of the soundstate (1.0 is default).

float osgAL::SoundState::getInnerAngle (  )  const [inline]

Get the the inner angle of the cone for the SoundState in degrees.

bool osgAL::SoundState::getLooping (  )  const [inline]

Return true if the sound state is in looping mode.

float osgAL::SoundState::getMaxDistance (  )  const [inline]

Get the maximum distance for the SoundState, that is further away from the listener the source will be turned of when in the InverseClamp sound mode 1.0 is default

std::string osgAL::SoundState::getName (  )  const [inline]

Return the name of this soundstate.

bool osgAL::SoundState::getOccluded (  )  const [inline]

float osgAL::SoundState::getOccludeDampingFactor (  )  const [inline]

float osgAL::SoundState::getOccludeScale (  )  const [inline]

float osgAL::SoundState::getOuterAngle (  )  const [inline]

Get the the outer angle of the cone for the SoundState in degrees.

float osgAL::SoundState::getOuterGain (  )  const [inline]

Get the the outer gain of the cone for the SoundState.

float osgAL::SoundState::getPitch (  )  const [inline]

Get the pitch (rate) for the SoundState (1.0 is default).

bool osgAL::SoundState::getPlay (  )  [inline]

Return if the soundstate will play.

osg::Vec3 osgAL::SoundState::getPosition (  )  const [inline]

Get the position of SoundState.

unsigned int osgAL::SoundState::getPriority (  )  const [inline]

Return the priority set for this SoundState.

float osgAL::SoundState::getReferenceDistance (  )  const [inline]

Get the reference distance for the SoundState.

bool osgAL::SoundState::getRelative (  )  const [inline]

Get the soundstate so it will always be relative to the listener in position.

float osgAL::SoundState::getRolloffFactor (  )  const [inline]

Return the roll of factor for the SoundState, 1.0 is default.

const openalpp::Sample* osgAL::SoundState::getSample (  )  const [inline]

Returns the sample if used.

const openalpp::Source* osgAL::SoundState::getSource (  )  const [inline]

Return the Source for this SoundState.

openalpp::SourceState osgAL::SoundState::getStopMethod (  )  const [inline]

const openalpp::Stream* osgAL::SoundState::getStream (  )  const [inline]

Returns the stream if used.

osg::Vec3 osgAL::SoundState::getVelocity (  )  const [inline]

Get the velocity of the SoundState.

bool osgAL::SoundState::hasSource (  )  const [inline]

Returns true if the SoundState has allocated a soundsource.

bool osgAL::SoundState::isActive (  ) 

Returns:
true if the source is in playing state. If there is no source associated, it will return false.

bool osgAL::SoundState::isPlaying (  )  const [inline]

Returns with const true if there is a source and it is playing.

bool osgAL::SoundState::isPlaying (  )  [inline]

Returns true if there is a source and it is playing.

virtual const char* osgAL::SoundState::libraryName (  )  const [inline, virtual]

SoundState& osgAL::SoundState::operator= ( const SoundState state  ) 

Assignment operator.

void osgAL::SoundState::releaseSource (  ) 

Release the Source that is allocated for this SoundState.

void osgAL::SoundState::setAmbient ( bool  flag  )  [inline]

Set the soundstate in ambient (no attenuation will be calculated).

void osgAL::SoundState::setDirection ( const osg::Vec3 &  dir  )  [inline]

Set the direction of the SoundState.

void osgAL::SoundState::setGain ( float  gain  )  [inline]

Set the gain (volume) of the soundstate (1.0 is default).

void osgAL::SoundState::setLooping ( bool  flag  )  [inline]

Set the SoundState in looping mode.

void osgAL::SoundState::setMaxDistance ( float  max  )  [inline]

Set the maximum distance for the SoundState, that is further away from the listener the source will be turned of when in the InverseClamp sound mode 1.0 is default

void osgAL::SoundState::setName ( const std::string &  name  )  [inline]

Change the name of the SoundState to name.

void osgAL::SoundState::setOccluded ( bool  f  )  [inline]

void osgAL::SoundState::setOccludeDampingFactor ( float  d  )  [inline]

void osgAL::SoundState::setOccludeScale ( float  d  )  [inline]

void osgAL::SoundState::setPitch ( float  pitch  )  [inline]

Set the pitch (rate) for the SoundState (1.0 is default).

void osgAL::SoundState::setPlay ( bool  flag  )  [inline]

Starts to play the SoundState.

void osgAL::SoundState::setPosition ( const osg::Vec3 &  pos  )  [inline]

Set the position of SoundState.

void osgAL::SoundState::setReferenceDistance ( float  distance  )  [inline]

Set the reference distance for the SoundState.

void osgAL::SoundState::setRelative ( bool  flag  )  [inline]

Set the soundstate so it will always be relative to the listener in position.

void osgAL::SoundState::setRolloffFactor ( float  roll  )  [inline]

Specifies the roll of factor for the SoundState, 1.0 is default.

void osgAL::SoundState::setSample ( openalpp::Sample *  sample  )  [inline]

Set the sample that this state will play.

void osgAL::SoundState::setSoundCone ( float  innerAngle,
float  outerAngle,
float  outerGain 
) [inline]

Specifies the sound cone for a directional sound source. When outside the cone, the outer gain is the gain used in the attenuation calculation.

void osgAL::SoundState::setSource ( openalpp::Source *  source  ) 

Set the Source for this SoundState.

void osgAL::SoundState::setStopMethod ( openalpp::SourceState  s  )  [inline]

Set whether paus or stop should be used when calling setPlay(false).

void osgAL::SoundState::setStream ( openalpp::Stream *  stream  )  [inline]

Set the stream that this state will play.

void osgAL::SoundState::setVelocity ( const osg::Vec3 &  vel  )  [inline]

Set the velocity of the SoundState.


The documentation for this class was generated from the following file:
Generated on Mon Oct 16 12:46:01 2006 for osgAL by  doxygen 1.4.7