version 3.3

VRS::SOUND::SourceAL Class Reference

#include <vrs/openal/sourceal.h>

Inheritance diagram for VRS::SOUND::SourceAL:

VRS::PolyAttribute VRS::Attribute VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  SourceType { UNDETERMINED = AL_UNDETERMINED, STATIC = AL_STATIC, STREAMING = AL_STREAMING }
enum  SourceState { INITIAL = AL_INITIAL, PLAYING = AL_PLAYING, PAUSED = AL_PAUSED, STOPPED = AL_STOPPED }

Public Member Functions

 VRS_SERIALIZABLE_CLASS_ENUM (SourceType)
 VRS_SERIALIZABLE_CLASS_ENUM (SourceState)
 SourceAL (const Vector &position=Vector::origin, const Vector &velocity=Vector::origin, const Vector &direction=Vector::origin, bool relativeMode=false, bool loopMode=false, float gain=1.0f, float gainMax=1.0f, float gainMin=0.0f, float innerConeAngle=360.0f, float outerConeAngle=360.0f, float coneOuterGain=0.0f, float pitch=1.0f, float referenceDistance=1.0f, float maxDistance=std::numeric_limits< float >::max(), float rollOffFactor=1.0f, bool enabled=true)
 SourceAL (const SO< BufferAL > &buffer, const Vector &position=Vector::origin, const Vector &velocity=Vector::origin, const Vector &direction=Vector::origin, bool relativeMode=false, bool loopMode=false, float gain=1.0f, float gainMax=1.0f, float gainMin=0.0f, float innerConeAngle=360.0f, float outerConeAngle=360.0f, float coneOuterGain=0.0f, float pitch=1.0f, float referenceDistance=1.0f, float maxDistance=std::numeric_limits< float >::max(), float rollOffFactor=1.0f, bool enabled=true)
 SourceAL (const SO< Iterator< SO< BufferAL > > > &buffers, const Vector &position=Vector::origin, const Vector &velocity=Vector::origin, const Vector &direction=Vector::origin, bool relativeMode=false, bool loopMode=false, float gain=1.0f, float gainMax=1.0f, float gainMin=0.0f, float innerConeAngle=360.0f, float outerConeAngle=360.0f, float coneOuterGain=0.0f, float pitch=1.0f, float referenceDistance=1.0f, float maxDistance=std::numeric_limits< float >::max(), float rollOffFactor=1.0f, bool enabled=true)
 SourceAL (const SO< BufferAL > &buffer, const SO< SceneThing > &sceneThing, const Vector &velocity=Vector::origin, const Vector &direction=Vector::origin, bool relativeMode=false, bool loopMode=false, float gain=1.0f, float gainMax=1.0f, float gainMin=0.0f, float innerConeAngle=360.0f, float outerConeAngle=360.0f, float coneOuterGain=0.0f, float pitch=1.0f, float referenceDistance=1.0f, float maxDistance=std::numeric_limits< float >::max(), float rollOffFactor=1.0f, bool enabled=true)
 SourceAL (const SO< Iterator< SO< BufferAL > > > &buffers, const SO< SceneThing > &sceneThing, const Vector &velocity=Vector::origin, const Vector &direction=Vector::origin, bool relativeMode=false, bool loopMode=false, float gain=1.0f, float gainMax=1.0f, float gainMin=0.0f, float innerConeAngle=360.0f, float outerConeAngle=360.0f, float coneOuterGain=0.0f, float pitch=1.0f, float referenceDistance=1.0f, float maxDistance=std::numeric_limits< float >::max(), float rollOffFactor=1.0f, bool enabled=true)
 ~SourceAL (void)
