cAudio  2.3.0
3d Audio Engine
 All Classes Namespaces Functions Variables Enumerations Pages
Public Member Functions | List of all members
cAudio::IAudioManager Class Referenceabstract

Interface for the playback capabilities of cAudio. More...

#include <IAudioManager.h>

Inheritance diagram for cAudio::IAudioManager:
Inheritance graph
[legend]

Public Member Functions

virtual bool initialize (const char *deviceName=0x0, int outputFrequency=-1, int eaxEffectSlots=4)=0
 Initializes the manager. More...
 
virtual void shutDown ()=0
 Shuts the manager down, cleaning up audio sources in the process. Does not clean up decoders, data sources, or event handlers.
 
virtual void update ()=0
 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 bool isUpdateThreadRunning ()=0
 Returns if the thread used to update all Audio Managers is running. More...
 
virtual IAudioSourcegetSoundByName (const char *name)=0
 Returns an Audio Source by its "name" and NULL if the name is not found. More...
 
virtual void releaseAllSources ()=0
 Releases ALL Audio Sources (but does not shutdown the manager)
 
virtual void release (IAudioSource *source)=0
 Releases a single Audio Source, removing it from the manager. More...
 
virtual IAudioSourceplay2D (const char *filename, bool playLooped=false, bool startPaused=false)=0
 Creates an Audio Source object using the highest priority data source that has the referenced filename. More...
 
virtual IAudioSourceplay3D (const char *filename, cVector3 position, bool playLooped=false, bool startPaused=false)=0
 Creates an Audio Source object using the highest priority data source that has the referenced filename. More...
 
virtual void setMasterVolume (float vol)=0
 Sets master volume. (valid range [0 - 1.0])
 
virtual float getMasterVolume () const =0
 Get the master volume.
 
virtual void setSpeedOfSound (float speed)=0
 Set Speed of Sound (for doppler computations)
 
virtual float getSpeedOfSound () const =0
 Get Speed of Sound (for doppler computations)
 
virtual void setDopplerFactor (float factor) const =0
 Set Doppler Factor.
 
virtual float getDopplerFactor () const =0
 Get Doppler Factor.
 
virtual void stopAllSounds ()=0
 Stops all playing sounds.
 
virtual IAudioSourcecreate (const char *name, const char *filename, bool stream=false)=0
 Creates an Audio Source object using the highest priority data source that has the referenced filename. More...
 
virtual IAudioSourcecreateFromMemory (const char *name, const char *data, size_t length, const char *extension)=0
 Creates an Audio Source from a memory buffer using a specific audio codec. More...
 
virtual IAudioSourcecreateFromRaw (const char *name, const char *data, size_t length, unsigned int frequency, AudioFormats format)=0
 Creates an Audio Source from raw audio data in a memory buffer. More...
 
virtual IAudioSourcecreateFromAudioBuffer (const char *name, AudioCaptureBuffer *pBiffer, unsigned int frequency, AudioFormats format)=0
 Creates an Audio Source from AudioCaptureBuffer in a memory buffer. More...
 
virtual IAudioBuffercreateBuffer (const char *filename)=0
 Creates a Audio Sample using the highest priority data source that has the referenced filename. More...
 
virtual IAudioSourcecreateStatic (IAudioBuffer *buffer)=0
 Creates an Audio Source from an Audio Buffer object (see createAudioBuffer()) More...
 
virtual bool registerAudioDecoder (IAudioDecoderFactory *factory, const char *extension)=0
 Register an Audio Decoder. More...
 
virtual void unRegisterAudioDecoder (const char *extension)=0
 Unregister a previously registered Audio Decoder. More...
 
virtual bool isAudioDecoderRegistered (const char *extension)=0
 Returns whether an audio decoder is currently registered for this file type. More...
 
virtual IAudioDecoderFactorygetAudioDecoderFactory (const char *extension)=0
 Returns a registered audio decoder factory. More...
 
