cAudio
2.3.0
3d Audio Engine
|
11 #include "cOpenALUtil.h"
13 #include "cEFXFunctions.h"
14 #include "cMemoryOverride.h"
15 #include "IAudioSource.h"
18 #include "cSTLAllocator.h"
19 #include "IAudioDeviceContext.h"
48 virtual void setStrength(
const float& soundstrength);
52 virtual void setPitch(
const float& pitch);
53 virtual void setVolume(
const float& volume);
118 #if CAUDIO_EFX_ENABLED == 1
126 virtual bool play2d(
const bool& toLoop =
false);
127 virtual bool play3d(
const cVector3& position,
const float& soundstr = 1.0 ,
const bool& toLoop =
false);
129 virtual void pause();
131 virtual void loop(
const bool& toLoop);
132 virtual bool seek(
const float& seconds,
bool relative =
false);
152 #if CAUDIO_EFX_ENABLED == 1
153 virtual unsigned int getNumEffectSlotsAvailable()
const;
154 virtual bool attachEffect(
unsigned int slot, IEffect* effect);
155 virtual void removeEffect(
unsigned int slot);
157 virtual bool attachFilter(IFilter* filter);
158 virtual void removeFilter();
165 bool stream(ALuint buffer);
168 ALuint Buffers[CAUDIO_SOURCE_NUM_BUFFERS];
183 #if CAUDIO_EFX_ENABLED == 1
187 void updateFilter(
bool remove =
false);
189 void updateEffect(
unsigned int slot,
bool remove =
false);
192 IEffect* Effects[CAUDIO_SOURCE_MAX_EFFECT_SLOTS];
194 unsigned int LastEffectTimeStamp[CAUDIO_SOURCE_MAX_EFFECT_SLOTS];
199 unsigned int LastFilterTimeStamp;
202 unsigned int EffectSlotsAvailable;
IAudioDeviceContext * Context
The context that owns this source.
virtual float getOuterConeVolume() const
Returns how much the volume of the source is scaled in the outer cone.
virtual cVector3 getVelocity() const
Returns the audio objects velocity.
virtual void stop()
Stops playback of the sound source.
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 sourc...
virtual bool play2d(const bool &toLoop=false)
Plays the source in 2D mode.
virtual float getStrength() const
Returns the strength of the source.
Overrides the memory allocations for classes derived from it and makes them use the cAudio memory sys...
virtual void setMaxAttenuationDistance(const float &maxDistance)
Sets the distance from the source where attenuation will stop.
virtual float getCurrentAudioTime()
Returns the current position in the audio stream in seconds. See IAudioDecoder for details.
virtual void setMinDistance(const float &minDistance)
Sets the distance from the source where attenuation will begin.
cAudioMutex Mutex
Mutex for thread synchronization.
Interface for all Audio Decoders in cAudio.
virtual void setOuterConeVolume(const float &outerVolume)
Sets how much the volume of the source is scaled in the outer cone.
virtual void setDopplerVelocity(const cVector3 &dvelocity)
Overrides the doppler velocity vector. It is usually better to let the engine take care of it automat...
virtual void setDirection(const cVector3 &direction)
Sets the direction the source is facing.
virtual bool isPaused() const
Returns if the source is paused.
virtual void setPosition(const cVector3 &position)
Sets the position of the source in 3D space.
virtual int getCurrentAudioPosition()
Returns the current position in the decoded audio stream in bytes. See IAudioDecoder for details.
interface for a sample (audio buffer): completely loaded into memory, shareable across sources
virtual float calculateGain() const
Return gain, taking into account volume as well as distance attenuation.
Class for manipulating vectors in 3D space.
virtual void loop(const bool &toLoop)
Controls whether the source should loop or not.
Main namespace for the entire cAudio library.
virtual float getDopplerStrength() const
Returns the doppler strength, which enhances or diminishes the doppler effect.
virtual bool isRelative() const
Return true for 2d sounds, false for 3d sounds.
virtual bool isPlaying() const
Returns if the source is playing.
virtual float getInnerConeAngle() const
Returns the angle of the inner sound cone of the source.
virtual void pause()
Pauses playback of the sound source.
virtual bool seek(const float &seconds, bool relative=false)
Seeks through the audio stream to a specific spot.
virtual bool play3d(const cVector3 &position, const float &soundstr=1.0, const bool &toLoop=false)
Plays the source in 3D mode.
virtual void unRegisterAllEventHandlers()
Removes all event handlers attached to this source.
ALuint Source
OpenAL source.
virtual void setVolume(const float &volume)
Sets the source volume before attenuation and other effects.
virtual bool isLooping() const
Returns if the source is looping.
virtual int getCompressedAudioSize()
Returns the original size of the audio stream. See IAudioDecoder for details.
virtual void setRolloffFactor(const float &rolloff)
Sets the factor used in attenuating the source over distance.
Interface for event handlers on Audio Sources.
virtual float getMaxDistance() const
Returns the distance from the source where attenuation will stop.
virtual float getMinDistance() const
Returns the distance from the source where attenuation will begin.
virtual void registerEventHandler(ISourceEventHandler *handler)
Registers a new event handler to this source.
virtual void setPitch(const float &pitch)
Sets the pitch of the source.
virtual bool update()
Normally called every frame by the audio manager to update the internal buffers. Note: For internal u...
cAudioVector< ISourceEventHandler * >::Type eventHandlerList
List of registered event handlers.
virtual void setDopplerStrength(const float &dstrength)
Sets the doppler strength, which enhances or diminishes the doppler effect. Can be used to exaggerate...
virtual bool play()
Plays the source with the last set parameters.
virtual float getRolloffFactor() const
Returns the factor used in attenuating the source over distance.
virtual float getTotalAudioTime()
Returns the total amount of time in the audio stream. See IAudioDecoder for details.
virtual int getCurrentCompressedAudioPosition()
Returns the current position in the original audio stream in bytes. See IAudioDecoder for details.
virtual void move(const cVector3 &position)
Convenience function to automatically set the velocity and position for you in a single call.
virtual float getPitch() const
Returns the pitch of the source.
virtual float getMinVolume() const
Returns the minimum volume that the source can be attenuated to.
virtual void setVelocity(const cVector3 &velocity)
Sets the current velocity of the source for doppler effects.
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 sourc...
virtual cVector3 getDirection() const
Returns the audio objects direction.
virtual void setMaxVolume(const float &maxVolume)
Sets the maximum volume that the source can achieve.
float Volume
Holds the current volume.
virtual float getVolume() const
Returns the source volume before attenuation and other effects.
Interface for a single audio source, which allow you to manipulate sound sources (speakers) in 2D or ...
virtual cVector3 getDopplerVelocity() const
Returns the override for the doppler velocity vector.
void signalEvent(Events sevent)
Signals a event to all event handlers.
virtual float getMaxVolume() const
Returns the maximum volume that the source can achieve.
virtual int getTotalAudioSize()
Returns the total decoded size of the audio stream. See IAudioDecoder for details.
virtual void unRegisterEventHandler(ISourceEventHandler *handler)
Removes a specified event handler from this source.
virtual void setStrength(const float &soundstrength)
Sets how well the source carries over distance.
virtual bool drop()
Decrements the reference count by one. If it hits zero, this object is deleted.
virtual bool isValid() const
Returns if the source is ready to be used.
virtual void setMinVolume(const float &minVolume)
Sets the minimum volume that the source can be attenuated to.
virtual IAudioBuffer * getBuffer()
Get the audio buffer associated with the source.
virtual bool isStopped() const
Returns if the source is stopped.
virtual cVector3 getPosition() const
Returns the audio objects position.
virtual float getOuterConeAngle() const
Returns the angle of the outer sound cone of the source.
virtual bool setBuffer(IAudioBuffer *buffer)
Change the audio buffer associated with the source.