void setSceneThing (const SO< SceneThing > &sceneThing)
SO< SceneThinggetSceneThing (void) const
void attachBuffer (const SO< BufferAL > &buffer)
void queueBuffer (const SO< BufferAL > &buffer)
SO< BufferALunqueueBuffer (void)
void queueBuffers (const SO< Iterator< SO< BufferAL > > > &buffers)
SO< Iterator< SO< BufferAL > > > unqueueBuffers (void)
void unqueueAllBuffers (void)
unsigned int getQueuedBuffers (void) const
unsigned int getProcessedBuffers (void) const
void play (void)
bool isPlaying (void) const
void stop (void)
bool isStopped (void) const
void pause (void)
bool isPaused (void) const
void rewind (void)
bool isInitial (void) const
void setPosition (const VRS::Vector &position)
const VectorgetPosition (void) const
void setVelocity (const VRS::Vector &velocity)
const VectorgetVelocity (void) const
void setDirection (const VRS::Vector &direction)
const VectorgetDirection (void) const
void setGain (float gain)
float getGain (void) const
void setGainMin (float gainMin)
float getGainMin (void) const
void setGainMax (float gainMax)
float getGainMax (void) const
void setConeOuterGain (float coneOuterGain)
float getConeOuterGain (void) const
void setReferenceDistance (float referenceDistance)
float getReferenceDistance (void) const
void setMaxDistance (float maxDistance)
float getMaxDistance (void) const
void setRollOffFactor (float rollOffFactor)
float getRollOffFactor (void) const
void setPitch (float pitch)
float getPitch (void) const
void setInnerConeAngle (float innerConeAngle)
float getInnerConeAngle (void) const
void setOuterConeAngle (float outerConeAngle)
float getOuterConeAngle (void) const
void setRelativeMode (bool relativeMode)
bool getRelativeMode (void) const
void setLoopMode (bool loopMode)
bool getLoopMode (void) const
void setSecondOffset (float secondOffset)
float getSecondOffset (void) const
void setSampleOffset (float sampleOffset)
float getSampleOffset (void) const
void setByteOffset (float byteOffset)
float getByteOffset (void) const
SourceType getSourceType (void) const
SourceState getSourceState (void) const
bool isValid (void) const
unsigned int getName (void) const
 VRS_TYPEINFO (SourceAL, PolyAttribute)
 VRS_SERIALIZABLE (SourceAL)


Member Enumeration Documentation

Enumerator:
UNDETERMINED 
STATIC 
STREAMING 

Enumerator:
INITIAL 
PLAYING 
PAUSED 
STOPPED 


Constructor & Destructor Documentation

VRS::SOUND::SourceAL::SourceAL ( const Vector position = Vector::origin,
const Vector velocity = Vector::origin,
const Vector direction = Vector::origin,
bool  relativeMode = false,
bool  loopMode = false,
float  gain = 1.0f,
float  gainMax = 1.0f,
float  gainMin = 0.0f,
float  innerConeAngle = 360.0f,
float  outerConeAngle = 360.0f,
float  coneOuterGain = 0.0f,
float  pitch = 1.0f,
float  referenceDistance = 1.0f,
float  maxDistance = std::numeric_limits< float >::max(),
float  rollOffFactor = 1.0f,
bool  enabled = true 
)

VRS::SOUND::SourceAL::SourceAL ( const SO< BufferAL > &  buffer,
const Vector position = Vector::origin,
const Vector velocity = Vector::origin,
const Vector direction = Vector::origin,
bool  relativeMode = false,
bool  loopMode = false,
float  gain = 1.0f,
float  gainMax = 1.0f,
float  gainMin = 0.0f,
float  innerConeAngle = 360.0f,
float  outerConeAngle = 360.0f,
float  coneOuterGain = 0.0f,
float  pitch = 1.0f,
float  referenceDistance = 1.0f,
float  maxDistance = std::numeric_limits< float >::max(),
float  rollOffFactor = 1.0f,
bool  enabled = true 
)