virtual void unRegisterAllAudioDecoders ()=0
 Unregisters all attached Audio Decoders. More...
 
virtual bool registerDataSource (IDataSourceFactory *factory, const char *name, int priority)=0
 Registers a data source with this manager. More...
 
virtual void unRegisterDataSource (const char *name)=0
 Removes a previously registered data source. More...
 
virtual bool isDataSourceRegistered (const char *name)=0
 Returns whether a data source is currently registered under a certain name. More...
 
virtual IDataSourceFactorygetDataSourceFactory (const char *name)=0
 Returns a previously registered data source factory. More...
 
virtual void unRegisterAllDataSources ()=0
 Removes all previously registered data sources. More...
 
virtual void registerEventHandler (IManagerEventHandler *handler)=0
 Registers a new event handler with the manager. More...
 
virtual void unRegisterEventHandler (IManagerEventHandler *handler)=0
 Unregisters a previously registered event handler from the manager. More...
 
virtual void unRegisterAllEventHandlers ()=0
 Unregisters all previously registered event handlers from the manager. More...
 
virtual IListenergetListener ()=0
 Returns the interface for the listener.
 
virtual cAudioMutexgetMutex ()=0
 

Detailed Description

Interface for the playback capabilities of cAudio.

Definition at line 24 of file IAudioManager.h.

Member Function Documentation

virtual IAudioSource* cAudio::IAudioManager::create ( const char *  name,
const char *  filename,
bool  stream = false 
)
pure virtual

Creates an Audio Source object using the highest priority data source that has the referenced filename.

Parameters
name,:Name of the audio source.
filename,:Path to the file to load audio data from.
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.
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioBuffer* cAudio::IAudioManager::createBuffer ( const char *  filename)
pure virtual

Creates a Audio Sample using the highest priority data source that has the referenced filename.

Parameters
filename,:Path to the file to load audio data from.
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::createFromAudioBuffer ( const char *  name,
AudioCaptureBuffer pBiffer,
unsigned int  frequency,
AudioFormats  format 
)
pure virtual

Creates an Audio Source from AudioCaptureBuffer in a memory buffer.

Parameters
name,:Name of the audio source.
AudioCaptureBuffer,:Pointer to a AudioCaptureBuffer in memory to load the data from.
frequency,:Frequency (or sample rate) of the audio data.
format,:Format of the audio data.
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::createFromMemory ( const char *  name,
const char *  data,
size_t  length,
const char *  extension 
)
pure virtual

Creates an Audio Source from a memory buffer using a specific audio codec.

Parameters
name,:Name of the audio source.
data,:Pointer to a buffer in memory to load the data from.
length,:Length of the data buffer.
extension,:Extension for the audio codec of the data in the memory buffer.
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::createFromRaw ( const char *  name,
const char *  data,
size_t  length,
unsigned int  frequency,
AudioFormats  format 
)
pure virtual

Creates an Audio Source from raw audio data in a memory buffer.

Parameters
name,:Name of the audio source.
data,:Pointer to a buffer in memory to load the data from.
length,:Length of the data buffer.
frequency,:Frequency (or sample rate) of the audio data.
format,:Format of the audio data.
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::createStatic ( IAudioBuffer buffer)
pure virtual

Creates an Audio Source from an Audio Buffer object (see createAudioBuffer())

Parameters
buffer,:The buffer to play, or NULL to create an empty static source
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioDecoderFactory* cAudio::IAudioManager::getAudioDecoderFactory ( const char *  extension)
pure virtual

Returns a registered audio decoder factory.

Parameters
extension,:Extension for the audio decoder to return.
Returns
A pointer to the found factory or NULL if it could not be found.

Implemented in cAudio::cAudioManager.

virtual IDataSourceFactory* cAudio::IAudioManager::getDataSourceFactory ( const char *  name)
pure virtual

Returns a previously registered data source factory.

Parameters
name,:Name of the data source to return.
Returns
A pointer to the found factory or NULL if it could not be found.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::getSoundByName ( const char *  name)
pure virtual

