cAudio
2.3.0
3d Audio Engine
|
9 #include "cAudioEffects.h"
10 #include "cMemoryOverride.h"
11 #include "IAudioDecoderFactory.h"
12 #include "IAudioManager.h"
13 #include "cSTLAllocator.h"
14 #include "cAudioString.h"
16 #include "IAudioDeviceContext.h"
32 ON_DATASOURCEREGISTER,
35 cAudioManager() : Initialized(
false), AudioThread(NULL), AudioContext(NULL), MasterVolume(1.0f) { }
38 virtual bool initialize(
const char* deviceName = 0x0,
int outputFrequency = -1,
int eaxEffectSlots = 4);
45 virtual IAudioSource*
play2D(
const char* filename,
bool playLooped =
false,
bool startPaused =
false);
56 virtual IAudioSource*
create(
const char* name,
const char* filename,
bool stream =
false);
84 #if CAUDIO_EFX_ENABLED == 1
85 virtual IAudioEffects* getEffects();
93 IAudioSource* createAudioSource(IAudioDecoder* decoder,
const cAudioString& audioName,
const cAudioString& dataSource);
103 IThread* AudioThread;
105 IAudioDeviceContext* AudioContext;
110 cAudioMap<cAudioString, IAudioSource*>::Type audioIndex;
111 typedef cAudioMap<cAudioString, IAudioSource*>::Type::iterator audioIndexIterator;
113 cAudioVector<IAudioSource*>::Type audioSources;
114 cAudioVector<IAudioSource*>::Type updateSources;
116 cAudioVector<IAudioSource*>::Type managedAudioSources;
118 cAudioVector<IAudioSource*>::Type managedAudioSourcesDelBuffer;
120 cAudioMap<cAudioString, IAudioDecoderFactory*>::Type decodermap;
121 typedef cAudioMap<cAudioString, IAudioDecoderFactory*>::Type::iterator decodermapIterator;
123 cAudioMap<cAudioString, IDataSourceFactory*>::Type datasourcemap;
124 typedef cAudioMap<cAudioString, IDataSourceFactory*>::Type::iterator datasourcemapIterator;
125 cAudioVector< std::pair<int, cAudioString> >::Type dataSourcePriorityList;
128 cListener initlistener;
131 void signalEvent(Events sevent);
134 cAudioList<IManagerEventHandler*>::Type eventHandlerList;
AudioFormats
Enumeration of audio formats supported by the engine.
virtual IAudioSource * createFromMemory(const char *name, const char *data, size_t length, const char *extension)
Creates an Audio Source from a memory buffer using a specific audio codec.
virtual void unRegisterAllDataSources()
Removes all previously registered data sources.
virtual void releaseAllSources()
Releases ALL Audio Sources (but does not shutdown the manager)
virtual void setSpeedOfSound(float speed)
Set Speed of Sound (for doppler computations)
Interface for factories that create Audio Decoders for cAudio.
virtual void unRegisterEventHandler(IManagerEventHandler *handler)
Unregisters a previously registered event handler from the manager.
virtual float getSpeedOfSound() const
Get Speed of Sound (for doppler computations)
Overrides the memory allocations for classes derived from it and makes them use the cAudio memory sys...
virtual IDataSourceFactory * getDataSourceFactory(const char *name)
Returns a previously registered data source factory.
Interface for event handlers for playback manager events.
virtual IAudioSource * createFromRaw(const char *name, const char *data, size_t length, unsigned int frequency, AudioFormats format)
Creates an Audio Source from raw audio data in a memory buffer.
interface for a sample (audio buffer): completely loaded into memory, shareable across sources
Class for manipulating vectors in 3D space.
virtual void stopAllSounds()
Stops all playing sounds.
virtual bool registerAudioDecoder(IAudioDecoderFactory *factory, const char *extension)
Register an Audio Decoder.
virtual IAudioSource * createFromAudioBuffer(const char *name, AudioCaptureBuffer *pBiffer, unsigned int frequency, AudioFormats format)
Creates an Audio Source from AudioCaptureBuffer in a memory buffer.
Main namespace for the entire cAudio library.
virtual bool isDataSourceRegistered(const char *name)
Returns whether a data source is currently registered under a certain name.
virtual float getDopplerFactor() const
Get Doppler Factor.
virtual void update()
If threading is disabled, you must call this function every frame to update the playback buffers of a...
virtual void release(IAudioSource *source)
Releases a single Audio Source, removing it from the manager.
virtual IAudioSource * create(const char *name, const char *filename, bool stream=false)
Creates an Audio Source object using the highest priority data source that has the referenced filenam...
virtual void unRegisterAllEventHandlers()
Unregisters all previously registered event handlers from the manager.
virtual IAudioSource * play2D(const char *filename, bool playLooped=false, bool startPaused=false)
Creates an Audio Source object using the highest priority data source that has the referenced filenam...
virtual bool registerDataSource(IDataSourceFactory *factory, const char *name, int priority)
Registers a data source with this manager.
virtual bool isUpdateThreadRunning()
Returns if the thread used to update all Audio Managers is running.
virtual float getMasterVolume() const
Get the master volume.
virtual IListener * getListener()
Returns the interface for the listener.
virtual IAudioSource * getSoundByName(const char *name)
Returns an Audio Source by its "name" and NULL if the name is not found.
virtual void unRegisterAudioDecoder(const char *extension)
Unregister a previously registered Audio Decoder.
virtual IAudioSource * createStatic(IAudioBuffer *buffer)
Creates an Audio Source from an Audio Buffer object (see createAudioBuffer())
Interface for the playback capabilities of cAudio.
virtual IAudioBuffer * createBuffer(const char *filename)
Creates a Audio Sample using the highest priority data source that has the referenced filename.
Interface for creating data sources for use with the engine.
virtual IAudioDecoderFactory * getAudioDecoderFactory(const char *extension)
Returns a registered audio decoder factory.
virtual void shutDown()
Shuts the manager down, cleaning up audio sources in the process. Does not clean up decoders,...
virtual bool isAudioDecoderRegistered(const char *extension)
Returns whether an audio decoder is currently registered for this file type.
virtual bool initialize(const char *deviceName=0x0, int outputFrequency=-1, int eaxEffectSlots=4)
Initializes the manager.
Interface for the listener in cAudio. This class provides abilities to move and orient where your cam...
virtual void unRegisterDataSource(const char *name)
Removes a previously registered data source.
Interface for a single audio source, which allow you to manipulate sound sources (speakers) in 2D or ...
virtual IAudioSource * play3D(const char *filename, cVector3 position, bool playLooped=false, bool startPaused=false)
Creates an Audio Source object using the highest priority data source that has the referenced filenam...
virtual void unRegisterAllAudioDecoders()
Unregisters all attached Audio Decoders.
virtual void setDopplerFactor(float factor) const
Set Doppler Factor.
virtual void setMasterVolume(float vol)
Sets master volume. (valid range [0 - 1.0])
virtual void registerEventHandler(IManagerEventHandler *handler)
Registers a new event handler with the manager.