cAudio  2.3.0
3d Audio Engine
Public Member Functions | List of all members
cAudio::cAudioStaticSource Class Reference
Inheritance diagram for cAudio::cAudioStaticSource:
Inheritance graph
[legend]
Collaboration diagram for cAudio::cAudioStaticSource:
Collaboration graph
[legend]

Public Member Functions

 cAudioStaticSource (IAudioBuffer *buffer, IAudioDeviceContext *context)
 
bool setBuffer (IAudioBuffer *buffer)
 Change the audio buffer associated with the source. More...
 
IAudioBuffergetBuffer ()
 Get the audio buffer associated with the source. More...
 
bool play ()
 Plays the source with the last set parameters. More...
 
bool play2d (const bool &toLoop)
 Plays the source in 2D mode. More...
 
bool play3d (const cVector3 &position, const float &soundstr, const 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 (const bool &toLoop)
 Controls whether the source should loop or not. More...
 
bool seek (const float &seconds, bool relative)
 Seeks through the audio stream to a specific spot. More...
 
float getTotalAudioTime ()
 Returns the total amount of time in the audio stream. See IAudioDecoder for details.
 
int getTotalAudioSize ()
 Returns the total decoded size of the audio stream. See IAudioDecoder for details.
 
int getCompressedAudioSize ()
 Returns the original size of the audio stream. See IAudioDecoder for details.
 
float getCurrentAudioTime ()
 Returns the current position in the audio stream in seconds. See IAudioDecoder for details.
 
int getCurrentAudioPosition ()
 Returns the current position in the decoded audio stream in bytes. See IAudioDecoder for details.
 
int getCurrentCompressedAudioPosition ()
 Returns the current position in the original audio stream in bytes. See IAudioDecoder for details.
 
bool update ()
 Normally called every frame by the audio manager to update the internal buffers. Note: For internal use only.
 
bool isValid () const
 Returns if the source is ready to be used.
 
bool isLooping () const
 Returns if the source is looping.
 
- Public Member Functions inherited from cAudio::cAudioSourceBase
 cAudioSourceBase (IAudioDeviceContext *context)
 
virtual bool isPlaying () const
 Returns if the source is playing.
 
virtual bool isPaused () const
 Returns if the source is paused.
 
virtual bool isStopped () const
 Returns if the source is stopped.
 
virtual void setPosition (const cVector3 &position)
 Sets the position of the source in 3D space. More...
 
virtual void setVelocity (const cVector3 &velocity)
 Sets the current velocity of the source for doppler effects. More...
 
virtual void setDirection (const cVector3 &direction)
 Sets the direction the source is facing. More...
 
virtual void setRolloffFactor (const float &rolloff)
 Sets the factor used in attenuating the source over distance. More...
 
virtual void setStrength (const float &soundstrength)
 Sets how well the source carries over distance. More...
 
virtual void setMinDistance (const float &minDistance)
 Sets the distance from the source where attenuation will begin. More...
 
virtual void setMaxAttenuationDistance (const float &maxDistance)
 Sets the distance from the source where attenuation will stop. More...
 
virtual void setPitch (const float &pitch)
 Sets the pitch of the source. More...
 
virtual void setVolume (const float &volume)
 Sets the source volume before attenuation and other effects. More...
 
virtual void setMinVolume (const float &minVolume)
 Sets the minimum volume that the source can be attenuated to. More...
 
virtual void setMaxVolume (const float &maxVolume)
 Sets the maximum volume that the source can achieve. More...
 
virtual void setInnerConeAngle (const 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(). More...
 
virtual void setOuterConeAngle (const 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(). More...
 
virtual void setOuterConeVolume (const float &outerVolume)
 Sets how much the volume of the source is scaled in the outer cone. More...
 
virtual void setDopplerStrength (const float &dstrength)
 Sets the doppler strength, which enhances or diminishes the doppler effect. Can be used to exaggerate the doppler for a special effect. More...
 
virtual void setDopplerVelocity (const cVector3 &dvelocity)
 Overrides the doppler velocity vector. It is usually better to let the engine take care of it automatically. More...
 
virtual void move (const cVector3 &position)
 Convenience function to automatically set the velocity and position for you in a single call. More...
 
virtual cVector3 getPosition () const
 Returns the audio objects position.
 
virtual cVector3 getVelocity () const
 Returns the audio objects velocity.
 
virtual cVector3 getDirection () const
 Returns the audio objects direction.
 
virtual float getRolloffFactor () const
 Returns the factor used in attenuating the source over distance.
 
virtual float getStrength () const
 Returns the strength of the source.
 
virtual float getMinDistance () const
 Returns the distance from the source where attenuation will begin.
 
virtual float getMaxDistance () const
 Returns the distance from the source where attenuation will stop.
 
virtual bool isRelative () const
 Return true for 2d sounds, false for 3d sounds.
 
virtual float calculateGain () const
 Return gain, taking into account volume as well as distance attenuation.
 
virtual float getPitch () const
 Returns the pitch of the source.
 
virtual float getVolume () const
 Returns the source volume before attenuation and other effects.
 
virtual float getMinVolume () const
 Returns the minimum volume that the source can be attenuated to.
 
virtual float getMaxVolume () const
 Returns the maximum volume that the source can achieve.
 
virtual float getInnerConeAngle () const
 Returns the angle of the inner sound cone of the source.
 
virtual float getOuterConeAngle () const
 Returns the angle of the outer sound cone of the source.
 
virtual float getOuterConeVolume () const
 Returns how much the volume of the source is scaled in the outer cone.
 
virtual float getDopplerStrength () const
 Returns the doppler strength, which enhances or diminishes the doppler effect.
 
virtual cVector3 getDopplerVelocity () const
 Returns the override for the doppler velocity vector.
 
virtual void registerEventHandler (ISourceEventHandler *handler)
 Registers a new event handler to this source. More...
 
virtual void unRegisterEventHandler (ISourceEventHandler *handler)
 Removes a specified event handler from this source. More...
 
virtual void unRegisterAllEventHandlers ()
 Removes all event handlers attached to this source.
 
- Public Member Functions inherited from cAudio::IRefCounted
virtual void grab ()
 Increments the reference count by one.
 
virtual bool drop ()
 Decrements the reference count by one. If it hits zero, this object is deleted.
 
int getReferenceCount () const
 Returns the current reference count of this object.
 
- Public Member Functions inherited from cAudio::cMemoryOverride
void * operator new (size_t size, const char *file, int line, const char *function)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *pointer)
 
void * operator new[] (size_t size, const char *file, int line, const char *function)
 
void * operator new[] (size_t size)
 
void operator delete (void *pointer)
 
void operator delete (void *pointer, void *)
 
void operator delete (void *pointer, const char *, int, const char *)
 
void operator delete[] (void *pointer)
 
void operator delete[] (void *pointer, const char *, int, const char *)
 

Additional Inherited Members

- Public Types inherited from cAudio::cAudioSourceBase
enum  Events {
  ON_UPDATE, ON_RELEASE, ON_PLAY, ON_PAUSE,
  ON_STOP
}
 
- Protected Member Functions inherited from cAudio::cAudioSourceBase
void signalEvent (Events sevent)
 Signals a event to all event handlers.
 
- Protected Attributes inherited from cAudio::cAudioSourceBase
cAudioMutex Mutex
 Mutex for thread synchronization.
 
IAudioDeviceContextContext
 The context that owns this source.
 
float Volume
 Holds the current volume.
 
ALuint Source
 OpenAL source.
 
ALenum oldState
 
cAudioVector< ISourceEventHandler * >::Type eventHandlerList
 List of registered event handlers.
 
- Protected Attributes inherited from cAudio::IRefCounted
int RefCount
 

Detailed Description

Definition at line 88 of file cAudioStaticSource.h.

Member Function Documentation

◆ getBuffer()

IAudioBuffer* cAudio::cAudioStaticSource::getBuffer ( )
inlinevirtual

Get the audio buffer associated with the source.

Returns
buffer on succes, NULL if no buffer or sample is streaming

Implements cAudio::IAudioSource.

Definition at line 123 of file cAudioStaticSource.h.

◆ loop()

void cAudio::cAudioStaticSource::loop ( const bool &  toLoop)
inlinevirtual

Controls whether the source should loop or not.

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

Implements cAudio::IAudioSource.

Definition at line 175 of file cAudioStaticSource.h.

◆ play()

bool cAudio::cAudioStaticSource::play ( )
inlinevirtual

Plays the source with the last set parameters.

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

Implements cAudio::IAudioSource.

Definition at line 128 of file cAudioStaticSource.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ play2d()

bool cAudio::cAudioStaticSource::play2d ( const bool &  toLoop)
inlinevirtual

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.

Implements cAudio::IAudioSource.

Definition at line 138 of file cAudioStaticSource.h.

Here is the call graph for this function:

◆ play3d()

bool cAudio::cAudioStaticSource::play3d ( const cVector3 position,
const float &  soundstr,
const bool &  toLoop 
)
inlinevirtual

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.

Implements cAudio::IAudioSource.

Definition at line 146 of file cAudioStaticSource.h.

Here is the call graph for this function:

◆ seek()

bool cAudio::cAudioStaticSource::seek ( const float &  seconds,
bool  relative 
)
inlinevirtual

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.

Implements cAudio::IAudioSource.

Definition at line 181 of file cAudioStaticSource.h.

Here is the call graph for this function:

◆ setBuffer()

bool cAudio::cAudioStaticSource::setBuffer ( IAudioBuffer buffer)
inlinevirtual

Change the audio buffer associated with the source.

Note: Only supported on sources created with createFromBuffer() or createForBuffer()

Returns
True on success, False if the sample does not support setting buffers or is currently playing

Implements cAudio::IAudioSource.

Definition at line 105 of file cAudioStaticSource.h.

Here is the call graph for this function:

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