Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

osgAL::SoundState Class Reference

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

List of all members.

Public Methods

 SoundState (const std::string &name)
 ~SoundState ()
 Destructor, releases any allocated sound sources. More...

 SoundState (const SoundState &state)
 Copy constructor. More...

void setName (const std::string &name)
 Change the name of the SoundState to name. More...

SoundState & operator= (const SoundState &state)
 Assignment operator. More...

std::string getName () const
 Return the name of this soundstate. More...

bool hasSource () const
 Returns true if the SoundState has allocated a soundsource. More...

void setSample (openalpp::Sample *sample)
 Set the sample that this state will play. More...

void setStream (openalpp::Stream *stream)
 Set the stream that this state will play. More...

void setPosition (const osg::Vec3 &pos)
 Set the position of SoundState. More...

osg::Vec3 getPosition () const
 Get the position of SoundState. More...

void setVelocity (const osg::Vec3 &vel)
 Set the velocity of the SoundState. More...

osg::Vec3 getVelocity (const osg::Vec3 &vel) const
 Get the velocity of the SoundState. More...

void setDirection (const osg::Vec3 &dir)
 Set the direction of the SoundState. More...

osg::Vec3 getDirection () const
 Get the direction of the SoundState. More...

void setGain (float gain)
 Set the gain (volume) of the soundstate (1.0 is default). More...

float getGain () const
 Get the gain (volume) of the soundstate (1.0 is default). More...

bool getLooping () const
 Return true if the sound state is in looping mode. More...

void setLooping (bool flag)
 Set the SoundState in looping mode. More...

void setAmbient (bool flag)
 Set the soundstate in ambient (no attenuation will be calculated). More...

bool getAmbient () const
 Get the soundstate in ambient (no attenuation will be calculated). More...

void setRelative (bool flag)
 Set the soundstate so it will always be relative to the listener in position. More...

bool getRelative () const
 Get the soundstate so it will always be relative to the listener in position. More...

void setSoundCone (float innerAngle, float outerAngle, float outerGain)
bool isActive ()
 
Returns:
true if the source is in playing state. If there is no source associated, it will return false.
More...


void setReferenceDistance (float distance)
 Set the reference distance for the SoundState. More...

float getReferenceDistance (float distance) const
 Get the reference distance for the SoundState. More...

void setMaxDistance (float max)
float getMaxDistance (float max) const
void setRolloffFactor (float roll)
 Specifies the roll of factor for the SoundState, 1.0 is default. More...

float getRolloffFactor () const
 Return the roll of factor for the SoundState, 1.0 is default. More...

void setPitch (float pitch)
 Set the pitch (rate) for the SoundState (1.0 is default). More...

float getPitch () const
 Get the pitch (rate) for the SoundState (1.0 is default). More...

void setPlay (bool flag)
 Starts to play the SoundState. More...

bool getPlay ()
 Return if the soundstate will play. More...

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). More...

bool isPlaying ()
 Returns true if there is a source and it is playing. More...

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

void setSource (openalpp::Source *source)
 Set the Source for this SoundState. More...

const openalpp::Source * getSource () const
 Return the Source for this SoundState. More...

void releaseSource ()
 Release the Source that is allocated for this SoundState. More...

void apply ()
 Performs the actual modification to the allocated Source. More...


Private Types

enum  SetField {
  Gain, Looping, Ambient, Relative,
  SoundCone, ReferenceDistance, RolloffFactor, Stream,
  Sample, Pitch, Position, Direction,
  Velocity, MaxDistance, Play, Occluded,
  Last
}
 Specifies what field that has been set. More...


Private Methods

void setAll (bool flag)
 Clear all the flags indicating a value has been set. More...

bool isSet (SetField f)
 Return true if SetField f is set since last call to apply() or clear(). More...

void set (SetField f)
 Set the given field to true. More...

void clear (SetField f)

Private Attributes

openalpp::ref_ptr< openalpp::Stream > m_stream
openalpp::ref_ptr< openalpp::Sample > m_sample
openalpp::ref_ptr< openalpp::Source > m_source
std::string m_name
osg::Vec3 m_position
osg::Vec3 m_direction
osg::Vec3 m_velocity
float m_gain
float m_innerAngle
float m_outerAngle
float m_outerGain
float m_referenceDistance
float m_maxDistance
float m_rolloffFactor
float m_pitch
float m_occlude_damping_factor
float m_occlude_scale
bool m_is_occluded
bool m_looping
bool m_ambient
bool m_relative
bool m_play
bool m_pause
unsigned m_priority
std::vector< bool > m_is_set


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.


Member Enumeration Documentation

enum osgAL::SoundState::SetField [private]
 

Specifies what field that has been set.

Enumeration values:
Gain 
Looping 
Ambient 
Relative 
SoundCone 
ReferenceDistance 
RolloffFactor 
Stream 
Sample 
Pitch 
Position 
Direction 
Velocity 
MaxDistance 
Play 
Occluded 
Last 


Constructor & Destructor Documentation

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.

void osgAL::SoundState::clear SetField    f [inline, private]
 

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

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

Return true if the sound state is in looping mode.

float osgAL::SoundState::getMaxDistance float    max 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::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 float    distance 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::Source* osgAL::SoundState::getSource   const [inline]
 

Return the Source for this SoundState.

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

osg::Vec3 osgAL::SoundState::getVelocity const osg::Vec3 &    vel 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   [inline]
 

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

bool osgAL::SoundState::isSet SetField    f [inline, private]
 

Return true if SetField f is set since last call to apply() or clear().

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::set SetField    f [inline, private]
 

Set the given field to true.

void osgAL::SoundState::setAll bool    flag [inline, private]
 

Clear all the flags indicating a value has been set.

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.


Member Data Documentation

bool osgAL::SoundState::m_ambient [private]
 

osg::Vec3 osgAL::SoundState::m_direction [private]
 

float osgAL::SoundState::m_gain [private]
 

float osgAL::SoundState::m_innerAngle [private]
 

bool osgAL::SoundState::m_is_occluded [private]
 

std::vector<bool> osgAL::SoundState::m_is_set [private]
 

bool osgAL::SoundState::m_looping [private]
 

float osgAL::SoundState::m_maxDistance [private]
 

std::string osgAL::SoundState::m_name [private]
 

float osgAL::SoundState::m_occlude_damping_factor [private]
 

float osgAL::SoundState::m_occlude_scale [private]
 

float osgAL::SoundState::m_outerAngle [private]
 

float osgAL::SoundState::m_outerGain [private]
 

bool osgAL::SoundState::m_pause [private]
 

float osgAL::SoundState::m_pitch [private]
 

bool osgAL::SoundState::m_play [private]
 

osg::Vec3 osgAL::SoundState::m_position [private]
 

unsigned osgAL::SoundState::m_priority [private]
 

float osgAL::SoundState::m_referenceDistance [private]
 

bool osgAL::SoundState::m_relative [private]
 

float osgAL::SoundState::m_rolloffFactor [private]
 

openalpp::ref_ptr<openalpp::Sample> osgAL::SoundState::m_sample [private]
 

openalpp::ref_ptr<openalpp::Source> osgAL::SoundState::m_source [private]
 

openalpp::ref_ptr<openalpp::Stream> osgAL::SoundState::m_stream [private]
 

osg::Vec3 osgAL::SoundState::m_velocity [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Nov 22 09:27:17 2004 for OpenSceneGraphAudioLibrary(OsgAL) by doxygen1.2.15