Work on documenting the library for doxygen.

This commit is contained in:
Joshua Jones 2010-02-17 01:42:45 +00:00
parent 857f2012b4
commit 7c8aa15ea2
34 changed files with 1075 additions and 450 deletions

View File

@ -34,87 +34,39 @@ namespace cAudio
//! Checks to see if capturing audio is supported by OpenAL
bool checkCaptureExtension();
//! Initializes the capture device to the selected settings
/** Note that calling this will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
\param deviceName: Name of the audio device to capture audio from, pass NULL to specify the default one
\param frequency: Frequency that the captured audio will be at in hz
\param format: Format of the captured audio
\param internalBufferSize: Size of the internal OpenAL buffer used to store the captured audio between calls to getCapturedAudio() in bytes.
\return True on success, False if the capture device failed to initialize.
*/
virtual bool initialize(const char* deviceName = 0x0, unsigned int frequency = 22050, AudioFormats format = EAF_16BIT_MONO, unsigned int internalBufferSize = 8192);
//! Returns true if the current OpenAL implementation supports capturing audio
virtual bool isSupported() { return Supported; }
//! Returns true if the capture device is ready to be used. False may indicate an error with the current settings.
virtual bool isReady() { return Ready; }
//! Grabs samples from the OpenAL buffer into the capture buffer. Should be run once every audio frame.
virtual void updateCaptureBuffer(bool force = false);
//! Shuts down the capture device
virtual void shutdown();
//! Returns the name of an available capturing device.
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 ) */
virtual const char* getAvailableDeviceName(unsigned int index);
//! Returns the number of capture devices available for use.
virtual unsigned int getAvailableDeviceCount();
//! Returns the name of the default system capturing device.
virtual const char* getDefaultDeviceName();
//! Returns the name of the audio device being used to capture audio
virtual const char* getDeviceName() { return DeviceName.c_str(); }
//! Returns the frequency that the captured audio will be at
virtual unsigned int getFrequency() { return Frequency; }
//! Returns the format of the captured audio
virtual AudioFormats getFormat() { return Format; }
//! Returns the internal OpenAL buffer size in bytes
virtual unsigned int getInternalBufferSize() { return InternalBufferSize; }
//! Returns the size of a "sample" of audio data. Useful for making sure you grab audio data at sample boundaries
virtual unsigned int getSampleSize() { return SampleSize; }
//! Sets the audio device . Will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
/** \return True on success, False if the capture device failed to initialize. */
virtual bool setDevice(const char* deviceName);
//! Sets the frequency that the captured audio will be at. Will cause the capture device to be reinitialized. Calling while in use may lead to a loss of audio data.
/** \return True on success, False if the capture device failed to initialize. */
virtual bool setFrequency(unsigned int frequency);
//! Sets the format that the captured audio will be at. Will cause the capture device to be reinitialized. Calling while in use may lead to a loss of audio data.
/** \return True on success, False if the capture device failed to initialize. */
virtual bool setFormat(AudioFormats format);
//! Sets the internal buffer size that OpenAL will use to store captured audio between calls to IAudioManager::update() in bytes. Will cause the capture device to be reinitialized. Calling while in use may lead to a loss of audio data.
/** \return True on success, False if the capture device failed to initialize. */
virtual bool setInternalBufferSize(unsigned int internalBufferSize);
//! Starts capturing audio data to an internal buffer. Will clear any old data in the buffer.
/** \return True if capture was successfully started. */
virtual bool beginCapture();
//! Stops capturing audio data to an internal buffer. Will copy any remaining audio data to the capture buffer.
virtual void stopCapture();
//! Allows access to the audio data in the internal capture buffer
/** Can be called at any time to retrieve recorded audio. It is recommended that you call it every so often to prevent the internal buffer from growing too large.
Once successfully retrieved, the captured audio will be deleted from the internal buffer.
\param outputBuffer: Pointer to an output array to copy audio data to.
\param outputBufferSize: Size of the output array in bytes
*/
virtual unsigned int getCapturedAudio(void* outputBuffer, unsigned int outputBufferSize);
//! Returns the current size of the internal audio buffer in bytes
virtual unsigned int getCurrentCapturedAudioSize();
//! Grabs a list of available devices, as well as the default system one
void getAvailableDevices();
//!Registers a new event handler to audio capture
virtual void registerEventHandler(ICaptureEventHandler* handler);
//!Unregisters specified event handler from audio capture
virtual void unRegisterEventHandler(ICaptureEventHandler* handler);
//!Unregisters all event handlers attached to audio capture
virtual void unRegisterAllEventHandlers();
private:
void signalEvent(Events sevent);
protected:
//Mutex for thread syncronization
cAudioMutex Mutex;
bool initOpenALDevice();
@ -137,10 +89,9 @@ namespace cAudio
std::string DeviceName;
ALCdevice* CaptureDevice;
//! Check for OpenAL errors
bool checkError();
//Converts our audio format enum to OpenAL's
ALenum convertAudioFormatEnum(AudioFormats format);
void signalEvent(Events sevent);
};
};

View File

@ -55,9 +55,9 @@ namespace cAudio
virtual sCompressorParameters getCompressorEffectPreset(const char* name);
virtual sEqualizerParameters getEqualizerEffectPreset(const char* name);
virtual void removePreset(const EffectTypes& type, const char* name);
virtual bool isPresetRegistered(const EffectTypes& type, const char* name);
virtual void removeAllPresets(const EffectTypes& type);
virtual void removeEffectPreset(const EffectTypes& type, const char* name);
virtual bool isEffectPresetRegistered(const EffectTypes& type, const char* name);
virtual void removeAllEffectPresets(const EffectTypes& type);
cEFXFunctions* getEFXInterface();
void checkEFXSupportDetails();

View File

@ -38,47 +38,25 @@ namespace cAudio
cAudioManager() : Device(NULL), Context(NULL), EFXSupported(false), Initialized(false) { }
virtual ~cAudioManager() { }
//!Inits the audio manager calling the alut/etc start ups
virtual bool initialize(const char* deviceName = 0x0, int outputFrequency = -1, int eaxEffectSlots = 4);
//!Shuts everything down
virtual void shutDown();
//!Updates the cAudio playback
virtual bool initialize(const char* deviceName = 0x0, int outputFrequency = -1, int eaxEffectSlots = 4);
virtual void shutDown();
virtual void update();
//!Gets you the cAudio object you want
virtual IAudioSource* getSoundByName(const char* name);
//!Releases "ALL" cAudio objects
virtual IAudioSource* getSoundByName(const char* name);
virtual void releaseAllSources();
//!Releases a single cAudio source
virtual void release(IAudioSource* source);
//! Returns the name of an available playback device.
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 ) */
virtual const char* getAvailableDeviceName(unsigned int index);
//! Returns the number of playback devices available for use.
virtual unsigned int getAvailableDeviceCount();
//! Returns the name of the default system playback device.
virtual const char* getDefaultDeviceName();
//!Creates the cAudio object
virtual IAudioSource* create(const char* name, const char* filename, bool stream = false);
//!Loads data from memory or virtual file system
virtual IAudioSource* createFromMemory(const char* name, const char* data, size_t length, const char* extension);
//!Loads raw audio from memory.
virtual IAudioSource* createFromRaw(const char* name, const char* data, size_t length, unsigned int frequency, AudioFormats format);
//!Register Audio Codec
virtual bool registerAudioDecoder(IAudioDecoderFactory* factory, const char* extension);
//!Unregister Audio Codec (allows you to prevent an file type from being playable with new sound sources)
//!Note that all current sound sources will still continue to use any currently allocated decoders.
//!Will NOT delete any user added factory instance, you must do that yourself
virtual void unRegisterAudioDecoder(const char* extension);
//!Returns whether an audio decoder is currently registered for this file type
virtual bool isAudioDecoderRegistered(const char* extension);
//!Returns a registered audio decoder factory
virtual IAudioDecoderFactory* getAudioDecoderFactory(const char* extension);
//!Unregisters all Audio Codecs
//!Note that all current sound sources will still continue to use any currently allocated decoders.
//!Will NOT delete any user added factory instance, you must do that yourself
virtual void unRegisterAllAudioDecoders();
virtual bool registerDataSource(IDataSourceFactory* factory, const char* name, int priority);
@ -87,11 +65,8 @@ namespace cAudio
virtual IDataSourceFactory* getDataSourceFactory(const char* name);
virtual void unRegisterAllDataSources();
//!Registers a new event handler to the manager
virtual void registerEventHandler(IManagerEventHandler* handler);
//!Unregisters specified event handler from manager
virtual void unRegisterEventHandler(IManagerEventHandler* handler) ;
//!Unregisters all event handlers attached to the manager
virtual void unRegisterAllEventHandlers();
//! Grabs a list of available devices, as well as the default system one
@ -104,18 +79,18 @@ namespace cAudio
#endif
private:
//Mutex for thread syncronization
//! Mutex for thread syncronization
cAudioMutex Mutex;
//Make a Openal context pointer
//! An OpenAL context pointer
ALCcontext* Context;
//Make a openal device pointer
//! An OpenAL device pointer
ALCdevice* Device;
//Holds whether EFX is supported
//! Holds whether EFX is supported
bool EFXSupported;
//Whether the manager is currently initialized and ready to go.
//! Whether the manager is currently initialized and ready to go.
bool Initialized;
//! Holds an index for fast searching of audio sources by name
@ -140,7 +115,7 @@ namespace cAudio
std::vector<std::string> AvailableDevices;
std::string DefaultDevice;
//Signals a event to all event handlers
//! Signals a event to all event handlers
void signalEvent(Events sevent);
//! List of all attached event handlers

View File

