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