My Project
Public Member Functions | Public Attributes | List of all members
ParaScripting::ParaAudioSource Class Reference

It represents a 2D or 3D audio source object. More...

#include <ParaScriptingAudio.h>

Public Member Functions

 ParaAudioSource (CAudioSource2_ptr &pSource)
 
bool IsValid () const
 true if valid
 
void release ()
 stop and unload this audio source from memory. More...
 
bool play ()
 Plays the source with the last set parameters. More...
 
const char * GetName ()
 get the source name. More...
 
bool play2d (bool toLoop)
 Plays the source in 2D mode. More...
 
bool play3d (float x, float y, float z, float soundstr, bool toLoop)
 Plays the source in 3D mode. More...
 
void pause ()
 Pauses playback of the sound source.
 
void stop ()
 Stops playback of the sound source.
 
void loop (bool toLoop)
 Controls whether the source should loop or not. More...
 
bool seek (float seconds, bool relative)
 Seeks through the audio stream to a specific spot. More...
 
float getTotalAudioTime ()
 
int getTotalAudioSize ()
 
float getCurrentAudioTime ()
 
int getCurrentAudioPosition ()
 
bool isValid () const
 
bool isPlaying () const
 
bool isPaused () const
 
bool isStopped () const
 
bool isLooping () const
 
void setPosition (float x, float y, float z)
 Sets the position of the source in 3D space. More...
 
void setVelocity (float x, float y, float z)
 Sets the current velocity of the source for doppler effects. More...
 
void setDirection (float x, float y, float z)
 Sets the direction the source is facing. More...
 
void setRolloffFactor (float rolloff)
 Sets the factor used in attenuating the source over distance. More...
 
void setStrength (float soundstrength)
 Sets how well the source carries over distance. More...
 
void setMinDistance (float minDistance)
 Sets the distance from the source where attenuation will begin. More...
 
void setMaxDistance (float maxDistance)
 Sets the distance from the source where attenuation will stop. More...
 
void setPitch (float pitch)
 Sets the pitch of the source. More...
 
void setVolume (float volume)
 Sets the source volume before attenuation and other effects. More...
 
void setMinVolume (float minVolume)
 Sets the minimum volume that the source can be attenuated to. More...
 
void setMaxVolume (float maxVolume)
 Sets the maximum volume that the source can achieve. More...
 
void setInnerConeAngle (float innerAngle)
 Sets the angle of the inner sound cone of the source. More...
 
void setOuterConeAngle (float outerAngle)
 Sets the angle of the outer sound cone of the source. More...
 
void setOuterConeVolume (float outerVolume)
 Sets how much the volume of the source is scaled in the outer cone. More...
 
void move (float x, float y, float z)
 Convenience function to automatically set the velocity and position for you in a single call. More...
 
void getPosition (float &x, float &y, float &z) const
 
void getVelocity (float &x, float &y, float &z) const
 
void getDirection (float &x, float &y, float &z) const
 
float getRolloffFactor () const
 
float getStrength () const
 
float getMinDistance () const
 
float getMaxDistance () const
 
float getPitch () const
 
float getVolume () const
 
float getMinVolume () const
 
float getMaxVolume () const
 
float getInnerConeAngle () const
 
float getOuterConeAngle () const
 
float getOuterConeVolume () const
 

Public Attributes

CAudioSource2_ptr m_pAudioSource
 

Detailed Description

It represents a 2D or 3D audio source object.

Member Function Documentation

§ getCurrentAudioPosition()

int ParaScripting::ParaAudioSource::getCurrentAudioPosition ( )
Returns
the current position in the decoded audio stream in bytes. See IAudioDecoder for details.

§ getCurrentAudioTime()

float ParaScripting::ParaAudioSource::getCurrentAudioTime ( )
Returns
the current position in the audio stream in seconds. See IAudioDecoder for details.

§ getDirection()

void ParaScripting::ParaAudioSource::getDirection ( float &  x,
float &  y,
float &  z 
) const
Returns
the audio objects direction

§ getInnerConeAngle()

float ParaScripting::ParaAudioSource::getInnerConeAngle ( ) const
Returns
the angle of the inner sound cone of the source

§ getMaxDistance()

float ParaScripting::ParaAudioSource::getMaxDistance ( ) const
Returns
the distance from the source where attenuation will stop

§ getMaxVolume()