@ -38,209 +38,133 @@ namespace cAudio
#endif
~cAudioSource();
//! Plays the source with the default or last set values
virtual bool play();
//! Plays the source in 2D mode
virtual bool play2d(const bool& toLoop = false);
//! Plays the source in 3D mode
virtual bool play3d(const cVector3& position, const float& soundstr = 1.0 , const bool& toLoop = false);
//! Pauses playback of the sound source
virtual void pause();
//! Stops playback of the sound source
virtual void pause();
virtual void stop();
//! Controls whether the source should loop or not
virtual void loop(const bool& toLoop);
//! Seeks through the audio stream to a specific spot
/** Note: May not be supported by all codecs
\param seconds: Number of seconds to seek
\param relative: Whether to seek from the current position or the start of the stream
\return True on success, False if the codec does not support seeking. */
virtual bool seek(const float& seconds, bool relative = false);
//! Normally called every frame by the audio manager to update the internal buffers
//! Note: For internal use only.
virtual bool update();
//! Releases all resources used by the audio source, normally used to clean up before deletion
//! Note: For internal use only.
virtual void release();
//! Returns if the source is ready to be used
virtual const bool isValid() const;
//! Returns if the source is playing
virtual const bool isPlaying() const;
//! Returns if the source is paused
virtual const bool isPaused() const;
//! Returns if the source is stopped
virtual const bool isStopped() const;
//! Returns if the source is looping
virtual const bool isLooping() const;
//! Sets the position of the source in 3D space
virtual void setPosition(const cVector3& position);
//! Sets the current velocity of the source for doppler effects
virtual void setVelocity(const cVector3& velocity);
//! Sets the direction the source is facing
virtual void setDirection(const cVector3& direction);
//! 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)
virtual void setRolloffFactor(const float& rolloff);
//! Sets how well the source carries over distance
//! Same as setRolloffFactor(1.0f/soundstrength)
//! Range: 0.0f to +inf (Default: 1.0f)
virtual void setStrength(const float& soundstrength);
//! Sets the distance from the source where attenuation will begin
//! Range: 0.0f to +inf
virtual void setMinDistance(const float& minDistance);
//! Sets the distance from the source where attenuation will stop
//! Range: 0.0f to +inf
virtual void setMaxDistance(const float& maxDistance);
//! Sets the pitch of the source
virtual void setPitch(const float& pitch);
//! Sets the source volume before attenuation and other effects
//! Range: 0.0f to +inf (Default: 1.0f)
virtual void setVolume(const float& volume);
//! Sets the minimum volume that the source can be attenuated to
//! Range: 0.0f to +inf (Default: 0.0f)
virtual void setMinVolume(const float& minVolume);
//! Sets the maximum volume that the source can achieve
//! Range: 0.0f to +inf (Default: 1.0f)
virtual void setMaxVolume(const float& maxVolume);
//! Sets the angle of the inner sound cone of the source
//! 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)
virtual void setInnerConeAngle(const float& innerAngle);
//! Sets the angle of the outer sound cone of the source
//! 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)
virtual void setOuterConeAngle(const float& outerAngle);
//! Sets how much the volume of the source is scaled in the outer cone
//! Range: 0.0f to +inf (Default: 0.0f)
virtual void setOuterConeVolume(const float& outerVolume);
//! Sets the doppler strength, which enhances or diminishes the doppler effect
//! Range: 0.0f to +inf (Default: 1.0f)
virtual void setDopplerStrength(const float& dstrength);
//! Overrides the doppler velocity vector
virtual void setDopplerVelocity(const cVector3& dvelocity);
//! Convenience function to automatically set the velocity and position for you in a single call
//! Velocity will be set to new position - last position
virtual void move(const cVector3& position);
//!Returns the audio objects position
virtual const cVector3 getPosition() const;
//!Returns the audio objects velocity
virtual const cVector3 getVelocity() const;
//!Returns the audio objects direction
virtual const cVector3 getDirection() const;
//! Returns the factor used in attenuating the source over distance
virtual const float getRolloffFactor() const;
//! Returns the strength of the source
virtual const float getStrength() const;
//! Returns the distance from the source where attenuation will begin
virtual const float getMinDistance() const;
//! Returns the distance from the source where attenuation will stop
virtual const float getMaxDistance() const;
//!Returns the pitch of the source
virtual const float getPitch() const;
//!Returns the source volume before attenuation and other effects
virtual const float getVolume() const;
//! Returns the minimum volume that the source can be attenuated to
virtual const float getMinVolume() const;
//! Returns the maximum volume that the source can achieve
virtual const float getMaxVolume() const;
//! Returns the angle of the inner sound cone of the source
virtual const float getInnerConeAngle() const;
//! Returns the angle of the outer sound cone of the source
virtual const float getOuterConeAngle() const;
//! Returns how much the volume of the source is scaled in the outer cone
virtual const float getOuterConeVolume() const;
//!Returns the doppler strength, which enhances or diminishes the doppler effect
virtual const float getDopplerStrength() const;
//!Returns the override for the doppler velocity vector
virtual const cVector3 getDopplerVelocity() const;
//!Registers a new event handler to source
virtual void registerEventHandler(ISourceEventHandler* handler);
//!Unregisters specified event handler from source
virtual void unRegisterEventHandler(ISourceEventHandler* handler);
//!Unregisters all event handlers attached to source
virtual void unRegisterAllEventHandlers();
#ifdef CAUDIO_EFX_ENABLED
//! Returns the number of effects at one time this source can support
virtual unsigned int getNumEffectSlotsAvailable() const;
//! Attaches an EFX audio effect to this sound source to a specific slot
//! Range (slot): 0 to getNumEffectSlotsAvailable()
virtual bool attachEffect(unsigned int slot, IEffect* effect);
//! Removes an EFX audio effect from this sound source
//! Range (slot): 0 to getNumEffectSlotsAvailable()
virtual void removeEffect(unsigned int slot);
//! Attaches an audio filter to this sound source that will operate on the direct feed, seperate from any effects
virtual bool attachFilter(IFilter* filter);
//! Removes the previously attached filter
virtual void removeFilter();
#endif
protected:
private:
//Mutex for thread syncronization
//! Mutex for thread syncronization
cAudioMutex Mutex;
//Empties the current working buffer queue
//! Empties the current working buffer queue
void empty();
//Checks for OpenAL errors and reports them
//! Checks for OpenAL errors and reports them
bool checkError();
//Streams audio data from the decoder into a buffer
//! Streams audio data from the decoder into a buffer
bool stream(ALuint buffer);
//Signals a event to all event handlers
//! Signals a event to all event handlers
void signalEvent(Events sevent);
//Converts our audio format enum to OpenAL's
//! Converts our audio format enum to OpenAL's
ALenum convertAudioFormatEnum(AudioFormats format);
//The context that owns this source
//! The context that owns this source
ALCcontext* Context;
//Internal audio buffers
//! Internal audio buffers
ALuint Buffers[CAUDIO_SOURCE_NUM_BUFFERS];
//OpenAL source
//! OpenAL source
ALuint Source;
//cAudio decoder being used to stream data
//! cAudio decoder being used to stream data
IAudioDecoder* Decoder;
//Stores whether the source is to loop the audio stream
//! Stores whether the source is to loop the audio stream
bool Loop;
//Stores whether the source is ready to be used
//! Stores whether the source is ready to be used
bool Valid;
//! List of registered event handlers
std::list<ISourceEventHandler*> eventHandlerList;
#ifdef CAUDIO_EFX_ENABLED
//Holds pointers to all the EFX related functions
//! Holds pointers to all the EFX related functions
cEFXFunctions* EFX;
//Updates the attached filter
//! Updates the attached filter
void updateFilter(bool remove = false);
//Updates the effect attached to a specific slot
//! Updates the effect attached to a specific slot
void updateEffect(unsigned int slot, bool remove = false);
//Stores the effects attached to this source
//! Stores the effects attached to this source
IEffect* Effects[CAUDIO_SOURCE_MAX_EFFECT_SLOTS];
//! Stores the last updated time stamps for the attached effects
unsigned int LastEffectTimeStamp[CAUDIO_SOURCE_MAX_EFFECT_SLOTS];
//Stores the attached direct feed filter
//! Stores the attached direct feed filter
IFilter* Filter;
//! Stores the last updated time stamp for the attached filter
unsigned int LastFilterTimeStamp;
//Number of effects supported by the OpenAL Context
//! Number of effects supported by the OpenAL Context
unsigned int EffectSlotsAvailable;
#endif
};

View File

@ -14,7 +14,6 @@ namespace cAudio
{
public:
virtual bool OnLogMessage(const char* sender, const char* message, LogLevel level, float time);
};
};

View File