VRS::SOUND::SourceAL::SourceAL ( const SO< Iterator< SO< BufferAL > > > &  buffers,
const Vector position = Vector::origin,
const Vector velocity = Vector::origin,
const Vector direction = Vector::origin,
bool  relativeMode = false,
bool  loopMode = false,
float  gain = 1.0f,
float  gainMax = 1.0f,
float  gainMin = 0.0f,
float  innerConeAngle = 360.0f,
float  outerConeAngle = 360.0f,
float  coneOuterGain = 0.0f,
float  pitch = 1.0f,
float  referenceDistance = 1.0f,
float  maxDistance = std::numeric_limits< float >::max(),
float  rollOffFactor = 1.0f,
bool  enabled = true 
)

VRS::SOUND::SourceAL::SourceAL ( const SO< BufferAL > &  buffer,
const SO< SceneThing > &  sceneThing,
const Vector velocity = Vector::origin,
const Vector direction = Vector::origin,
bool  relativeMode = false,
bool  loopMode = false,
float  gain = 1.0f,
float  gainMax = 1.0f,
float  gainMin = 0.0f,
float  innerConeAngle = 360.0f,
float  outerConeAngle = 360.0f,
float  coneOuterGain = 0.0f,
float  pitch = 1.0f,
float  referenceDistance = 1.0f,
float  maxDistance = std::numeric_limits< float >::max(),
float  rollOffFactor = 1.0f,
bool  enabled = true 
)

VRS::SOUND::SourceAL::SourceAL ( const SO< Iterator< SO< BufferAL > > > &  buffers,
const SO< SceneThing > &  sceneThing,
const Vector velocity = Vector::origin,
const Vector direction = Vector::origin,
bool  relativeMode = false,
bool  loopMode = false,
float  gain = 1.0f,
float  gainMax = 1.0f,
float  gainMin = 0.0f,
float  innerConeAngle = 360.0f,
float  outerConeAngle = 360.0f,
float  coneOuterGain = 0.0f,
float  pitch = 1.0f,
float  referenceDistance = 1.0f,
float  maxDistance = std::numeric_limits< float >::max(),
float  rollOffFactor = 1.0f,
bool  enabled = true 
)

VRS::SOUND::SourceAL::~SourceAL ( void   ) 


Member Function Documentation

VRS::SOUND::SourceAL::VRS_SERIALIZABLE_CLASS_ENUM ( SourceType   ) 

VRS::SOUND::SourceAL::VRS_SERIALIZABLE_CLASS_ENUM ( SourceState   ) 

void VRS::SOUND::SourceAL::setSceneThing ( const SO< SceneThing > &  sceneThing  ) 

SO<SceneThing> VRS::SOUND::SourceAL::getSceneThing ( void   )  const [inline]

void VRS::SOUND::SourceAL::attachBuffer ( const SO< BufferAL > &  buffer  ) 

void VRS::SOUND::SourceAL::queueBuffer ( const SO< BufferAL > &  buffer  ) 

SO<BufferAL> VRS::SOUND::SourceAL::unqueueBuffer ( void   ) 

void VRS::SOUND::SourceAL::queueBuffers ( const SO< Iterator< SO< BufferAL > > > &  buffers  ) 

The application can queue up one or multiple buffer. The buffers will be queued in the sequence in which they appear in the iterator. This command is legal on a Source in any state (to allow for streaming, queueing has to be possible on a PLAYING Source). Queues are read-only with exception of the unqueue operation. The empty Buffer can be queued.

SO<Iterator<SO<BufferAL> > > VRS::SOUND::SourceAL::unqueueBuffers ( void   ) 

Once a queue entry for a buffer has been appended to a queue and is pending processing, it should not be changed. Removal of a given queue entry is not possible unless either the Source is STOPPED (in which case then entire queue is considered processed), or if the queue entry has already been processed (PLAYING or PAUSED Source). The Unqueue command removes a number of buffers entries that have finished processing, in the order of appearance, from the queue. The operation will fail if more buffers are requested than available, leaving the destination arguments unchanged. An INVALID_VALUE error will be thrown. If no error, the destination argument will have been updated accordingly.