float ParaScripting::ParaAudioSource::getMaxVolume ( ) const
Returns
the maximum volume that the source can achieve

§ getMinDistance()

float ParaScripting::ParaAudioSource::getMinDistance ( ) const
Returns
the distance from the source where attenuation will begin

§ getMinVolume()

float ParaScripting::ParaAudioSource::getMinVolume ( ) const
Returns
the minimum volume that the source can be attenuated to

§ GetName()

const char * ParaScripting::ParaAudioSource::GetName ( )

get the source name.

(this may not be the file name)

§ getOuterConeAngle()

float ParaScripting::ParaAudioSource::getOuterConeAngle ( ) const
Returns
the angle of the outer sound cone of the source

§ getOuterConeVolume()

float ParaScripting::ParaAudioSource::getOuterConeVolume ( ) const
Returns
how much the volume of the source is scaled in the outer cone

§ getPitch()

float ParaScripting::ParaAudioSource::getPitch ( ) const
Returns
the pitch of the source

§ getPosition()

void ParaScripting::ParaAudioSource::getPosition ( float &  x,
float &  y,
float &  z 
) const
Returns
the audio objects position

§ getRolloffFactor()

float ParaScripting::ParaAudioSource::getRolloffFactor ( ) const
Returns
the factor used in attenuating the source over distance

§ getStrength()

float ParaScripting::ParaAudioSource::getStrength ( ) const
Returns
the strength of the source

§ getTotalAudioSize()

int ParaScripting::ParaAudioSource::getTotalAudioSize ( )
Returns
the total decoded size of the audio stream. See IAudioDecoder for details.

§ getTotalAudioTime()

float ParaScripting::ParaAudioSource::getTotalAudioTime ( )
Returns
the total amount of time in the audio stream. See IAudioDecoder for details.

§ getVelocity()

void ParaScripting::ParaAudioSource::getVelocity ( float &  x,
float &  y,
float &  z 
) const
Returns
the audio objects velocity

§ getVolume()

float ParaScripting::ParaAudioSource::getVolume ( ) const
Returns
the source volume before attenuation and other effects

§ isLooping()

bool ParaScripting::ParaAudioSource::isLooping ( ) const
Returns
if the source is looping.

§ isPaused()

bool ParaScripting::ParaAudioSource::isPaused ( ) const
Returns
if the source is paused.

§ isPlaying()

bool ParaScripting::ParaAudioSource::isPlaying ( ) const
Returns
if the source is playing.

§ isStopped()

bool ParaScripting::ParaAudioSource::isStopped ( ) const
Returns
if the source is stopped.

§ isValid()

bool ParaScripting::ParaAudioSource::isValid ( ) const
Returns
if the source is ready to be used.

§ loop()

void ParaScripting::ParaAudioSource::loop ( bool  toLoop)

Controls whether the source should loop or not.

Parameters
toLoopWhether to loop (restart) the audio when the end is reached.

§ move()

void ParaScripting::ParaAudioSource::move ( float  x,
float  y,
float  z 
)

Convenience function to automatically set the velocity and position for you in a single call.

Velocity will be set to new position - last position.

Parameters
positionPosition to move the source to.

§ play()

bool ParaScripting::ParaAudioSource::play ( )

Plays the source with the last set parameters.

Returns
True if the source is playing, false if not.

§ play2d()

bool ParaScripting::ParaAudioSource::play2d ( bool  toLoop)

Plays the source in 2D mode.

No automatic attenuation or panning will take place in this mode, but using setPosition will allow you to manually pan mono audio streams.

Parameters
toLoopWhether to loop (restart) the audio when the end is reached.
Returns
True if the source is playing, false if not.

§ play3d()

bool ParaScripting::ParaAudioSource::play3d ( float  x,
float  y,
float  z,
float  soundstr,
bool  toLoop 
)

Plays the source in 3D mode.

Parameters
positionPosition to start the sound off at.
soundstrAffects how the source attenuates due to distance. Higher values cause the source to stand out more over distance.
toLoopWhether to loop (restart) the audio when the end is reached.
Returns
True if the source is playing, false if not.

§ release()

void ParaScripting::ParaAudioSource::release ( )

stop and unload this audio source from memory.

It will make the sound source invalid after calling this function. it is good practice to unload unused sound.

§ seek()

bool ParaScripting::ParaAudioSource::seek ( float  seconds,
bool  relative 
)

