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;
virtual int getCurrentAudioPosition()
Returns the current position in the decoded audio stream in bytes. See IAudioDecoder for details.
virtual float getMaxVolume() const
Returns the maximum volume that the source can achieve.
virtual void unRegisterEventHandler(ISourceEventHandler *handler)
Removes a specified event handler from this source.
virtual bool update()
Normally called every frame by the audio manager to update the internal buffers. Note: For internal u...
virtual float getMaxDistance() const
Returns the distance from the source where attenuation will stop.
virtual float getPitch() const
Returns the pitch of the 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 void setPosition(const cVector3 &position)
Sets the position of the source in 3D space.
virtual bool play2d(const bool &toLoop=false)
Plays the source in 2D mode.
virtual cVector3 getVelocity() const
Returns the audio objects velocity.
virtual void setMinDistance(const float &minDistance)
Sets the distance from the source where attenuation will begin.
virtual float getDopplerStrength() const
Returns the doppler strength, which enhances or diminishes the doppler effect.
virtual void unRegisterAllEventHandlers()
Removes all event handlers attached to this source.
virtual void pause()
Pauses playback of the sound source.
virtual void stop()
Stops playback of the sound source.
virtual void setMaxAttenuationDistance(const float &maxDistance)
Sets the distance from the source where attenuation will stop.
virtual bool play3d(const cVector3 &position, const float &soundstr=1.0, const bool &toLoop=false)
Plays the source in 3D mode.
virtual float getOuterConeVolume() const
Returns how much the volume of the source is scaled in the outer cone.
virtual void setPitch(const float &pitch)
Sets the pitch of the source.
virtual bool seek(const float &seconds, bool relative=false)
Seeks through the audio stream to a specific spot.
virtual float getRolloffFactor() const
Returns the factor used in attenuating the source 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 bool isStopped() const
Returns if the source is stopped.
cAudioVector< ISourceEventHandler * >::Type eventHandlerList
List of registered event handlers.
virtual int getCurrentCompressedAudioPosition()
Returns the current position in the original audio stream in bytes. See IAudioDecoder for details.
virtual cVector3 getPosition() const
Returns the audio objects position.
virtual void move(const cVector3 &position)
Convenience function to automatically set the velocity and position for you in a single call.
virtual void setDirection(const cVector3 &direction)
Sets the direction the source is facing.
virtual float getCurrentAudioTime()
Returns the current position in the audio stream in seconds. See IAudioDecoder for details.
Interface for a single audio source, which allow you to manipulate sound sources (speakers) in 2D or ...
virtual int getTotalAudioSize()
Returns the total decoded size of the audio stream. See IAudioDecoder for details.
virtual bool isPaused() const
Returns if the source is paused.
virtual float getStrength() const
Returns the strength of the source.
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 cVector3 getDopplerVelocity() const
Returns the override for the doppler velocity vector.
virtual float getOuterConeAngle() const
Returns the angle of the outer sound cone of the source.
cAudioMutex Mutex
Mutex for thread synchronization.
virtual void setDopplerStrength(const float &dstrength)
Sets the doppler strength, which enhances or diminishes the doppler effect. Can be used to exaggerate...
virtual bool isRelative() const
Return true for 2d sounds, false for 3d sounds.
Interface for event handlers on Audio Sources.
IAudioDeviceContext * Context
The context that owns this source.
virtual float getMinVolume() const
Returns the minimum volume that the source can be attenuated to.
Class for manipulating vectors in 3D space.
virtual void setVelocity(const cVector3 &velocity)
Sets the current velocity of the source for doppler effects.
ALuint Source
OpenAL source.
virtual float calculateGain() const
Return gain, taking into account volume as well as distance attenuation.
virtual IAudioBuffer * getBuffer()
Get the audio buffer associated with the source.
virtual bool play()
Plays the source with the last set parameters.
virtual float getTotalAudioTime()
Returns the total amount of time in the audio stream. See IAudioDecoder for details.
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 void setMinVolume(const float &minVolume)
Sets the minimum volume that the source can be attenuated to.
virtual void setStrength(const float &soundstrength)
Sets how well the source carries over distance.
virtual void loop(const bool &toLoop)
Controls whether the source should loop or not.
interface for a sample (audio buffer): completely loaded into memory, shareable across sources
virtual bool isLooping() const
Returns if the source is looping.
float Volume
Holds the current volume.
virtual int getCompressedAudioSize()
Returns the original size of the audio stream. See IAudioDecoder for details.
virtual float getVolume() const
Returns the source volume before attenuation and other effects.
virtual void setVolume(const float &volume)
Sets the source volume before attenuation and other effects.
virtual cVector3 getDirection() const
Returns the audio objects direction.
virtual void registerEventHandler(ISourceEventHandler *handler)
Registers a new event handler to this source.
virtual void setMaxVolume(const float &maxVolume)
Sets the maximum volume that the source can achieve.
Overrides the memory allocations for classes derived from it and makes them use the cAudio memory sys...
Interface for all Audio Decoders in cAudio.
virtual float getMinDistance() const
Returns the distance from the source where attenuation will begin.
virtual void setRolloffFactor(const float &rolloff)
Sets the factor used in attenuating the source over distance.
virtual bool setBuffer(IAudioBuffer *buffer)
Change the audio buffer associated with the source.
virtual float getInnerConeAngle() const
Returns the angle of the inner sound cone of the source.
void signalEvent(Events sevent)
Signals a event to all event handlers.
Main namespace for the entire cAudio library.
virtual bool isPlaying() const
Returns if the source is playing.