void VRS::SOUND::SourceAL::unqueueAllBuffers ( void   ) 

unsigned int VRS::SOUND::SourceAL::getQueuedBuffers ( void   )  const

unsigned int VRS::SOUND::SourceAL::getProcessedBuffers ( void   )  const

void VRS::SOUND::SourceAL::play ( void   ) 

State transition commands.

bool VRS::SOUND::SourceAL::isPlaying ( void   )  const

void VRS::SOUND::SourceAL::stop ( void   ) 

bool VRS::SOUND::SourceAL::isStopped ( void   )  const

void VRS::SOUND::SourceAL::pause ( void   ) 

bool VRS::SOUND::SourceAL::isPaused ( void   )  const

void VRS::SOUND::SourceAL::rewind ( void   ) 

bool VRS::SOUND::SourceAL::isInitial ( void   )  const

void VRS::SOUND::SourceAL::setPosition ( const VRS::Vector position  ) 

Set/get source position. The OpenAL listener object and source objects have attributes to describe their position, velocity and orientation in three dimensional space. OpenAL -- like OpenGL -- uses a right-handed Cartesian coordinate system (RHS), where in a frontal default view X (thumb) points right, Y (index finger) points up, and Z (middle finger) points towards the viewer/camera. To switch from a left handed coordinate system (LHS) to a right handed coordinate systems, flip the sign on the Z coordinate.

const Vector& VRS::SOUND::SourceAL::getPosition ( void   )  const [inline]

void VRS::SOUND::SourceAL::setVelocity ( const VRS::Vector velocity  ) 

Specifies the current velocity (speed and direction) of the object, in the world coordinate system. Any 3-tuple of valid float/double values is allowed. The velocity does not affect the source's position. OpenAL does not calculate the velocity from subsequent position updates, nor does it adjust the position over time based on the specified velocity. Any such calculation is left to the application. For the purposes of sound processing, position and velocity are independent parameters affecting different aspects of the sounds.

const Vector& VRS::SOUND::SourceAL::getVelocity ( void   )  const [inline]

void VRS::SOUND::SourceAL::setDirection ( const VRS::Vector direction  ) 

Set/get the emmiting direction. If the direction does not equal the zero vector, the source is directional. The sound emission is presumed to be symmetric around the direction vector (cylinder symmetry). Sources are not oriented in full 3 degrees of freedom, only two angles are effectively needed. The zero vector is default, indicating that a source is not directional. Specifying a non-zero vector will make the source directional. Specifying a zero vector for a directional source will effectively mark it as non-directional.

const Vector& VRS::SOUND::SourceAL::getDirection ( void   )  const [inline]

void VRS::SOUND::SourceAL::setGain ( float  gain  ) 

The gain defines a scalar amplitude multiplier. As a source attribute, it applies to that particular source only. As a listener attribute, it effectively applies to all sources in the current context. The default 1.0 means that the sound is unattenuated. An gain value of 0.5 is equivalent to an attenuation of 6 dB. The value zero equals silence (no contribution to the output mix). A gain larger than one (i.e. amplification) is permitted for source and listener.

float VRS::SOUND::SourceAL::getGain ( void   )  const [inline]

void VRS::SOUND::SourceAL::setGainMin ( float  gainMin  ) 

Set/get the lower bound for the source gain. It is a scalar amplitude threshold. It indicates the minimal gain that is always guaranteed for this source. At the end of the processing of various attenuation factors such as distance based attenuation and source gain, the effective gain calculated is compared to this value. If the effective gain is lower than minimal gain, the minimal gain is applied. This happens before the listener gain is applied. If the minimal gein is zero, then the effective gain will not be corrected.

float VRS::SOUND::SourceAL::getGainMin ( void   )  const [inline]

void VRS::SOUND::SourceAL::setGainMax ( float  gainMax  ) 