Seeks through the audio stream to a specific spot.

Note: May not be supported by all codecs.

Parameters
secondsNumber of seconds to seek.
relativeWhether to seek from the current position or the start of the stream.
Returns
True on success, False if the codec does not support seeking.

§ setDirection()

void ParaScripting::ParaAudioSource::setDirection ( float  x,
float  y,
float  z 
)

Sets the direction the source is facing.

Parameters
directionA 3D vector giving the direction that the source is aiming.

§ setInnerConeAngle()

void ParaScripting::ParaAudioSource::setInnerConeAngle ( float  innerAngle)

Sets the angle of the inner sound cone of the source.

The cone opens up in the direction of the source as set by setDirection(). Note: This causes the sound to be loudest only if the listener is inside this cone. Range: 0.0f to 360.0f (Default: 360.0f).

Parameters
innerAngleInside angle of the cone.

§ setMaxDistance()

void ParaScripting::ParaAudioSource::setMaxDistance ( float  maxDistance)

Sets the distance from the source where attenuation will stop.

Range: 0.0f to +inf

Parameters
maxDistanceDistance where attenuation will cease. Normally the farthest range you can hear the source.

§ setMaxVolume()

void ParaScripting::ParaAudioSource::setMaxVolume ( float  maxVolume)

Sets the maximum volume that the source can achieve.

Range: 0.0f to +inf (Default: 1.0f).

Parameters
maxVolumeNew maximum volume of the source.

§ setMinDistance()

void ParaScripting::ParaAudioSource::setMinDistance ( float  minDistance)

Sets the distance from the source where attenuation will begin.

Range: 0.0f to +inf

Parameters
minDistanceDistance from the source where attenuation begins.

§ setMinVolume()

void ParaScripting::ParaAudioSource::setMinVolume ( float  minVolume)

Sets the minimum volume that the source can be attenuated to.

Range: 0.0f to +inf (Default: 0.0f).

Parameters
minVolumeNew minimum volume of the source.

§ setOuterConeAngle()

void ParaScripting::ParaAudioSource::setOuterConeAngle ( float  outerAngle)

Sets the angle of the outer sound cone of the source.

The cone opens up in the direction of the source as set by setDirection(). Note: If the listener is outside of this cone, the sound cannot be heard. Between the inner cone angle and this angle, the sound volume will fall off. Range: 0.0f to 360.0f (Default: 360.0f).

Parameters
outerAngleOutside angle of the cone.

§ setOuterConeVolume()

void ParaScripting::ParaAudioSource::setOuterConeVolume ( float  outerVolume)

Sets how much the volume of the source is scaled in the outer cone.

Range: 0.0f to +inf (Default: 0.0f).

Parameters
outerVolumeVolume of the source in the outside cone.

§ setPitch()

void ParaScripting::ParaAudioSource::setPitch ( float  pitch)

Sets the pitch of the source.

Range: 0.0f to +inf (Default: 1.0f)

Parameters
pitchNew pitch level. Note that higher values will speed up the playback of the sound.

§ setPosition()

void ParaScripting::ParaAudioSource::setPosition ( float  x,
float  y,
float  z 
)

Sets the position of the source in 3D space.

Parameters
positionA 3D vector giving the new location to put this source.

§ setRolloffFactor()

void ParaScripting::ParaAudioSource::setRolloffFactor ( float  rolloff)

Sets the factor used in attenuating the source over distance.

Larger values make it attenuate faster, smaller values make the source carry better. Range: 0.0f to +inf (Default: 1.0f).

Parameters
rolloffThe rolloff factor to apply to the attenuation calculation.

§ setStrength()

void ParaScripting::ParaAudioSource::setStrength ( float  soundstrength)

Sets how well the source carries over distance.

Same as setRolloffFactor(1.0f/soundstrength). Range: 0.0f to +inf (Default: 1.0f).

Parameters
soundstrengthHow well the sound carries over distance.

§ setVelocity()

void ParaScripting::ParaAudioSource::setVelocity ( float  x,
float  y,
float  z 
)

Sets the current velocity of the source for doppler effects.

Parameters
velocityA 3D vector giving the speed and direction that the source is moving.

§ setVolume()

void ParaScripting::ParaAudioSource::setVolume ( float  volume)

Sets the source volume before attenuation and other effects.

Range: 0.0f to +inf (Default: 1.0f).

Parameters
volumeNew volume of the source.

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