My Project
|
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 |
It represents a 2D or 3D audio source object.
int ParaScripting::ParaAudioSource::getCurrentAudioPosition | ( | ) |
float ParaScripting::ParaAudioSource::getCurrentAudioTime | ( | ) |
void ParaScripting::ParaAudioSource::getDirection | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
float ParaScripting::ParaAudioSource::getInnerConeAngle | ( | ) | const |
float ParaScripting::ParaAudioSource::getMaxDistance | ( | ) | const |
float ParaScripting::ParaAudioSource::getMaxVolume | ( | ) | const |
float ParaScripting::ParaAudioSource::getMinDistance | ( | ) | const |
float ParaScripting::ParaAudioSource::getMinVolume | ( | ) | const |
const char * ParaScripting::ParaAudioSource::GetName | ( | ) |
get the source name.
(this may not be the file name)
float ParaScripting::ParaAudioSource::getOuterConeAngle | ( | ) | const |
float ParaScripting::ParaAudioSource::getOuterConeVolume | ( | ) | const |
float ParaScripting::ParaAudioSource::getPitch | ( | ) | const |
void ParaScripting::ParaAudioSource::getPosition | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
float ParaScripting::ParaAudioSource::getRolloffFactor | ( | ) | const |
float ParaScripting::ParaAudioSource::getStrength | ( | ) | const |
int ParaScripting::ParaAudioSource::getTotalAudioSize | ( | ) |
float ParaScripting::ParaAudioSource::getTotalAudioTime | ( | ) |
void ParaScripting::ParaAudioSource::getVelocity | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
float ParaScripting::ParaAudioSource::getVolume | ( | ) | const |
bool ParaScripting::ParaAudioSource::isLooping | ( | ) | const |
bool ParaScripting::ParaAudioSource::isPaused | ( | ) | const |
bool ParaScripting::ParaAudioSource::isPlaying | ( | ) | const |
bool ParaScripting::ParaAudioSource::isStopped | ( | ) | const |
bool ParaScripting::ParaAudioSource::isValid | ( | ) | const |
void ParaScripting::ParaAudioSource::loop | ( | bool | toLoop | ) |
Controls whether the source should loop or not.
toLoop | Whether to loop (restart) the audio when the end is reached. |
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.
position | Position to move the source to. |
bool ParaScripting::ParaAudioSource::play | ( | ) |
Plays the source with the last set parameters.
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.
toLoop | Whether to loop (restart) the audio when the end is reached. |
bool ParaScripting::ParaAudioSource::play3d | ( | float | x, |
float | y, | ||
float | z, | ||
float | soundstr, | ||
bool | toLoop | ||
) |
Plays the source in 3D mode.
position | Position to start the sound off at. |
soundstr | Affects how the source attenuates due to distance. Higher values cause the source to stand out more over distance. |
toLoop | Whether to loop (restart) the audio when the end is reached. |
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.
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.
seconds | Number of seconds to seek. |
relative | Whether to seek from the current position or the start of the stream. |
void ParaScripting::ParaAudioSource::setDirection | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the direction the source is facing.
direction | A 3D vector giving the direction that the source is aiming. |
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).
innerAngle | Inside angle of the cone. |
void ParaScripting::ParaAudioSource::setMaxDistance | ( | float | maxDistance | ) |
Sets the distance from the source where attenuation will stop.
Range: 0.0f to +inf
maxDistance | Distance where attenuation will cease. Normally the farthest range you can hear the source. |
void ParaScripting::ParaAudioSource::setMaxVolume | ( | float | maxVolume | ) |
Sets the maximum volume that the source can achieve.
Range: 0.0f to +inf (Default: 1.0f).
maxVolume | New maximum volume of the source. |
void ParaScripting::ParaAudioSource::setMinDistance | ( | float | minDistance | ) |
Sets the distance from the source where attenuation will begin.
Range: 0.0f to +inf
minDistance | Distance from the source where attenuation begins. |
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).
minVolume | New minimum volume of the source. |
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).
outerAngle | Outside angle of the cone. |
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).
outerVolume | Volume of the source in the outside cone. |
void ParaScripting::ParaAudioSource::setPitch | ( | float | pitch | ) |
Sets the pitch of the source.
Range: 0.0f to +inf (Default: 1.0f)
pitch | New pitch level. Note that higher values will speed up the playback of the sound. |
void ParaScripting::ParaAudioSource::setPosition | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the position of the source in 3D space.
position | A 3D vector giving the new location to put this source. |
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).
rolloff | The rolloff factor to apply to the attenuation calculation. |
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).
soundstrength | How well the sound carries over distance. |
void ParaScripting::ParaAudioSource::setVelocity | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the current velocity of the source for doppler effects.
velocity | A 3D vector giving the speed and direction that the source is moving. |
void ParaScripting::ParaAudioSource::setVolume | ( | float | volume | ) |
Sets the source volume before attenuation and other effects.
Range: 0.0f to +inf (Default: 1.0f).
volume | New volume of the source. |