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.
void setEnable (bool flag)
bool getEnable () const
 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::SamplegetSample () const
 Returns the sample if used.
const openalpp::StreamgetStream () 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::SourcegetSource () 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

void osgAL::SoundState::setEnable ( bool  flag  ) 

Specify if the SoundState should be enabled or not. If its disabled it will not play no matter what. It cannot be pushed as a soundEvent to the SoundMgr If the soundstate has a soundsources allocated it will stop playing. It not, the setPlay(false) method will be called All parameters can be changed, but it cant be played. This will ensure that noone can make a SoundState wich is disabled play, unless they enable it.

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

Return if the soundstate is enabled or not

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

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

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

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

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

Change the name of the SoundState to name.

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

Assignment operator.

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

Return the name of this soundstate.

Referenced by osgAL::SoundManager::addSoundState().

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

Returns true if the SoundState has allocated a soundsource.

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

Set the sample that this state will play.

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

Set the stream that this state will play.

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

Returns the sample if used.

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

Returns the stream if used.

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

Set the position of SoundState.

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

Get the position of SoundState.

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

Set the velocity of the SoundState.

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

Get the velocity of the SoundState.

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

Set the direction of the SoundState.

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

Get the direction of the SoundState.

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

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

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

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

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

Return true if the sound state is in looping mode.

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

Set the SoundState in looping mode.

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

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

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

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

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

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

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

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

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.

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

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

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.

bool osgAL::SoundState::isActive (  ) 

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

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

Set the reference distance for the SoundState.

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

Get the reference distance for the SoundState.

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

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

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

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

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

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

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

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

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

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

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

Starts to play the SoundState.

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

Return if the soundstate will play.

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

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

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

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

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

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

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

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

References openalpp::Paused.

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

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

References openalpp::Playing.

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

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

References openalpp::Playing.

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

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.

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

Return the priority set for this SoundState.

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

Set the Source for this SoundState.

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

Return the Source for this SoundState.

void osgAL::SoundState::releaseSource (  ) 

Release the Source that is allocated for this SoundState.

void osgAL::SoundState::apply (  ) 

Performs the actual modification to the allocated Source.


The documentation for this class was generated from the following file:

Generated on Sun Aug 24 13:41:34 2008 for osgAL by  doxygen 1.5.6