@ -43,9 +43,9 @@
#define ALC_MAX_AUXILIARY_SENDS 0x20003
#endif
// EFX Extension function pointer variables
namespace cAudio
{
//! EFX Extension function pointers and setup
struct cEFXFunctions
{
cEFXFunctions::cEFXFunctions()

View File

@ -19,27 +19,18 @@ class cFileSource : public IDataSource
cFileSource(const char* filename);
~cFileSource();
//!Returns whether the source is valid (in case of an error, like the file couldn't be found)
virtual bool isValid();
//!Get the current location in the data stream
virtual int getCurrentPos();
//!Get the total size of the data stream
virtual int getSize();
//!Read out a section of the data stream
virtual int read(void* output, int size);
//!Seek to a position in the data stream
virtual bool seek(int amount, bool relative);
protected:
//!Hold if valid
//! Holds if valid
bool Valid;
//!Holds file size
//! Holds file size
int Filesize;
//!File stream
//! File stream
FILE* pFile;
private:
};

View File

@ -32,8 +32,8 @@ namespace cAudio
{
source->read(tempbuf, length);
IDataSource* memSource = new cMemorySource(tempbuf, length, true);
delete[] tempbuf;
if(memSource && memSource->isValid())
{
source->drop();

View File

@ -18,38 +18,21 @@ namespace cAudio
MasterGain(1.f) {}
virtual ~cListener() {}
//!Sets the position of the listener
//!Note that this will automatically set velocity to 0
//!Use move() if you'd like to have cAudio automatically handle velocity for you
//!or remember to set it yourself after setPosition
virtual void setPosition(const cVector3 pos);
//!Sets the direction the listener is facing
virtual void setDirection(const cVector3 dir);
//!Sets the up vector to use for the listener
virtual void setUpVector(const cVector3 up);
//!Sets the current velocity of the listener for doppler effects
virtual void setVelocity(const cVector3 vel);
//!Sets the global volume modifier (will effect all sources)
virtual void setMasterVolume(const float volume);
//!Convenience function to automatically set the velocity for you on a move
//!Velocity will be set to new position - last position
virtual void move(const cVector3 pos);
//!Returns the current position of the listener
virtual cVector3 getPosition(void) const { return Position; }
//!Returns the current direction of the listener
virtual cVector3 getDirection(void) const { return Direction; }
//!Returns the current up vector of the listener
virtual cVector3 getUpVector(void) const { return UpVector; }
//!Returns the current velocity of the listener
virtual cVector3 getVelocity(void) const { return Velocity; }
//!Returns the global volume modifier for all sources
virtual float getMasterVolume(void) const { return MasterGain; }
#ifdef CAUDIO_EFX_ENABLED
//!Sets the meters per user world unit for use with sound effects
virtual void setMetersPerUnit(const float& meters);
//!Returns the meters per user world unit for use with sound effects
virtual float getMetersPerUnit(void) const;
#endif

View File

@ -29,16 +29,9 @@ namespace cAudio
virtual const LogLevel& getLogLevel() const { return MinLogLevel; }
virtual void setLogLevel( const LogLevel& logLevel );
//! Register Log Receiver
//! Note: Any class registered will become owned by the internal thread.
//! If threading is enabled, you MUST make the receiver threadsafe if you plan to access it in your application while it is registered
virtual bool registerLogReceiver(ILogReceiver* receiver, const char* name);
//!Unregister a Log Receiver
//!Will NOT delete any user added receiver, you must do that yourself
virtual void unRegisterLogReceiver(const char* name);
//!Returns whether an log receiver is currently registered
virtual bool isLogReceiverRegistered(const char* name);
//!Returns a registered log receiver
virtual ILogReceiver* getLogReceiver(const char* name);
protected:

View File

@ -10,28 +10,22 @@
namespace cAudio
{
//!Class used to read from a memory source.
//!If copy is true, then cMemorySource will make a copy of the data.
//!Otherwise, cMemorySource will take care of deleting the data array for you.
//!Class used to read from a memory buffer.
class cMemorySource : public IDataSource
{
public:
/** Default Constructor
\param data: Pointer to a data buffer to use.
\param size: Size of the target buffer.
\param copy: Whether to copy the buffer or use the provided pointer. On destruct, that pointer will be deleted unless copy is true.
*/
cMemorySource(const void* data, int size, bool copy);
~cMemorySource();
//!Returns whether the source is valid (in case of an error, like the file couldn't be found)
virtual bool isValid();
//!Get the current location in the data stream
virtual int getCurrentPos();
//!Get the total size of the data stream
virtual int getSize();
//!Read out a section of the data stream
virtual int read(void* output, int size);
//!Seek to a position in the data stream
virtual bool seek(int amount, bool relative);
protected:
char* Data;

View File

@ -17,8 +17,8 @@
namespace cAudio
{
//Basic mutex class used for internal thread locking
#ifdef CAUDIO_MAKE_THREAD_SAFE
//! Basic mutex class used for internal thread locking
class cAudioMutex
{
public:

View File

@ -25,35 +25,22 @@ namespace cAudio
cOggDecoder(IDataSource* stream);
~cOggDecoder();
//!Retruns the format of the audio data
virtual AudioFormats getFormat();
//!Returns the frequency of the audio data
virtual int getFrequency();
//!Returns whether seeking is supported
virtual bool isSeekingSupported();
//!Returns whether the stream is valid for this codec
virtual bool isValid();
//!Reads a section of data out of the audio stream
virtual int readAudioData(void* output, int amount);
//!Sets the position to read data out of
virtual bool setPosition(int position, bool relative);
//!If seeking is supported, will seek the stream to seconds
virtual bool seek(float seconds,bool relative);
protected:
//!Callbacks used for read memory
//! Callbacks used for read memory
ov_callbacks vorbisCallbacks;
//!some formatting data
//! Format information
vorbis_info* vorbisInfo;
//!User Comments
//! User Comments
vorbis_comment* vorbisComment;
//!Stream handle
//! Stream handle
OggVorbis_File oggStream;
bool Valid;
};

View File

@ -9,7 +9,6 @@
namespace cAudio
{
class cRawDecoder : public IAudioDecoder
{
public:
@ -17,32 +16,18 @@ namespace cAudio
cRawDecoder(IDataSource* stream, unsigned int frequency, AudioFormats format);
~cRawDecoder();
//!Retruns the format of the audio data
virtual AudioFormats getFormat();
//!Returns the frequency of the audio data
virtual int getFrequency();
//!Returns whether seeking is supported
virtual bool isSeekingSupported();
//!Returns whether the stream is valid for this codec
virtual bool isValid();
//!Reads a section of data out of the audio stream
virtual int readAudioData(void* output, int amount);
//!Sets the position to read data out of
virtual bool setPosition(int position, bool relative);
//!If seeking is supported, will seek the stream to seconds
virtual bool seek(float seconds,bool relative);
private:
unsigned int Frequency;
AudioFormats Format;
};
}
};
#endif //! CRAWDECODER_H_INCLUDED

View File

@ -12,7 +12,6 @@
namespace cAudio
{
class cWavDecoder : public IAudioDecoder
{
public:
@ -20,25 +19,12 @@ namespace cAudio
cWavDecoder(IDataSource* stream);
~cWavDecoder();
//!Retruns the format of the audio data
virtual AudioFormats getFormat();
//!Returns the frequency of the audio data
virtual int getFrequency();
//!Returns whether seeking is supported
virtual bool isSeekingSupported();
//!Returns whether the stream is valid for this codec
virtual bool isValid();
//!Reads a section of data out of the audio stream
virtual int readAudioData(void* output, int amount);
//!Sets the position to read data out of
virtual bool setPosition(int position, bool relative);
//!If seeking is supported, will seek the stream to seconds
virtual bool seek(float seconds,bool relative);
private:
@ -52,7 +38,6 @@ namespace cAudio
bool Valid;
};
};
#endif

View File

@ -326,7 +326,7 @@ sEqualizerParameters cAudioEffects::getEqualizerEffectPreset(const char* name)
return sEqualizerParameters();
}
void cAudioEffects::removePreset(const EffectTypes& type, const char* name)
void cAudioEffects::removeEffectPreset(const EffectTypes& type, const char* name)
{
cAudioMutexBasicLock lock(Mutex);
std::string safeName = safeCStr(name);
@ -376,7 +376,7 @@ void cAudioEffects::removePreset(const EffectTypes& type, const char* name)
}
}
bool cAudioEffects::isPresetRegistered(const EffectTypes& type, const char* name)
bool cAudioEffects::isEffectPresetRegistered(const EffectTypes& type, const char* name)
{
cAudioMutexBasicLock lock(Mutex);
std::string safeName = safeCStr(name);
@ -427,7 +427,7 @@ bool cAudioEffects::isPresetRegistered(const EffectTypes& type, const char* name
}
}
void cAudioEffects::removeAllPresets(const EffectTypes& type)
void cAudioEffects::removeAllEffectPresets(const EffectTypes& type)
{
switch(type)
{

View File

@ -7,7 +7,7 @@
namespace cAudio
{
//! Enumeration of audio formats supported by the engine.
enum AudioFormats
{
EAF_8BIT_MONO,

View File

@ -11,68 +11,74 @@
namespace cAudio
{
//! Interface for capturing operations in the cAudio Engine.
class IAudioCapture
{
public:
IAudioCapture() { }
virtual ~IAudioCapture() { }
//! Initializes the capture device to the selected settings
//! Initializes the capture device to the selected settings.
/** Note that calling this will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
\param deviceName: Name of the audio device to capture audio from, pass NULL to specify the default one
\param frequency: Frequency that the captured audio will be captured at in hertz
\param format: Format of the captured audio
\param deviceName: Name of the audio device to capture audio from, pass NULL to specify the default one.
\param frequency: Frequency that the captured audio will be captured at in hertz.
\param format: Format of the captured audio.
\param internalBufferSize: Size of the internal OpenAL buffer used to store the captured audio between calls to getCapturedAudio() in bytes.
\return True on success, False if the capture device failed to initialize.
*/
virtual bool initialize(const char* deviceName = 0x0, unsigned int frequency = 22050, AudioFormats format = EAF_16BIT_MONO, unsigned int internalBufferSize = 8192) = 0;
//! Returns true if the current OpenAL implementation supports capturing audio
//! Returns true if the current OpenAL implementation supports capturing audio.
virtual bool isSupported() = 0;
//! Returns true if the capture device is ready to be used. False may indicate an error with the current settings.
virtual bool isReady() = 0;
//! Grabs samples from the OpenAL buffer into the capture buffer if the OpenAL buffer has reached half full. Should be run once every audio frame, unless threading is enabled.
/** \param force: Force capturing data from the buffer, even if the buffer is not half full */
/** \param force: Force capturing data from the buffer, even if the buffer is not half full. */
virtual void updateCaptureBuffer(bool force = false) = 0;
//! Shuts down the capture device, clearing the internal buffer and setting the audio capture into an uninitialized state. You must call initialize() again in order to reuse this object.
virtual void shutdown() = 0;
//! Returns the name of an available capturing device.
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 ) */
//! Returns the name of an available capture device.
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 ).
\return Name of the selected device. */
virtual const char* getAvailableDeviceName(unsigned int index) = 0;
//! Returns the number of capture devices available for use.
/** \return Number of capture devices available. */
virtual unsigned int getAvailableDeviceCount() = 0;
//! Returns the name of the default system capturing device.
//! Returns the name of the default system playback device.
/** \return Name of the default capture device. */
virtual const char* getDefaultDeviceName() = 0;
//! Returns the name of the audio device being used to capture audio
//! Returns the name of the audio device being used to capture audio.
virtual const char* getDeviceName() = 0;
//! Returns the frequency that the captured audio will be at
//! Returns the frequency that the captured audio will be at.
virtual unsigned int getFrequency() = 0;
//! Returns the format of the captured audio
//! Returns the format of the captured audio.
virtual AudioFormats getFormat() = 0;
//! Returns the internal OpenAL buffer size in bytes
//! Returns the internal OpenAL buffer size in bytes.
/** \return Size of the buffer in bytes. */
virtual unsigned int getInternalBufferSize() = 0;
//! Returns the size of a "sample" of audio data. Useful for making sure you grab audio data at sample boundaries
//! Returns the size of a "sample" of audio data. Useful for making sure you grab audio data at sample boundaries.
/** \return Size of a sample in bytes. */
virtual unsigned int getSampleSize() = 0;
//! Sets the audio device . Will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
/**
\param deviceName: Name of the audio device to capture audio from, pass NULL to specify the default one
\param deviceName: Name of the audio device to capture audio from, pass NULL to specify the default one.
\return True on success, False if the capture device failed to initialize. */
virtual bool setDevice(const char* deviceName) = 0;
//! Sets the frequency that the captured audio will be at. Will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
/**
\param frequency: Frequency that the captured audio will be captured at in hertz
\param frequency: Frequency that the captured audio will be captured at in hertz.
\return True on success, False if the capture device failed to initialize. */
virtual bool setFrequency(unsigned int frequency) = 0;
//! Sets the format that the captured audio will be at. Will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
/**
\param format: Format of the captured audio
\param format: Format of the captured audio.
\return True on success, False if the capture device failed to initialize. */
virtual bool setFormat(AudioFormats format) = 0;
//! Sets the internal buffer size that OpenAL will use to store captured audio between calls to getCapturedAudio() in bytes. Will cause the capture device to be reinitialized. Calling while in use will clear the internal audio buffer.
/**
\param internalBufferSize: Size of the internal OpenAL buffer in bytes
\param internalBufferSize: Size of the internal OpenAL buffer in bytes.
\return True on success, False if the capture device failed to initialize. */
virtual bool setInternalBufferSize(unsigned int internalBufferSize) = 0;
@ -81,42 +87,44 @@ namespace cAudio
virtual bool beginCapture() = 0;
//! Stops capturing audio data to an internal buffer.
virtual void stopCapture() = 0;
//! Allows access to the audio data in the internal capture buffer
//! Allows access to the audio data in the internal capture buffer.
/** Can be called at any time to retrieve recorded audio. It is recommended that you call it every so often with long recordings to prevent the internal buffer from growing too large.
Once successfully retrieved, the captured audio will be deleted from the internal buffer.
\param outputBuffer: Pointer to an output array to copy audio data to.
\param outputBufferSize: Size of the output array in bytes
\param outputBufferSize: Size of the output array in bytes.
\return Size in bytes of the data actually copied to the output buffer.
*/
virtual unsigned int getCapturedAudio(void* outputBuffer, unsigned int outputBufferSize) = 0;
//! Returns the current size of the internal audio buffer in bytes
//! Returns the current size of the internal audio buffer in bytes.
virtual unsigned int getCurrentCapturedAudioSize() = 0;
//!Registers a new event handler to audio capture
//!Registers a new event handler to this manager.
/** \param handler: Pointer to an event handler to attach. */
virtual void registerEventHandler(ICaptureEventHandler* handler) = 0;
//!Unregisters specified event handler from audio capture
//!Removes the specified event handler from this manager.
/** \param handler: Pointer to an event handler to remove. */
virtual void unRegisterEventHandler(ICaptureEventHandler* handler) = 0;
//!Unregisters all event handlers attached to audio capture
//!Removes all event handlers attached to this manager.
virtual void unRegisterAllEventHandlers() = 0;
};
//! Creates an interface to an Audio Capture Object
//! Creates an interface to an Audio Capture Object.
/** Note: This is the only way to get access to the audio capture capabilities of cAudio.
You must delete this interface using destroyAudioCapture() once you are done with it.
\param initializeDefault: Whether to return an object initialized with the default settings. If set to false, you must make a call to initialize before audio can be captured
\param initializeDefault: Whether to return an object initialized with the default settings. If set to false, you must make a call to initialize before audio can be captured.
\return A pointer to the created object, NULL if the object could not be allocated.
*/
CAUDIO_API IAudioCapture* createAudioCapture(bool initializeDefault = true);
//! Destroys an interface to a previously created Audio Capture Object and frees the memory allocated for it
//! Destroys an interface to a previously created Audio Capture Object and frees the memory allocated for it.
/**
\param capture: The object to destroy
*/
CAUDIO_API void destroyAudioCapture(IAudioCapture* capture);
//! Returns if the thread used to update all Audio Capture Objects is running
//! Returns if the thread used to update all Audio Capture Objects is running.
/** Note: Will always return false if threading is disabled.
The library automatically shuts down the thread if no Audio Capture objects exist and will restart the thread on creation of a new object.
\return True if the thread is currently running, false otherwise.

View File

@ -11,33 +11,49 @@
namespace cAudio
{
//! Interface for all Audio Decoders in cAudio
class IAudioDecoder : public IRefCounted
{
public:
//! Default Constructor
/** \param stream: Data Source to attach to this decoder. */
IAudioDecoder(IDataSource* stream) : Stream(stream) { if(Stream) Stream->grab(); }
virtual ~IAudioDecoder() { if(Stream) Stream->drop(); }
//!Returns the format of the audio data
//! Returns the format of the audio data
virtual AudioFormats getFormat() = 0;
//!Returns the frequency of the audio data
//! Returns the frequency (sample rate) of the audio data
virtual int getFrequency() = 0;
//!Returns whether seeking is supported
//! Returns whether seeking is supported
virtual bool isSeekingSupported() = 0;
//!Returns whether the stream is valid for this codec
//! Returns whether the stream is valid for this codec
virtual bool isValid() = 0;
//!Reads a section of data out of the audio stream
//! Reads a section of data out of the audio stream
/**
\param output: Pointer to the buffer to put the decoded audio.
\param amount: Amount of data in bytes to ask the decoder to output.
\return Number of bytes of audio data actually output. */
virtual int readAudioData(void* output, int amount) = 0;
//!Sets the position to read data out of
//! Sets the position in the stream to read from
/**
\param position: Position to seek to.
\param relative: Whether the number in position is relative to the current position.
\return True on success, False on failure. */
virtual bool setPosition(int position, bool relative) = 0;
//!If seeking is supported, will seek the stream to seconds
//! If seeking is supported, will seek the stream to seconds
/**
\param seconds: Time in seconds to seek.
\param relative: Whether the number in position is relative to the current position.
\return True on success, False on failure. */
virtual bool seek(float seconds, bool relative) = 0;
protected:
//! Pointer to the data source to take audio data from.
IDataSource* Stream;
};
};

View File

@ -9,18 +9,21 @@
namespace cAudio
{
//! Interface for factories that create Audio Decoders for cAudio
class IAudioDecoderFactory
{
public:
IAudioDecoderFactory() {}
virtual ~IAudioDecoderFactory() {}
class IAudioDecoderFactory
{
public:
IAudioDecoderFactory() {}
virtual ~IAudioDecoderFactory() {}
virtual IAudioDecoder* CreateAudioDecoder(IDataSource* stream) = 0;
protected:
private:
};
//! Returns an audio decoder.
/**
\param stream: Data Source to attach to this decoder.
\return A pointer to a decoder instance, or NULL on failure to allocate. */
virtual IAudioDecoder* CreateAudioDecoder(IDataSource* stream) = 0;
protected:
private:
};
};
#endif //! IAUDIODECODERFACTORY_H

View File

@ -13,64 +13,222 @@
namespace cAudio
{
//! Interface for Audio Effects in cAudio.
class IAudioEffects
{
public:
IAudioEffects() {}
virtual ~IAudioEffects() {}
//*! Creates a IEffect pointer.
//! Creates an Audio Effect for use with audio sources.
/** \return Pointer to the created Effect instance. */
virtual IEffect* createEffect() = 0;
//*! Creates a IEffect pointer.
//! Creates an Audio Filter for use with audio sources.
/** \return Pointer to the created Filter instance. */
virtual IFilter* createFilter() = 0;
//*! Returns the max number of effects supported
//! Returns the max number of effects supported.
virtual unsigned int getMaxEffectsSupported() const = 0;
/*! Checks to see if the given effect type is supported
\param type: the effect type to be checked
\return True if the effect is supported, False if the effect isn't supported
*/
//! Checks to see if the given effect type is supported.
/**
\param type: the effect type to be checked.
\return True if the effect is supported, False if the effect isn't supported. */
virtual bool isEffectSupported(const EffectTypes& type) const = 0;
/*! Checks to see if the given filter type is supported
\param type: the filter type to be checked
\return True if the filter is supported, False if the filter isn't supported
*/
//! Checks to see if the given filter type is supported.
/**
\param type: the filter type to be checked.
\return True if the filter is supported, False if the filter isn't supported. */
virtual bool isFilterSupported(const FilterTypes& type) const = 0;
//! Adds a preset for the EAX Reverb Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addEAXReverbEffectPreset(const char* name, const sEAXReverbParameters& setting) = 0;
//! Adds a preset for the Reverb Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addReverbEffectPreset(const char* name, const sReverbParameters& setting) = 0;
//! Adds a preset for the Chorus Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addChorusEffectPreset(const char* name, const sChorusParameters& setting) = 0;
//! Adds a preset for the Distortion Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addDistortionEffectPreset(const char* name, const sDistortionParameters& setting) = 0;
//! Adds a preset for the Echo Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addEchoEffectPreset(const char* name, const sEchoParameters& setting) = 0;
//! Adds a preset for the Flanger Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addFlangerEffectPreset(const char* name, const sFlangerParameters& setting) = 0;
//! Adds a preset for the Frequency Shift Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addFrequencyShiftEffectPreset(const char* name, const sFrequencyShiftParameters& setting) = 0;
//! Adds a preset for the Vocal Morpher Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addVocalMorpherEffectPreset(const char* name, const sVocalMorpherParameters& setting) = 0;
//! Adds a preset for the Pitch Shifter Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addPitchShifterEffectPreset(const char* name, const sPitchShifterParameters& setting) = 0;
//! Adds a preset for the Ring Modulator Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addRingModulatorEffectPreset(const char* name, const sRingModulatorParameters& setting) = 0;
//! Adds a preset for the Autowah Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addAutowahEffectPreset(const char* name, const sAutowahParameters& setting) = 0;
//! Adds a preset for the Compressor Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addCompressorEffectPreset(const char* name, const sCompressorParameters& setting) = 0;
//! Adds a preset for the Equalizer Audio Effect type.
/**
\param name: Name of the preset.
\param setting: Instance of the Effect parameter struct for this type of effect.
\return True on success, False on failure. */
virtual bool addEqualizerEffectPreset(const char* name, const sEqualizerParameters& setting) = 0;
//! Returns a previously registered preset for the EAX Reverb Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sEAXReverbParameters getEAXReverbEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Reverb Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sReverbParameters getReverbEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Chorus Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sChorusParameters getChorusEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Distortion Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sDistortionParameters getDistortionEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Echo Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sEchoParameters getEchoEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Flanger Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sFlangerParameters getFlangerEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Frequency Shift Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sFrequencyShiftParameters getFrequencyShiftEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Vocal Morpher Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sVocalMorpherParameters getVocalMorpherEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Pitch Shifter Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sPitchShifterParameters getPitchShifterEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Ring Modulator Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sRingModulatorParameters getRingModulatorEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Autowah Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sAutowahParameters getAutowahEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Compressor Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sCompressorParameters getCompressorEffectPreset(const char* name) = 0;
//! Returns a previously registered preset for the Equalizer Effect.
/**
\param name: Name of the preset to retrieve.
\return The preset or the default parameters if the preset could not be found. */
virtual sEqualizerParameters getEqualizerEffectPreset(const char* name) = 0;
virtual void removePreset(const EffectTypes& type, const char* name) = 0;
virtual bool isPresetRegistered(const EffectTypes& type, const char* name) = 0;
virtual void removeAllPresets(const EffectTypes& type) = 0;
//! Removes a previously registered effect preset.
/**
\param type: Type of effect to remove a preset for.
\param name: Name of the preset to remove. */
virtual void removeEffectPreset(const EffectTypes& type, const char* name) = 0;
//! Returns if a effect preset of a certain name is registered.
/**
\param type: Type of the effect.
\param name: Name of the preset.
\return True if it exists, false if not. */
virtual bool isEffectPresetRegistered(const EffectTypes& type, const char* name) = 0;
//! Removes all effect presets for a specific effect type.
/**
\param type: Type of effect to remove presets for, or EET_NULL to remove all of them. */
virtual void removeAllEffectPresets(const EffectTypes& type) = 0;
protected:
private:

View File

@ -18,72 +18,159 @@ namespace cAudio
class IAudioSource;
class IAudioDecoderFactory;
//! Interface for the playback capabilities of cAudio.
class IAudioManager
{
public:
IAudioManager() { }
virtual ~IAudioManager() { }
//!Inits the audio manager calling the alut/etc start ups
//! Initializes the manager.
/**
\param deviceName: Name of the device to create this manager for.
\param outputFrequency: Frequency of the output audio or -1 for the device default.
\param eaxEffectSlots: Number of EFX effect slots to request. Has no effect if EFX is not supported or compiled out.
\return True on success, False if initialization of OpenAL failed. */
virtual bool initialize(const char* deviceName = 0x0, int outputFrequency = -1, int eaxEffectSlots = 4) = 0;
//!Shuts everything down
//! Shuts the manager down, cleaning up audio sources in the process. Does not clean up decoders, data sources, or event handlers.
virtual void shutDown() = 0;
//!Updates the cAudio playback
//! If threading is disabled, you must call this function every frame to update the playback buffers of audio sources. Otherwise it should not be called.
virtual void update() = 0;
//!Returns an IAudio object by its "name" and 0 if the name is not found
//! Returns an Audio Source by its "name" and NULL if the name is not found
/**
\param name: Name of the audio source to retrieve.
\return Pointer to the audio source object or NULL if it could not be found.*/
virtual IAudioSource* getSoundByName(const char* name) = 0;
//!Releases "ALL" cAudio objects (but does not shutdown the manager)
//! Releases ALL Audio Sources (but does not shutdown the manager)
virtual void releaseAllSources() = 0;
//!Releases a single cAudio source
//! Releases a single Audio Source, removing it from the manager.
/** \param source: Pointer to the source to release. */
virtual void release(IAudioSource* source) = 0;
//! Returns the name of an available playback device.
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 ) */
/** \param index: Specify which name to retrieve ( Range: 0 to getAvailableDeviceCount()-1 )
\return Name of the selected device. */
virtual const char* getAvailableDeviceName(unsigned int index) = 0;
//! Returns the number of playback devices available for use.
/** \return Number of playback devices available. */
virtual unsigned int getAvailableDeviceCount() = 0;
//! Returns the name of the default system playback device.
/** \return Name of the default playback device. */
virtual const char* getDefaultDeviceName() = 0;
//!Creates the cAudio object using the highest priority data source that has it
//! Creates an Audio Source object using the highest priority data source that has the referenced filename
/**
\param name: Name of the audio source.
\param filename: Path to the file to load audio data from.
\param stream: Whether to stream the audio data or load it all into a memory buffer at the start. You should consider using streaming for really large sound files.
\return A pointer to an Audio Source or NULL if creation failed.
*/
virtual IAudioSource* create(const char* name, const char* filename, bool stream = false) = 0;
//!Loads audio from memory or virtual file system
//! Creates an Audio Source from a memory buffer using a specific audio codec.
/**
\param name: Name of the audio source.
\param data: Pointer to a buffer in memory to load the data from.
\param length: Length of the data buffer.
\param extension: Extension for the audio codec of the data in the memory buffer.
\return A pointer to an Audio Source or NULL if creation failed.
*/
virtual IAudioSource* createFromMemory(const char* name, const char* data, size_t length, const char* extension) = 0;
//!Loads raw audio from memory.
//! Creates an Audio Source from raw audio data in a memory buffer.
/**
\param name: Name of the audio source.
\param data: Pointer to a buffer in memory to load the data from.
\param length: Length of the data buffer.
\param frequency: Frequency (or sample rate) of the audio data.
\param format: Format of the audio data.
\return A pointer to an Audio Source or NULL if creation failed.
*/
virtual IAudioSource* createFromRaw(const char* name, const char* data, size_t length, unsigned int frequency, AudioFormats format) = 0;
//!Register Audio Codec
//! Register an Audio Decoder.
/**
\param factory: Pointer to the factory instance to use.
\param extension: Extension of the audio codec to register this decoder under. For example, .wav for a RIFF/wav decoder.
\return True on seccess, False if registration failed. */
virtual bool registerAudioDecoder(IAudioDecoderFactory* factory, const char* extension) = 0;
//!Unregister Audio Codec (allows you to prevent an file type from being playable with new sound sources)
//!Note that all current sound sources will still continue to use any currently allocated decoders.
//!Will NOT delete any user added factory instance, you must do that yourself
//! Unregister a previously registered Audio Decoder.
/** Note that all current sound sources will still continue to use any currently allocated decoders. Will NOT delete any user added factory instance, you must do that yourself.
\param extension: Extension for the audio decoder to remove. */
virtual void unRegisterAudioDecoder(const char* extension) = 0;
//!Returns whether an audio decoder is currently registered for this file type
//! Returns whether an audio decoder is currently registered for this file type
/**
\param extension: Extension for the audio decoder to check for.
\return True if the specified decoder is registered or False if not. */
virtual bool isAudioDecoderRegistered(const char* extension) = 0;
//!Returns a registered audio decoder factory
//! Returns a registered audio decoder factory.
/**
\param extension: Extension for the audio decoder to return.
\return A pointer to the found factory or NULL if it could not be found. */
virtual IAudioDecoderFactory* getAudioDecoderFactory(const char* extension) = 0;
//!Unregisters all Audio Codecs
//!Note that all current sound sources will still continue to use any currently allocated decoders.
//!Will NOT delete any user added factory instance, you must do that yourself
//! Unregisters all attached Audio Decoders.
/** Note that all current sound sources will still continue to use any currently allocated decoders. Will NOT delete any user added factory instance, you must do that yourself. */
virtual void unRegisterAllAudioDecoders() = 0;
//! Registers a data source with this manager
/** Use this function to provide access to a custom resource manager, zip archive, vfs, or any other place you'd like to get audio files from.
\param factory: Pointer to the data source factory to register.
\param name: Name for the data source (ie. Zip Archive or FileSystem)
\param priority: Determines what order data sources are asked for a file. The higher the priority, the sooner they are asked. cAudio stops looking for a file as soon as any data source returns it.
\return True on success, False on failure to register. */
virtual bool registerDataSource(IDataSourceFactory* factory, const char* name, int priority) = 0;
//! Removes a previously registered data source.
/** Note that sound sources will still continue to use any currently allocated sources, so you may not be able to close an open zip/archive file handle until they are done. Will NOT delete any user added factory instance, you must do that yourself.
\param name: Name of the data source to unregister. */
virtual void unRegisterDataSource(const char* name) = 0;
//! Returns whether a data source is currently registered under a certain name.
/**
\param name: Name of the data source to check for.
\return True if the specified data source is registered or False if not. */
virtual bool isDataSourceRegistered(const char* name) = 0;
//! Returns a previously registered data source factory.
/**
\param name: Name of the data source to return.
\return A pointer to the found factory or NULL if it could not be found. */
virtual IDataSourceFactory* getDataSourceFactory(const char* name) = 0;
//! Removes all previously registered data sources.
/** Note that sound sources will still continue to use any currently allocated sources, so you may not be able to close an open zip/archive file handle until they are done. Will NOT delete any user added factory instance, you must do that yourself. */
virtual void unRegisterAllDataSources() = 0;
//!Registers a new event handler to the manager
//! Registers a new event handler with the manager.
/**
\param handler: Pointer to an event handler instance to register. */
virtual void registerEventHandler(IManagerEventHandler* handler) = 0;
//!Unregisters specified event handler from manager
//! Unregisters a previously registered event handler from the manager.
/** Note: Will not delete your event handler, you must take care of that yourself.
\param handler: Pointer to the event handler to remove. */
virtual void unRegisterEventHandler(IManagerEventHandler* handler) = 0;
//!Unregisters all event handlers attached to the manager
//! Unregisters all previously registered event handlers from the manager.
/** Note: Will not delete your event handler, you must take care of that yourself. */
virtual void unRegisterAllEventHandlers() = 0;
//!Returns an interface for the listener
//! Returns the interface for the listener.
virtual IListener* getListener() = 0;
#ifdef CAUDIO_EFX_ENABLED
//! Returns the interface for audio effects.
virtual IAudioEffects* getEffects() = 0;
#endif
@ -91,21 +178,21 @@ namespace cAudio
private:
};
//! Creates an interface to an Audio Manager
//! Creates an interface to an Audio Manager.
/** Note: This is the only way to get access to the audio playback capabilities of cAudio.
You must delete this interface using destroyAudioManager() once you are done with it.
\param initializeDefault: Whether to return an object initialized with the default settings. If set to false, you must make a call to initialize before you can create audio sources
\param initializeDefault: Whether to return an object initialized with the default settings. If set to false, you must make a call to initialize before you can create audio sources.
\return A pointer to the created object, NULL if the object could not be allocated.
*/
CAUDIO_API IAudioManager* createAudioManager(bool initializeDefault = true);
//! Destroys an interface to a previously created Audio Manager and frees the memory allocated for it
//! Destroys an interface to a previously created Audio Manager and frees the memory allocated for it.
/**
\param capture: The object to destroy
\param capture: The object to destroy.
*/
CAUDIO_API void destroyAudioManager(IAudioManager* manager);
//! Returns if the thread used to update all Audio Managers is running
//! Returns if the thread used to update all Audio Managers is running.
/** Note: Will always return false if threading is disabled.
The library automatically shuts down the thread if no Audio Managers exist and will restart the thread on creation of a new manager.
\return True if the thread is currently running, false otherwise.

View File

@ -8,20 +8,45 @@
namespace cAudio
{
//! Interface for all plugins in cAudio.
class IAudioPlugin : public IRefCounted
{
public:
IAudioPlugin() { }
~IAudioPlugin() { }
//! Called to initialize the plugin. Use this for any initial setup that needs to be done.
/**
\param logger: Pointer to the logger singleton.
\return True if plugin initialization was successful, false if there was an error. */
virtual bool installPlugin(ILogger* logger) = 0;
//! Called to retrieve a name to register this plugin under if the user didn't specify one (or the plugin was auto-loaded).
/**
\return Name of the plugin. */
virtual const char* getPluginName() = 0;
//! Called to shutdown the plugin and do any final cleanup. This is the last function call cAudio will give you before your plugin is completely removed.
virtual void uninstallPlugin() = 0;
//! Called on creation of an Audio Playback Manager.
/** Use this to register any decoders or event handlers that you'd like to add to the engine.
\param manager: Pointer to the newly created manager. */
virtual void onCreateAudioManager(IAudioManager* manager) { }
//! Called on creation of an Audio Capture Manager.
/** Use this to register any event handlers that you'd like to add to the engine.
\param capture: Pointer to the newly created capture interface. */
virtual void onCreateAudioCapture(IAudioCapture* capture) { }
//! Called on destruction of an Audio Playback Manager.
/** Use this to remove anything you added to the playback manger earlier.
\param manager: Pointer to the soon to be destroyed playback interface. */
virtual void onDestroyAudioManager(IAudioManager* manager) { }
//! Called on destruction of an Audio Capture Manager.
/** Use this to remove anything you added to a capture manger earlier.
\param capture: Pointer to the soon to be destroyed capture interface. */
virtual void onDestoryAudioCapture(IAudioCapture* capture) { }
};
};

View File

@ -5,27 +5,32 @@
#ifndef ICAPTUREEVENTHANDLER_H
#define ICAPTUREEVENTHANDLER_H
namespace cAudio{
namespace cAudio
{
//! Interface for recieving Capture Manager Events
class ICaptureEventHandler
{
public:
//! This function is called on capture device intialize
//! This function is called on capture device intialize.
virtual void onInit() = 0;
//! This function is called on capture buffer update
//! This function is called when the capture manager update's its internal buffers.
virtual void onUpdate() = 0;
//! This function is called on capture device shutdown
//! This function is called on capture device shutdown.
virtual void onRelease() = 0;
//! This function is called on capture begin
//! This function is called when the user begins capturing audio.
virtual void onBeginCapture() = 0;
//! This function is called on capture end
//! This function is called when the user ends a capture operation.
virtual void onEndCapture() = 0;
//! This function is called whe user request capture buffer
//! This function is called whe user requests data from the capture buffer.
virtual void onUserRequestBuffer() = 0;
};
};
#endif //! ICAPTUREEVENTHANDLER_H

View File

@ -9,25 +9,36 @@
namespace cAudio
{
//! Interface for data providers in cAudio.
class IDataSource : public IRefCounted
{
public:
IDataSource() { }
virtual ~IDataSource() { }
//!Returns whether the source is valid (in case of an error, like the file couldn't be found)
//! Returns whether the source is valid.
/**
\return Returns false in case of an error, like the file couldn't be found. */
virtual bool isValid() = 0;
//!Get the current location in the data stream
//! Returns the current location in the data stream.
virtual int getCurrentPos() = 0;
//!Get the total size of the data stream
//! Returns the total size of the data stream.
virtual int getSize() = 0;
//!Read out a section of the data stream
//! Reads out a section of the data stream.
/**
\param output: Pointer to a location to put the read data.
\param size: Size in bytes of the data to read.
\return Number of bytes actually read. 0 bytes may indicate end of file or stream. */
virtual int read(void* output, int size) = 0;
//!Seek to a position in the data stream
//! Seek to a position in the data stream.
/**
\param amount: Amount in bytes to seek to.
\param relative: If true the number of bytes in amount is relative to the current position in the stream.
\return True if seek was successful, false if not. */
virtual bool seek(int amount, bool relative) = 0;
};
};

View File

@ -9,18 +9,22 @@
namespace cAudio
{
//! Interface for creating data sources for use with the engine.
class IDataSourceFactory
{
public:
IDataSourceFactory() { }
virtual ~IDataSourceFactory() { }
class IDataSourceFactory
{
public:
IDataSourceFactory() { }
virtual ~IDataSourceFactory() { }
virtual IDataSource* CreateDataSource(const char* filename, bool streamingRequested) = 0;
protected:
private:
};
//! Creates a data source instance for use with the engine.
/**
\param filename: Filename of the file to get a stream for.
\param streamingRequested: True if the user requested streaming capabilities from the data source.
\return A pointer to a data source instance or NULL on failure to allocate. */
virtual IDataSource* CreateDataSource(const char* filename, bool streamingRequested) = 0;
protected:
private:
};
};
#endif //! IDATASOURCEFACTORY_H

View File

@ -14,6 +14,7 @@
namespace cAudio
{
//! Enum of all available effect types in cAudio.
enum EffectTypes
{
EET_NULL,
@ -33,65 +34,158 @@ namespace cAudio
EET_COUNT
};
//! Interface for a single effect in cAudio.
class IEffect : public IRefCounted
{
public:
IEffect() { }
virtual ~IEffect() { }
//! Returns the current type this effect object is set to.
virtual const EffectTypes& getType() const = 0;
//! Sets the type of this effect object.
/**
\param type: Type of effect to switch to. */
virtual void setType(const EffectTypes& type) = 0;
//! Returns the current parameters for the EAX Reverb Effect.
virtual const sEAXReverbParameters& getEAXReverbParameters() const = 0;
//! Sets the parameters for the EAX Reverb Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setEAXReverbParameters(const sEAXReverbParameters& param) = 0;
//! Returns the current parameters for the Reverb Effect.
virtual const sReverbParameters& getReverbParameters() const = 0;
//! Sets the parameters for the Reverb Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setReverbParameters(const sReverbParameters& param) = 0;
//! Returns the current parameters for the Chorus Effect.
virtual const sChorusParameters& getChorusParameters() const = 0;
//! Sets the parameters for the Chorus Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setChorusParameters(const sChorusParameters& param) = 0;
//! Returns the current parameters for the Distortion Effect.
virtual const sDistortionParameters& getDistortionParameters() const = 0;
//! Sets the parameters for the Distortion Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setDistortionParameters(const sDistortionParameters& param) = 0;
//! Returns the current parameters for the Echo Effect.
virtual const sEchoParameters& getEchoParameters() const = 0;
//! Sets the parameters for the Echo Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setEchoParameters(const sEchoParameters& param) = 0;
//! Returns the current parameters for the Flanger Effect.
virtual const sFlangerParameters& getFlangerParameters() const = 0;
//! Sets the parameters for the Flanger Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setFlangerParameters(const sFlangerParameters& param) = 0;
//! Returns the current parameters for the Frequency Shift Effect.
virtual const sFrequencyShiftParameters& getFrequencyShiftParameters() const = 0;
//! Sets the parameters for the Frequency Shift Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setFrequencyShiftParameters(const sFrequencyShiftParameters& param) = 0;
//! Returns the current parameters for the Vocal Morpher Effect.
virtual const sVocalMorpherParameters& getVocalMorpherParameters() const = 0;
//! Sets the parameters for the Vocal Morpher Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setVocalMorpherParameters(const sVocalMorpherParameters& param) = 0;
//! Returns the current parameters for the Pitch Shifter Effect.
virtual const sPitchShifterParameters& getPitchShifterParameters() const = 0;
//! Sets the parameters for the Pitch Shifter Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setPitchShifterParameters(const sPitchShifterParameters& param) = 0;
//! Returns the current parameters for the Ring Modulator Effect.
virtual const sRingModulatorParameters& getRingModulatorParameters() const = 0;
//! Sets the parameters for the Ring Modulator Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setRingModulatorParameters(const sRingModulatorParameters& param) = 0;
//! Returns the current parameters for the Autowah Effect.
virtual const sAutowahParameters& getAutowahParameters() const = 0;
//! Sets the parameters for the Autowah Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setAutowahParameters(const sAutowahParameters& param) = 0;
//! Returns the current parameters for the Compressor Effect.
virtual const sCompressorParameters& getCompressorParameters() const = 0;
//! Sets the parameters for the Compressor Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setCompressorParameters(const sCompressorParameters& param) = 0;
//! Returns the current parameters for the Equalizer Effect.
virtual const sEqualizerParameters& getEqualizerParameters() const = 0;
//! Sets the parameters for the Equalizer Effect.
/**
\param param: Parameter struct to set this effect to.*/
virtual void setEqualizerParameters(const sEqualizerParameters& param) = 0;
//! Returns the master volume for this effect.
/** This volume scales the amount of effect audible from all attached sources.
\return Currently set volume. */
virtual float getMasterVolume() const = 0;
//! Sets the master volume for this effect.
/** This volume scales the amount of effect audible from all attached sources.
\param volume: Volume to set the master volume to. 1.0f equal no volume change. Range: 0.0f to inf.*/
virtual void setMasterVolume(const float& volume) = 0;
//! Returns if the effect for each attached source is attenuated by distance.
virtual bool isIgnoringAttenuation() const = 0;
//! Sets whether the effect for each attached source is attenuated by distance.
/** If set to true, can cause some interesting and non-realistic effects, so be careful with it.
\param ignore: Whether to ignore attenuation. */
virtual void ignoreAttenuation(const bool& ignore) = 0;
//! Returns the attached filter to this audio effect.
virtual IFilter* getFilter() const = 0;
//! Attaches a filter to this effect.
/**
\param filter: A Pointer to the filter to attach. */
virtual void attachFilter(IFilter* filter) = 0;
//! Removes the currently attached filter.
virtual void removeFilter() = 0;
//! Returns a timestamp indicating the last time settings on this effect were changed. Used internally by the engine to update attached sources.
virtual unsigned int getLastUpdated() const = 0;
//! Returns if this effect is ready to be used or if it has encountered a fatal error.
virtual bool isValid() const = 0;
};
};

View File

@ -12,6 +12,7 @@
namespace cAudio
{
//! Contains parameters for the EAX Reverb Effect. This effect tries to simulate how sound behaves in different environments.
struct sEAXReverbParameters
{
sEAXReverbParameters(
@ -48,31 +49,198 @@ namespace cAudio
HFReference(hFReference), LFReference(lFReference),
RoomRolloffFactor(roomRolloffFactor), DecayHFLimit(decayHFLimit) { }
//! Reverb Modal Density controls the coloration of the late reverb. Lowering the value adds
//! more coloration to the late reverb.
//! Range: 0.0 to 1.0
float Density;
//! The Reverb Diffusion property controls the echo density in the reverberation decay. It's set by
//! default to 1.0, which provides the highest density. Reducing diffusion gives the reverberation a
//! more "grainy" character that is especially noticeable with percussive sound sources. If you set a
//! diffusion value of 0.0, the later reverberation sounds like a succession of distinct echoes.
//! Range: 0.0 to 1.0
float Diffusion;
//! The Reverb Gain property is the master volume control for the reflected sound (both early
//! reflections and reverberation) that the reverb effect adds to all sound sources. It sets the
//! maximum amount of reflections and reverberation added to the final sound mix. The value of the
//! Reverb Gain property ranges from 1.0 (0db) (the maximum amount) to 0.0 (-100db) (no reflected
//! sound at all).
//! Range: 0.0 to 1.0
float Gain;
//! The Reverb Gain HF property further tweaks reflected sound by attenuating it at high frequencies.
//! It controls a low-pass filter that applies globally to the reflected sound of all sound sources
//! feeding the particular instance of the reverb effect. The value of the Reverb Gain HF property
//! ranges from 1.0 (0db) (no filter) to 0.0 (-100db) (virtually no reflected sound). HF Reference sets
//! the frequency at which the value of this property is measured.
//! Range: 0.0 to 1.0
float GainHF;
//! The Reverb Gain LF property further tweaks reflected sound by attenuating it at low frequencies.
//! It controls a high-pass filter that applies globally to the reflected sound of all sound sources
//! feeding the particular instance of the reverb effect. The value of the Reverb Gain LF property
//! ranges from 1.0 (0db) (no filter) to 0.0 (-100db) (virtually no reflected sound). LF Reference sets
//! the frequency at which the value of this property is measured.
//! Range: 0.0 to 1.0
float GainLF;
//! The Decay Time property sets the reverberation decay time. It ranges from 0.1 (typically a small
//! room with very dead surfaces) to 20.0 (typically a large room with very live surfaces).
//! Range: 0.1 to 20.0
float DecayTime;
//! The Decay HF Ratio property adjusts the spectral quality of the Decay Time parameter. It is the
//! ratio of high-frequency decay time relative to the time set by Decay Time. The Decay HF Ratio
//! value 1.0 is neutral: the decay time is equal for all frequencies. As Decay HF Ratio increases
//! above 1.0, the high-frequency decay time increases so it's longer than the decay time at mid
//! frequencies. You hear a more brilliant reverberation with a longer decay at high frequencies. As
//! the Decay HF Ratio value decreases below 1.0, the high-frequency decay time decreases so it's
//! shorter than the decay time of the mid frequencies. You hear a more natural reverberation.
//! Range: 0.1 to 20.0
float DecayHFRatio;
//! The Decay LF Ratio property adjusts the spectral quality of the Decay Time parameter. It is the
//! ratio of low-frequency decay time relative to the time set by Decay Time. The Decay LF Ratio
//! value 1.0 is neutral: the decay time is equal for all frequencies. As Decay LF Ratio increases
//! above 1.0, the low-frequency decay time increases so it's longer than the decay time at mid
//! frequencies. You hear a more booming reverberation with a longer decay at low frequencies. As
//! the Decay LF Ratio value decreases below 1.0, the low-frequency decay time decreases so it's
//! shorter than the decay time of the mid frequencies. You hear a more tinny reverberation.
//! Range: 0.1 to 20.0
float DecayLFRatio;
//! The Reflections Gain property controls the overall amount of initial reflections relative to the Gain
//! property. (The Gain property sets the overall amount of reflected sound: both initial reflections
//! and later reverberation.) The value of Reflections Gain ranges from a maximum of 3.16 (+10 dB)
//! to a minimum of 0.0 (-100 dB) (no initial reflections at all), and is corrected by the value of the
//! Gain property. The Reflections Gain property does not affect the subsequent reverberation decay.
//! Range: 0.0 to 3.16
float ReflectionsGain;
//! The Reflections Delay property is the amount of delay between the arrival time of the direct path
//! from the source to the first reflection from the source. It ranges from 0 to 300 milliseconds. You
//! can reduce or increase Reflections Delay to simulate closer or more distant reflective surfaces—
//! and therefore control the perceived size of the room.
//! Range: 0.0 to 0.3
float ReflectionsDelay;
//! The Reflections Pan property is a 3D vector that controls the spatial distribution of the cluster of
//! early reflections. The direction of this vector controls the global direction of the reflections, while
//! its magnitude controls how focused the reflections are towards this direction.
//! It is important to note that the direction of the vector is interpreted in the coordinate system of the
//! user, without taking into account the orientation of the virtual listener. For instance, assuming a
//! four-point loudspeaker playback system, setting Reflections Pan to (0, 0, 0.7) means that the
//! reflections are panned to the front speaker pair, whereas as setting of (0, 0, -0.7) pans the
//! reflections towards the rear speakers. These vectors follow the a left-handed co-ordinate system,
//! unlike OpenAL uses a right-handed co-ordinate system.
//! If the magnitude of Reflections Pan is zero (the default setting), the early reflections come evenly
//! from all directions. As the magnitude increases, the reflections become more focused in the
//! direction pointed to by the vector. A magnitude of 1.0 would represent the extreme case, where
//! all reflections come from a single direction.
cVector3 ReflectionsPan;
//! The Late Reverb Gain property controls the overall amount of later reverberation relative to the
//! Gain property. (The Gain property sets the overall amount of both initial reflections and later
//! reverberation.) The value of Late Reverb Gain ranges from a maximum of 10.0 (+20 dB) to a
//! minimum of 0.0 (-100 dB) (no late reverberation at all).
//! Range: 0.0 to 10.0
float LateReverbGain;
//! The Late Reverb Delay property defines the begin time of the late reverberation relative to the
//! time of the initial reflection (the first of the early reflections). It ranges from 0 to 100 milliseconds.
//! Reducing or increasing Late Reverb Delay is useful for simulating a smaller or larger room.
//! Range: 0.0 to 0.1
float LateReverbDelay;
//! The Late Reverb Pan property is a 3D vector that controls the spatial distribution of the late
//! reverb. The direction of this vector controls the global direction of the reverb, while its magnitude
//! controls how focused the reverb are towards this direction. The details under Reflections Pan,
//! above, also apply to Late Reverb Pan.
cVector3 LateReverbPan;
//! Echo Time controls the rate at which the cyclic echo repeats itself along the
//! reverberation decay. For example, the default setting for Echo Time is 250 ms. causing the echo
//! to occur 4 times per second. Therefore, if you were to clap your hands in this type of
//! environment, you will hear four repetitions of clap per second.
//! Range: 0.075 to 0.25
float EchoTime;
//! Echo Depth introduces a cyclic echo in the reverberation decay, which will be noticeable with
//! transient or percussive sounds. A larger value of Echo Depth will make this effect more
//! prominent.
//! Together with Reverb Diffusion, Echo Depth will control how long the echo effect will persist along
//! the reverberation decay. In a more diffuse environment, echoes will wash out more quickly after
//! the direct sound. In an environment that is less diffuse, you will be able to hear a larger number
//! of repetitions of the echo, which will wash out later in the reverberation decay. If Diffusion is set
//! to 0.0 and Echo Depth is set to 1.0, the echo will persist distinctly until the end of the
//! reverberation decay.
//! Range: 0.0 to 1.0
float EchoDepth;
//! Using these two properties below, you can create a pitch modulation in the reverberant sound. This will
//! be most noticeable applied to sources that have tonal color or pitch. You can use this to make
//! some trippy effects! Modulation Time controls the speed of the vibrato (rate of periodic changes in pitch).
//! Range: 0.004 to 4.0
float ModulationTime;
//! Modulation Depth controls the amount of pitch change. Low values of Diffusion will contribute to
//! reinforcing the perceived effect by reducing the mixing of overlapping reflections in the
//! reverberation decay.
//! Range: 0.0 to 1.0
float ModulationDepth;
//! The Air Absorption Gain HF property controls the distance-dependent attenuation at high
//! frequencies caused by the propagation medium. It applies to reflected sound only. You can use
//! Air Absorption Gain HF to simulate sound transmission through foggy air, dry air, smoky
//! atmosphere, and so on. The default value is 0.994 (-0.05 dB) per meter, which roughly
//! corresponds to typical condition of atmospheric humidity, temperature, and so on. Lowering the
//! value simulates a more absorbent medium (more humidity in the air, for example); raising the
//! value simulates a less absorbent medium (dry desert air, for example).
//! Range: 0.892 to 1.0
float AirAbsorptionGainHF;
//! The properties HF Reference and LF Reference determine respectively the frequencies at which
//! the high-frequency effects and the low-frequency effects created by EAX Reverb properties are
//! measured, for example Decay HF Ratio and Decay LF Ratio.
//! Note that it is necessary to maintain a factor of at least 10 between these two reference
//! frequencies so that low frequency and high frequency properties can be accurately controlled and
//! will produce independent effects. In other words, the LF Reference value should be less than
//! 1/10 of the HF Reference value.
//! Range: 1000.0 to 20000.0
float HFReference;
//! See HFReference.
//! Range: 20.0 to 1000.0
float LFReference;
//! The Room Rolloff Factor property is one of two methods available to attenuate the reflected
//! sound (containing both reflections and reverberation) according to source-listener distance. It's
//! defined the same way as OpenAL's Rolloff Factor, but operates on reverb sound instead of
//! direct-path sound. Setting the Room Rolloff Factor value to 1.0 specifies that the reflected sound
//! will decay by 6 dB every time the distance doubles. Any value other than 1.0 is equivalent to a
//! scaling factor applied to the quantity specified by ((Source listener distance) - (Reference
//! Distance)). Reference Distance is an OpenAL source parameter that specifies the inner border
//! for distance rolloff effects: if the source comes closer to the listener than the reference distance,
//! the direct-path sound isn't increased as the source comes closer to the listener, and neither is the
//! reflected sound.
//! The default value of Room Rolloff Factor is 0.0 because, by default, the Effects Extension reverb
//! effect naturally manages the reflected sound level automatically for each sound source to
//! simulate the natural rolloff of reflected sound vs. distance in typical rooms.
//! Range: 0.0 to 10.0
float RoomRolloffFactor;
//! When this flag is set, the high-frequency decay time automatically stays below a limit value that's
//! derived from the setting of the property Air Absorption Gain HF. This limit applies regardless of
//! the setting of the property Decay HF Ratio, and the limit doesn't affect the value of Decay HF
//! Ratio. This limit, when on, maintains a natural sounding reverberation decay by allowing you to
//! increase the value of Decay Time without the risk of getting an unnaturally long decay time at
//! high frequencies. If this flag is set to false, high-frequency decay time isn't automatically
//! limited.
bool DecayHFLimit;
};
//! Similar to the above EAX Reverb Effect, but has less features, meaning it may be better supported on lower end hardware.
struct sReverbParameters
{
sReverbParameters(
@ -96,21 +264,114 @@ namespace cAudio
AirAbsorptionGainHF(airAbsorptionGainHF), RoomRolloffFactor(roomRolloffFactor),
DecayHFLimit(decayHFLimit) { }
//! Reverb Modal Density controls the coloration of the late reverb. Lowering the value adds more
//! coloration to the late reverb.
//! Range: 0.0 to 1.0
float Density;
//! The Reverb Diffusion property controls the echo density in the reverberation decay. It's set by
//! default to 1.0, which provides the highest density. Reducing diffusion gives the reverberation a
//! more "grainy" character that is especially noticeable with percussive sound sources. If you set a
//! diffusion value of 0.0, the later reverberation sounds like a succession of distinct echoes.
//! Range: 0.0 to 1.0
float Diffusion;
//! The Reverb Gain property is the master volume control for the reflected sound (both early
//! reflections and reverberation) that the reverb effect adds to all sound sources. It sets the
//! maximum amount of reflections and reverberation added to the final sound mix. The value of the
//! Reverb Gain property ranges from 1.0 (0db) (the maximum amount) to 0.0 (-100db) (no reflected
//! sound at all).
//! Range: 0.0 to 1.0
float Gain;
//! The Reverb Gain HF property further tweaks reflected sound by attenuating it at high frequencies.
//! It controls a low-pass filter that applies globally to the reflected sound of all sound sources
//! feeding the particular instance of the reverb effect. The value of the Reverb Gain HF property
//! ranges from 1.0 (0db) (no filter) to 0.0 (-100db) (virtually no reflected sound).
//! Range: 0.0 to 1.0
float GainHF;
//! The Decay Time property sets the reverberation decay time. It ranges from 0.1 (typically a small
//! room with very dead surfaces) to 20.0 (typically a large room with very live surfaces).
//! Range: 0.1 to 20.0
float DecayTime;
//! The Decay HF Ratio property sets the spectral quality of the Decay Time parameter. It is the
//! ratio of high-frequency decay time relative to the time set by Decay Time. The Decay HF Ratio
//! value 1.0 is neutral: the decay time is equal for all frequencies. As Decay HF Ratio increases
//! above 1.0, the high-frequency decay time increases so it's longer than the decay time at low
//! frequencies. You hear a more brilliant reverberation with a longer decay at high frequencies. As
//! the Decay HF Ratio value decreases below 1.0, the high-frequency decay time decreases so it's
//! shorter than the decay time of the low frequencies. You hear a more natural reverberation.
//! Range: 0.1 to 2.0
float DecayHFRatio;
//! The Reflections Gain property controls the overall amount of initial reflections relative to the Gain
//! property. (The Gain property sets the overall amount of reflected sound: both initial reflections
//! and later reverberation.) The value of Reflections Gain ranges from a maximum of 3.16 (+10 dB)
//! to a minimum of 0.0 (-100 dB) (no initial reflections at all), and is corrected by the value of the
//! Gain property. The Reflections Gain property does not affect the subsequent reverberation
//! decay.
//! Range: 0.0 to 3.16
float ReflectionsGain;
//! The Reflections Delay property is the amount of delay between the arrival time of the direct path
//! from the source to the first reflection from the source. It ranges from 0 to 300 milliseconds. You
//! can reduce or increase Reflections Delay to simulate closer or more distant reflective surfaces—
//! and therefore control the perceived size of the room.
//! Range: 0.0 to 0.3
float ReflectionsDelay;
//! The Late Reverb Gain property controls the overall amount of later reverberation relative to the
//! Gain property. (The Gain property sets the overall amount of both initial reflections and later
//! reverberation.) The value of Late Reverb Gain ranges from a maximum of 10.0 (+20 dB) to a
//! minimum of 0.0 (-100 dB) (no late reverberation at all).
//! Range: 0.0 to 10.0
float LateReverbGain;
//! The Late Reverb Delay property defines the begin time of the late reverberation relative to the
//! time of the initial reflection (the first of the early reflections). It ranges from 0 to 100 milliseconds.
//! Reducing or increasing Late Reverb Delay is useful for simulating a smaller or larger room.
//! Range: 0.0 to 0.1
float LateReverbDelay;
//! The Air Absorption Gain HF property controls the distance-dependent attenuation at high
//! frequencies caused by the propagation medium. It applies to reflected sound only. You can use
//! Air Absorption Gain HF to simulate sound transmission through foggy air, dry air, smoky
//! atmosphere, and so on. The default value is 0.994 (-0.05 dB) per meter, which roughly
//! corresponds to typical condition of atmospheric humidity, temperature, and so on. Lowering the
//! value simulates a more absorbent medium (more humidity in the air, for example); raising the
//! value simulates a less absorbent medium (dry desert air, for example).
//! Range: 0.892 to 1.0
float AirAbsorptionGainHF;
//! The Room Rolloff Factor property is one of two methods available to attenuate the reflected
//! sound (containing both reflections and reverberation) according to source-listener distance. It's
//! defined the same way as OpenAL's Rolloff Factor, but operates on reverb sound instead of
//! direct-path sound. Setting the Room Rolloff Factor value to 1.0 specifies that the reflected sound
//! will decay by 6 dB every time the distance doubles. Any value other than 1.0 is equivalent to a
//! scaling factor applied to the quantity specified by ((Source listener distance) - (Reference
//! Distance)). Reference Distance is an OpenAL source parameter that specifies the inner border
//! for distance rolloff effects: if the source comes closer to the listener than the reference distance,
//! the direct-path sound isn't increased as the source comes closer to the listener, and neither is the
//! reflected sound.
//! The default value of Room Rolloff Factor is 0.0 because, by default, the Effects Extension reverb
//! effect naturally manages the reflected sound level automatically for each sound source to
//! simulate the natural rolloff of reflected sound vs. distance in typical rooms.
//! Range: 0.0 to 10.0
float RoomRolloffFactor;
//! When this flag is set, the high-frequency decay time automatically stays below a limit value that's
//! derived from the setting of the property Air Absorption Gain HF. This limit applies regardless of
//! the setting of the property Decay HF Ratio, and the limit doesn't affect the value of Decay HF
//! Ratio. This limit, when on, maintains a natural sounding reverberation decay by allowing you to
//! increase the value of Decay Time without the risk of getting an unnaturally long decay time at
//! high frequencies. If this flag is set to false, high-frequency decay time isn't automatically
//! limited.
bool DecayHFLimit;
};
//! The chorus effect essentially replays the input audio accompanied by another slightly delayed version of the signal, creating a "doubling" effect.
struct sChorusParameters
{
enum ChorusWaveform
@ -129,14 +390,39 @@ namespace cAudio
Waveform(waveform), Phase(phase), Rate(rate), Depth(depth), Feedback(feedback),
Delay(delay) { }
//! This property sets the waveform shape of the LFO that controls the delay time of the delayed signals.
ChorusWaveform Waveform;
//! This property controls the phase difference between the left and right LFO's. At zero degrees the
//! two LFOs are synchronized. Use this parameter to create the illusion of an expanded stereo field
//! of the output signal.
//! Range: -180 to 180
int Phase;
//! This property sets the modulation rate of the LFO that controls the delay time of the delayed signals.
//! Range: 0.0 to 10.0
float Rate;
//! This property controls the amount by which the delay time is modulated by the LFO.
//! Range: 0.0 to 1.0
float Depth;
//! This property controls the amount of processed signal that is fed back to the input of the chorus
//! effect. Negative values will reverse the phase of the feedback signal. At full magnitude the
//! identical sample will repeat endlessly. At lower magnitudes the sample will repeat and fade out
//! over time. Use this parameter to create a "cascading" chorus effect.
//! Range: -1.0 to 1.0
float Feedback;
//! This property controls the average amount of time the sample is delayed before it is played back,
//! and with feedback, the amount of time between iterations of the sample. Larger values lower the
//! pitch. Smaller values make the chorus sound like a flanger, but with different frequency
//! characteristics.
//! Range: 0.0 to 0.016
float Delay;
};
//! The distortion effect simulates turning up (overdriving) the gain stage on a guitar amplifier or adding a distortion pedal to an instrument's output.
struct sDistortionParameters
{
sDistortionParameters(
@ -148,13 +434,28 @@ namespace cAudio
Edge(edge), Gain(gain), LowpassCutoff(lowpassCutoff), EqCenter(eqCenter),
EqBandwidth(eqBandwidth) { }
//! This property controls the shape of the distortion. The higher the value for Edge, the "dirtier" and "fuzzier" the effect.
//! Range: 0.0 to 1.0
float Edge;
//! This property allows you to attenuate the distorted sound.
//! Range: 0.01 to 1.0
float Gain;
//! Input signal can have a low pass filter applied, to limit the amount of high frequency signal feeding into the distortion effect.
//! Range: 80.0 to 24000.0
float LowpassCutoff;
//! This property controls the frequency at which the post-distortion attenuation (Gain) is active.
//! Range: 80.0 to 24000.0
float EqCenter;
//! This property controls the bandwidth of the post-distortion attenuation.
//! Range: 80.0 to 24000.0
float EqBandwidth;
};
//! The echo effect generates discrete, delayed instances of the input signal.
struct sEchoParameters
{
sEchoParameters(
@ -166,13 +467,34 @@ namespace cAudio
Delay(delay), LRDelay(lRDelay), Damping(damping), Feedback(feedback),
Spread(spread) { }
//! This property controls the delay between the original sound and the first "tap", or echo instance.
//! Range: 0.0 to 0.207
float Delay;
//! This property controls the delay between the first "tap" and the second "tap".
//! Range: 0.0 to 0.404
float LRDelay;
//! This property controls the amount of high frequency damping applied to each echo. As the sound
//! is subsequently fed back for further echoes, damping results in an echo which progressively gets
//! softer in tone as well as intensity.
//! Range: 0.0 to 0.99
float Damping;
//! This property controls the amount of feedback the output signal fed back into the input. Use this
//! parameter to create "cascading" echoes. At full magnitude, the identical sample will repeat
//! endlessly. Below full magnitude, the sample will repeat and fade.
//! Range: 0.0 to 1.0
float Feedback;
//! This property controls how hard panned the individual echoes are. With a value of 1.0, the first
//! "tap" will be panned hard left, and the second "tap" hard right. A value of -1.0 gives the opposite
//! result. Settings nearer to 0.0 result in less emphasized panning.
//! Range: -1.0 to 1.0
float Spread;
};
//! The flanger effect creates a "tearing" or "whooshing" sound (like a jet flying overhead).
struct sFlangerParameters
{
enum FlangerWaveform
@ -191,14 +513,34 @@ namespace cAudio
Waveform(waveform), Phase(phase), Rate(rate), Depth(depth), Feedback(feedback),
Delay(delay) { }
//! Selects the shape of the LFO waveform that controls the amount of the delay of the sampled signal.
FlangerWaveform Waveform;
//! This changes the phase difference between the left and right LFO's. At zero degrees the two LFOs are synchronized.
//! Range: -180 to 180
int Phase;
//! The number of times per second the LFO controlling the amount of delay repeats. Higher values increase the pitch modulation.
//! Range: 0.0 to 10.0
float Rate;
//! The ratio by which the delay time is modulated by the LFO. Use this parameter to increase the pitch modulation.
//! Range: 0.0 to 1.0
float Depth;
//! This is the amount of the output signal level fed back into the effect's input.
//! A negative value will reverse the phase of the feedback signal. Use this parameter
//! to create an "intense metallic" effect. At full magnitude, the identical sample will
//! repeat endlessly. At less than full magnitude, the sample will repeat and fade out over time.
//! Range: -1.0 to 1.0
float Feedback;
//! The average amount of time the sample is delayed before it is played back; with feedback, the amount of time between iterations of the sample.
//! Range: 0.0 to 0.004
float Delay;
};
//! The frequency shifter is a single-sideband modulator, which translates all the component frequencies of the input signal by an equal amount.
struct sFrequencyShiftParameters
{
enum ShiftDirection
@ -214,11 +556,23 @@ namespace cAudio
ShiftDirection right = ESD_DOWN) :
Frequency(frequency), Left(left), Right(right) { }
//! This is the carrier frequency. For carrier frequencies below the audible range, the singlesideband
//! modulator may produce phaser effects, spatial effects or a slight pitch-shift. As the
//! carrier frequency increases, the timbre of the sound is affected; a piano or guitar note becomes
//! like a bell's chime, and a human voice sounds extraterrestrial!
//! Range: 0.0 to 24000.0
float Frequency;
//! These select which internal signals are added together to produce the output. Different
//! combinations of values will produce slightly different tonal and spatial effects.
ShiftDirection Left;
//! These select which internal signals are added together to produce the output. Different
//! combinations of values will produce slightly different tonal and spatial effects.
ShiftDirection Right;
};
//! The vocal morpher consists of a pair of 4-band formant filters, used to impose vocal tract effects upon the input signal.
struct sVocalMorpherParameters
{
enum MorpherPhoneme
@ -273,14 +627,33 @@ namespace cAudio
PhonemeA(phonemeA), PhonemeB(phonemeB), PhonemeACoarseTune(phonemeACoarseTune),
PhonemeBCoarseTune(phonemeBCoarseTune), Waveform(waveform), Rate(rate) { }
//! If both parameters are set to the same phoneme, that determines the filtering effect that will be
//! heard. If these two parameters are set to different phonemes, the filtering effect will morph
//! between the two settings at a rate specified by Rate.
MorpherPhoneme PhonemeA;
//! If both parameters are set to the same phoneme, that determines the filtering effect that will be
//! heard. If these two parameters are set to different phonemes, the filtering effect will morph
//! between the two settings at a rate specified by Rate.
MorpherPhoneme PhonemeB;
//! This is used to adjust the pitch of phoneme filter A in 1-semitone increments.
//! Range: -24 to 24
int PhonemeACoarseTune;
//! This is used to adjust the pitch of phoneme filter B in 1-semitone increments.
//! Range: -24 to 24
int PhonemeBCoarseTune;
//! This controls the shape of the low-frequency oscillator used to morph between the two phoneme filters.
MorpherWaveform Waveform;
//! This controls the frequency of the low-frequency oscillator used to morph between the two phoneme filters.
//! Range: 0.0 to 10.0
float Rate;
};
//! The pitch shifter applies time-invariant pitch shifting to the input signal, over a one octave range and controllable at a semi-tone and cent resolution.
struct sPitchShifterParameters
{
sPitchShifterParameters(
@ -288,10 +661,20 @@ namespace cAudio
int fineTune = 0) :
CoarseTune(coarseTune), FineTune(fineTune) { }
//! This sets the number of semitones by which the pitch is shifted. There are 12 semitones per
//! octave. Negative values create a downwards shift in pitch, positive values pitch the sound
//! upwards.
//! Range: -12 to 12
int CoarseTune;
//! This sets the number of cents between Semitones a pitch is shifted. A Cent is 1/100th of a
//! Semitone. Negative values create a downwards shift in pitch, positive values pitch the sound
//! upwards.
//! Range: -50 to 50
int FineTune;
};
//! The ring modulator multiplies an input signal by a carrier signal in the time domain, resulting in tremolo or inharmonic effects.
struct sRingModulatorParameters
{
enum ModulatorWaveform
@ -307,11 +690,27 @@ namespace cAudio
ModulatorWaveform waveform = EMW_SINUSOID) :
Frequency(frequency), HighPassCutoff(highPassCutoff), Waveform(waveform) { }
//! This is the frequency of the carrier signal. If the carrier signal is slowly varying (less than 20 Hz),
//! the result is a tremolo (slow amplitude variation) effect. If the carrier signal is in the audio range,
//! audible upper and lower sidebands begin to appear, causing an inharmonic effect. The carrier
//! signal itself is not heard in the output.
//! Range: 0.0 to 8000.0
float Frequency;
//! This controls the cutoff frequency at which the input signal is high-pass filtered before being ring
//! modulated. If the cutoff frequency is 0, the entire signal will be ring modulated. If the cutoff
//! frequency is high, very little of the signal (only those parts above the cutoff) will be ring
//! modulated.
//! Range: 0.0 to 24000.0
float HighPassCutoff;
//! This controls which waveform is used as the carrier signal. Traditional ring modulator and
//! tremolo effects generally use a sinusoidal carrier. Sawtooth and square waveforms are may
//! cause unpleasant aliasing.
ModulatorWaveform Waveform;
};
//! The Auto-wah effect emulates the sound of a wah-wah pedal used with an electric guitar, or a mute on a brass instrument.
struct sAutowahParameters
{
sAutowahParameters(
@ -322,21 +721,38 @@ namespace cAudio
AttackTime(attackTime), ReleaseTime(releaseTime), Resonance(resonance),
PeakGain(peakGain) { }
//! This property controls the time the filtering effect takes to sweep from minimum to maximum center frequency when it is triggered by input signal.
//! Range: 0.0001 to 1.0
float AttackTime;
//! This property controls the time the filtering effect takes to sweep from maximum back to base center frequency, when the input signal ends.
//! Range: 0.0001 to 1.0
float ReleaseTime;
//! This property controls the resonant peak, sometimes known as emphasis or Q, of the auto-wah
//! band-pass filter. Resonance occurs when the effect boosts the frequency content of the sound
//! around the point at which the filter is working. A high value promotes a highly resonant, sharp
//! sounding effect.
//! Range: 2.0 to 1000.0
float Resonance;
//! This property controls the input signal level at which the band-pass filter will be fully opened.
//! Range: 0.00003 to 31621.0
float PeakGain;
};
//! The Automatic Gain Control effect performs the same task as a studio compressor, evening out the audio dynamic range of an input sound.
struct sCompressorParameters
{
sCompressorParameters(
bool active = true) :
Active(active) { }
//! The Compressor can only be switched on and off it cannot be adjusted.
bool Active;
};
//! The OpenAL Effects Extension EQ is very flexible, providing tonal control over four different adjustable frequency ranges.
struct sEqualizerParameters
{
sEqualizerParameters(
@ -355,15 +771,44 @@ namespace cAudio
Mid2Center(mid2Center), Mid2Width(mid2Width), HighGain(highGain),
HighCutoff(highCutoff) { }
//! This property controls amount of cut or boost on the low frequency range.
//! Range: 0.126 to 7.943
float LowGain;
//! This property controls the low frequency below which signal will be cut off.
//! Range: 50.0 to 800.0
float LowCutoff;
//! This property allows you to cut / boost signal on the "mid1" range.
//! Range: 0.126 to 7.943
float Mid1Gain;
//! This property sets the center frequency for the "mid1" range.
//! Range: 200.0 to 3000.0
float Mid1Center;
//! This property controls the width of the "mid1" range.
//! Range: 0.01 to 1.0
float Mid1Width;
//! This property allows you to cut / boost signal on the "mid2" range.
//! Range: 0.126 to 7.943
float Mid2Gain;
//! This property sets the center frequency for the "mid2" range.
//! Range: 1000.0 to 8000.0
float Mid2Center;
//! This property controls the width of the "mid2" range.
//! Range: 0.01 to 1.0
float Mid2Width;
//! This property allows you to cut / boost the signal at high frequencies.
//! Range: 0.126 to 7.943
float HighGain;
//! This property controls the high frequency above which signal will be cut off.
//! Range: 4000.0 to 16000.0
float HighCutoff;
};
};

View File

@ -12,6 +12,7 @@
namespace cAudio
{
//! Enum of all available filter types in cAudio.
enum FilterTypes
{
EFT_NULL,

View File

@ -5,13 +5,11 @@
#ifndef ISOURCEEVENTHANDLER_H
#define ISOURCEEVENTHANDLER_H
namespace cAudio{
namespace cAudio
{
class ISourceEventHandler
{
public:
//! This function calls on source update
virtual void onUpdate() = 0;
//! This function calls on source release
@ -22,9 +20,7 @@ namespace cAudio{
virtual void onStop() = 0;
//! This function calls on source pause
virtual void onPause() = 0;
};
};
#endif //! ISOURCEEVENTHANDLER_H

View File

@ -46,4 +46,9 @@
#include "IPluginManager.h"
#include "IRefCounted.h"
//! Main namespace for the entire cAudio library
namespace cAudio
{
};
#endif

View File

@ -3,11 +3,13 @@
#include "cAudioPlatform.h"
//! Global define for the version of cAudio.
//! This is used primarily by plugins to make sure they are linking to the right library.
#define CAUDIO_VERSION "2.0.0"
//Global define for exporting the library
#ifndef CAUDIO_STATIC_LIB
//! Global define for exporting the library
#ifdef CAUDIO_EXPORTS
#define CAUDIO_API __declspec(dllexport)
#else
@ -15,45 +17,44 @@
#endif // CAUDIO_EXPORTS
#else
#define CAUDIO_API
#define CAUDIO_API extern "C"
#endif // CAUDIO_STATIC_LIB
//////////////////////////
//Global Library Settings
//////////////////////////
//Define for making the entire library Thread Safe, comment out to disable
//Will also disable internal threading by the library
//!Define for making the entire library Thread Safe, comment out to disable. Will also disable internal threading by the library.
#define CAUDIO_MAKE_THREAD_SAFE
#ifdef CAUDIO_MAKE_THREAD_SAFE
//Define enables threading for the main update loop. Disable to run the internal update loop yourself
//NOTE: Internal threading should NOT be used if the library is not thread safe!
//! Define enables threading for the main update loop. Disable to run the internal update loop yourself. NOTE: Internal threading should NOT be used if the library is not thread safe!
#define CAUDIO_USE_INTERNAL_THREAD
#endif
//These defines control which of the default audio codecs are compiled into the library
//! This define controls whether the Ogg/Vorbis decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_OGG_DECODER
//! This define controls whether the RIFF/Wav decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_WAV_DECODER
////////////////////////
//Audio Source Settings
////////////////////////
//Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS)
//! Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS)
#define CAUDIO_SOURCE_BUFFER_SIZE ( 1024 * 64 )
//Number of internal buffers to cycle through per source (Note: using only 1 leads to choppy sound or premature ending of sources)
//! Number of internal buffers to cycle through per source (Note: using only 1 leads to choppy sound or premature ending of sources)
#define CAUDIO_SOURCE_NUM_BUFFERS 3
/////////////////////////
//Audio Effects Settings
/////////////////////////
//Comment out to remove all EFX support from the library
//! Comment out to remove all EFX support from the library
#define CAUDIO_EFX_ENABLED
#ifdef CAUDIO_EFX_ENABLED
//Max number of effects that can be attached to a single sound source
//! Max number of effects that can be attached to a single sound source
#define CAUDIO_SOURCE_MAX_EFFECT_SLOTS 4
#endif

View File

@ -9,9 +9,8 @@
namespace cAudio
{
/*! Amount of time to sleep in milliseconds
*\param ms: amount of miliseconds to sleep
*/
//! Causes the current thread to give up control for a certain duration.
/** \param ms: amount of miliseconds to sleep */
CAUDIO_API void cAudioSleep(unsigned int ms);
};

View File

@ -661,32 +661,32 @@ class cEAXLegacyPresetPlugin : public IAudioPlugin
void onDestroyAudioManager(IAudioManager* manager)
{
#ifdef CAUDIO_EFX_ENABLED
manager->getEffects()->removePreset(EET_EAX_REVERB, "Generic");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Padded Cell");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Room");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Bath Room");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Living Room");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Stone Room");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Auditorium");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Concert Hall");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Cave");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Arena");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Hangar");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Carpeted Hallway");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Hallway");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Stone Corridor");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Alley");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Forest");
manager->getEffects()->removePreset(EET_EAX_REVERB, "City");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Mountains");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Quarry");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Plain");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Parking Lot");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Sewer Pipe");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Under Water");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Drugged");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Dizzy");
manager->getEffects()->removePreset(EET_EAX_REVERB, "Psychotic");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Generic");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Padded Cell");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Room");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Bath Room");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Living Room");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Stone Room");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Auditorium");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Concert Hall");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Cave");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Arena");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Hangar");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Carpeted Hallway");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Hallway");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Stone Corridor");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Alley");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Forest");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "City");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Mountains");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Quarry");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Plain");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Parking Lot");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Sewer Pipe");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Under Water");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Drugged");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Dizzy");
manager->getEffects()->removeEffectPreset(EET_EAX_REVERB, "Psychotic");
#endif
}