Returns an Audio Source by its "name" and NULL if the name is not found.

Parameters
name,:Name of the audio source to retrieve.
Returns
Pointer to the audio source object or NULL if it could not be found.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::initialize ( const char *  deviceName = 0x0,
int  outputFrequency = -1,
int  eaxEffectSlots = 4 
)
pure virtual

Initializes the manager.

Parameters
deviceName,:Name of the device to create this manager for.
outputFrequency,:Frequency of the output audio or -1 for the device default.
eaxEffectSlots,:Number of EFX effect slots to request. Has no effect if EFX is not supported or compiled out.
Returns
True on success, False if initialization of OpenAL failed.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::isAudioDecoderRegistered ( const char *  extension)
pure virtual

Returns whether an audio decoder is currently registered for this file type.

Parameters
extension,:Extension for the audio decoder to check for.
Returns
True if the specified decoder is registered or False if not.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::isDataSourceRegistered ( const char *  name)
pure virtual

Returns whether a data source is currently registered under a certain name.

Parameters
name,:Name of the data source to check for.
Returns
True if the specified data source is registered or False if not.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::isUpdateThreadRunning ( )
pure virtual

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.

Returns
True if the thread is currently running, false otherwise.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::play2D ( const char *  filename,
bool  playLooped = false,
bool  startPaused = false 
)
pure virtual

Creates an Audio Source object using the highest priority data source that has the referenced filename.

Parameters
name,:Name of the audio source.
playLooped,:if the sound is looped a IAudioSource is returned
startPaused,:if false the sound plays asap
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual IAudioSource* cAudio::IAudioManager::play3D ( const char *  filename,
cVector3  position,
bool  playLooped = false,
bool  startPaused = false 
)
pure virtual

Creates an Audio Source object using the highest priority data source that has the referenced filename.

Parameters
name,:Name of the audio source.
position,:The start position of the sound.
playLooped,:if the sound is looped a IAudioSource is returned
startPaused,:if false the sound plays asap
Returns
A pointer to an Audio Source or NULL if creation failed.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::registerAudioDecoder ( IAudioDecoderFactory factory,
const char *  extension 
)
pure virtual

Register an Audio Decoder.

Parameters
factory,:Pointer to the factory instance to use.
extension,:Extension of the audio codec to register this decoder under. For example, .wav for a RIFF/wav decoder.
Returns
True on success, False if registration failed.

Implemented in cAudio::cAudioManager.

virtual bool cAudio::IAudioManager::registerDataSource ( IDataSourceFactory factory,
const char *  name,
int  priority 
)
pure virtual

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.
Parameters
factory,:Pointer to the data source factory to register.
name,:Name for the data source (ie. Zip Archive or FileSystem)
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.
Returns
True on success, False on failure to register.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::registerEventHandler ( IManagerEventHandler handler)
pure virtual

Registers a new event handler with the manager.

Parameters
handler,:Pointer to an event handler instance to register.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::release ( IAudioSource source)
pure virtual

Releases a single Audio Source, removing it from the manager.

Parameters
source,:Pointer to the source to release.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterAllAudioDecoders ( )
pure virtual

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.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterAllDataSources ( )
pure virtual

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.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterAllEventHandlers ( )
pure virtual

Unregisters all previously registered event handlers from the manager.

Note: Will not delete your event handler, you must take care of that yourself.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterAudioDecoder ( const char *  extension)
pure virtual

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.
Parameters
extension,:Extension for the audio decoder to remove.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterDataSource ( const char *  name)
pure virtual

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.
Parameters
name,:Name of the data source to unregister.

Implemented in cAudio::cAudioManager.

virtual void cAudio::IAudioManager::unRegisterEventHandler ( IManagerEventHandler handler)
pure virtual

Unregisters a previously registered event handler from the manager.

Note: Will not delete your event handler, you must take care of that yourself.
Parameters
handler,:Pointer to the event handler to remove.

Implemented in cAudio::cAudioManager.


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