Set/get the upper bound the source gai. It defines a scalar amplitude threshold. It indicates the maximal gain permitted for this source. At the end of the processing of various attenuation factors such as distance based attenuation and source gain, the effective gain calculated is compared to this value. If the effective gain is higher than maximal gain, the maximal gain is applied. This happens before the listener gain is applied. If a zero maximal gain is set, then the source is effectively muted.

float VRS::SOUND::SourceAL::getGainMax ( void   )  const [inline]

void VRS::SOUND::SourceAL::setConeOuterGain ( float  coneOuterGain  ) 

Description: the factor with which the source gain is multiplied to determine the effective gain outside the cone defined by the outer angle. The effective gain applied outside the outer cone is the gain times the outer gain. Changing the sources gain affects all directions, i.e. the source is attenuated in all directions, for any position of the listener. The application has to change the outer gain as well if a different behavior is desired.

float VRS::SOUND::SourceAL::getConeOuterGain ( void   )  const [inline]

void VRS::SOUND::SourceAL::setReferenceDistance ( float  referenceDistance  ) 

Set/get the reference distance. This is used for distance attenuation calculations based on inverse distance with rolloff. Depending on the distance model it will also act as a distance threshold below which gain is clamped.

float VRS::SOUND::SourceAL::getReferenceDistance ( void   )  const [inline]

void VRS::SOUND::SourceAL::setMaxDistance ( float  maxDistance  ) 

This is used for distance attenuation calculations based on inverse distance with rolloff, if the Inverse Clamped Distance Model is used. In this case, distances greater than the maximal distance will be clamped to this maximal distance. The maximal distance based clamping is applied before the minimal gain clamping, so if the effective gain at the maximal distance is larger than the minimal gain, this gain setting will have no effect. No culling is supported.

float VRS::SOUND::SourceAL::getMaxDistance ( void   )  const [inline]

void VRS::SOUND::SourceAL::setRollOffFactor ( float  rollOffFactor  ) 

Set/get the rolloff factor. This is used for distance attenuation calculations based on inverse distance with rolloff. For distances smaller than the maximal distance (and, depending on the distance model, larger than the reference distance), this will scale the distance attenuation over the applicable range.

In particular, the rolloff factor can be set to zero for those sources that are supposed to be exempt from distance attenuation.

float VRS::SOUND::SourceAL::getRollOffFactor ( void   )  const [inline]

void VRS::SOUND::SourceAL::setPitch ( float  pitch  ) 

Desired pitch shift, where 1.0 equals identity. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value.

float VRS::SOUND::SourceAL::getPitch ( void   )  const [inline]

void VRS::SOUND::SourceAL::setInnerConeAngle ( float  innerConeAngle  ) 

Set/get the inner cone angle. It describes Inside angle of the sound cone, in degrees. The default of 360 means that the inner angle covers the entire world, which is equivalent to an omni-directional source.

float VRS::SOUND::SourceAL::getInnerConeAngle ( void   )  const [inline]

void VRS::SOUND::SourceAL::setOuterConeAngle ( float  outerConeAngle  ) 

Set/get the outer cone angle. Description: Outer angle of the sound cone, in degrees. The default of 360 means that the outer angle covers the entire world. If the inner angle is also 360, then the zone for angle-dependent attenuation is zero.

float VRS::SOUND::SourceAL::getOuterConeAngle ( void   )  const [inline]

void VRS::SOUND::SourceAL::setRelativeMode ( bool  relativeMode  ) 

Set/get the relative mode. This mode indicates that the position, velocity, cone, and direction properties of a source are to be interpreted relative to the listener position.

bool VRS::SOUND::SourceAL::getRelativeMode ( void   )  const [inline]

void VRS::SOUND::SourceAL::setLoopMode ( bool  loopMode  ) 

Set/get the loop mode. It is a flag that indicates that the source will not be in STOPPED state once it reaches the end of last buffer in the buffer queue. Instead, the source will immediately promote to INITIAL and PLAYING. The default value is FALSE. Looping can be changed on a source in any execution state. In particular, it can be changed on a playing source.

bool VRS::SOUND::SourceAL::getLoopMode ( void   )  const [inline]

void VRS::SOUND::SourceAL::setSecondOffset ( float  secondOffset  ) 

Set/get the second offset for a source. Description: the playback position, expressed in seconds (the value will loop back to zero for looping sources). When setting on a source which is already playing, the playback will jump to the new offset unless the new offset is out of range, in which case an error occur. If the source is not playing, then the offset will be applied on the next play call.

The position is relative to the beginning of all the queued buffers for the source, and any queued buffers traversed by a set call will be marked as processed.

This value is based on byte position, so a pitch-shifted source will have an exaggerated playback speed. For example, you can be 0.500 seconds into a buffer having taken only 0.250 seconds to get there if the pitch is set to 2.0.

float VRS::SOUND::SourceAL::getSecondOffset ( void   )  const [inline]

void VRS::SOUND::SourceAL::setSampleOffset ( float  sampleOffset  ) 

Set/get the sample offset. Description: the playback position, expressed in samples (the value will loop back to zero for looping sources). For a compressed format, this value will represent an exact offset within the uncompressed data.

When setting on a source which is already playing, the playback will jump to the new offset unless the new offset is out of range, in which case an error occur. If the source is not playing, then the offset will be applied on the next play call. An stop, rewind, or a second play call will reset the offset to the beginning of the buffer.

The position is relative to the beginning of all the queued buffers for the source, and any queued buffers traversed by a set call will be marked as processed.

float VRS::SOUND::SourceAL::getSampleOffset ( void   )  const [inline]

void VRS::SOUND::SourceAL::setByteOffset ( float  byteOffset  ) 

Set/get the byte offset. Description: the playback position, expressed in bytes (the value will loop back to zero for looping sources). For a compressed format, this value may represent an approximate offset within the compressed data buffer.

When setting on a source which is already playing, the playback will jump to the new offset unless the new offset is out of range, in which case an error occur. If the source is not playing, then the offset will be applied on the next alSourcePlay call. An stop, rewind, or a second play call will reset the offset to the beginning of the buffer.

The position is relative to the beginning of all the queued buffers for the source, and any queued buffers traversed by a set call will be marked as processed.

float VRS::SOUND::SourceAL::getByteOffset ( void   )  const [inline]

SourceType VRS::SOUND::SourceAL::getSourceType ( void   )  const

The source type is a read-only property indicating whether a source is ready to queue buffers, ready to use a static buffer, or is in an undetermined state where it can be used for either streaming or static playback.

When first created, a source will be in the UNDETERMINED state. If a buffer is then attached, then the source will enter the STATIC state. If the first buffer attached to a source is attached as queue buffers, then the source will enter the STREAMING state.

SourceState VRS::SOUND::SourceAL::getSourceState ( void   )  const

Query the source state. Each source can be in one of four possible execution states: INITIAL, PLAYING, PAUSED, STOPPED. Sources that are either PLAYING or PAUSED are considered active. Sources that are STOPPED or INITIAL are considered inactive. Only PLAYING sources are included in the processing. The implementation is free to skip those processing stages for sources that have no effect on the output (e.g. mixing for a source muted by zero gain, but not sample offset increments). Depending on the current state of a source certain (e.g. repeated) state transition commands are legal NOPs: they will be ignored, no error is generated.

bool VRS::SOUND::SourceAL::isValid ( void   )  const

Verifies whether a source is valid.

unsigned int VRS::SOUND::SourceAL::getName ( void   )  const [inline]

VRS::SOUND::SourceAL::VRS_TYPEINFO ( SourceAL  ,
PolyAttribute   
)

VRS::SOUND::SourceAL::VRS_SERIALIZABLE ( SourceAL   ) 


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

Generated on Sun May 19 06:00:49 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact