cAudio  2.3.0
3d Audio Engine
IAudioManager.h
1 // Copyright (c) 2008-2011 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones, Murat (wolfmanfx) Sari
2 // This file is part of the "cAudio Engine"
3 // For conditions of distribution and use, see copyright notice in cAudio.h
4 
5 #pragma once
6 
7 #include "IListener.h"
8 #include "cAudioDefines.h"
9 #include "EAudioFormats.h"
10 #include "IAudioEffects.h"
11 #include "IDataSourceFactory.h"
12 #include "IManagerEventHandler.h"
13 #include <string>
14 
15 namespace cAudio
16 {
17  class IAudioSource;
18  class IAudioBuffer;
19  class IAudioDecoderFactory;
20  class AudioCaptureBuffer;
21  class cAudioMutex;
22 
25  {
26  public:
27  IAudioManager() { }
28  virtual ~IAudioManager() { }
29 
31 
36  virtual bool initialize(const char* deviceName = 0x0, int outputFrequency = -1, int eaxEffectSlots = 4) = 0;
37 
39  virtual void shutDown() = 0;
40 
42  virtual void update() = 0;
43 
45 
49  virtual bool isUpdateThreadRunning() = 0;
50 
52 
55  virtual IAudioSource* getSoundByName(const char* name) = 0;
56 
58  virtual void releaseAllSources() = 0;
59 
61 
62  virtual void release(IAudioSource* source) = 0;
63 
65 
71  virtual IAudioSource* play2D(const char* filename,
72  bool playLooped = false,
73  bool startPaused = false) = 0;
74 
76 
83  virtual IAudioSource* play3D(const char* filename,
84  cVector3 position,
85  bool playLooped = false,
86  bool startPaused = false) = 0;
87 
89  virtual void setMasterVolume(float vol) = 0;
90 
92  virtual float getMasterVolume() const = 0;
93 
95  virtual void setSpeedOfSound(float speed) = 0;
96 
98  virtual float getSpeedOfSound() const = 0;
99 
101  virtual void setDopplerFactor(float factor) const = 0;
102 
104  virtual float getDopplerFactor() const = 0;
105 
107  virtual void stopAllSounds() = 0;
108 
110 
116  virtual IAudioSource* create(const char* name, const char* filename, bool stream = false) = 0;
117 
119 
126  virtual IAudioSource* createFromMemory(const char* name, const char* data, size_t length, const char* extension) = 0;
127 
129 
137  virtual IAudioSource* createFromRaw(const char* name, const char* data, size_t length, unsigned int frequency, AudioFormats format) = 0;
138 
139 
141 
148  virtual IAudioSource* createFromAudioBuffer(const char* name, AudioCaptureBuffer* pBiffer, unsigned int frequency, AudioFormats format) = 0;
149 
151 
155  virtual IAudioBuffer* createBuffer(const char* filename) = 0;
156 
158 
162  virtual IAudioSource* createStatic(IAudioBuffer* buffer) = 0;
163 
165 
169  virtual bool registerAudioDecoder(IAudioDecoderFactory* factory, const char* extension) = 0;
170 
172 
174  virtual void unRegisterAudioDecoder(const char* extension) = 0;
175 
177 
180  virtual bool isAudioDecoderRegistered(const char* extension) = 0;
181 
183 
186  virtual IAudioDecoderFactory* getAudioDecoderFactory(const char* extension) = 0;
187 
189 
190  virtual void unRegisterAllAudioDecoders() = 0;
191 
193 
198  virtual bool registerDataSource(IDataSourceFactory* factory, const char* name, int priority) = 0;
199 
201 
203  virtual void unRegisterDataSource(const char* name) = 0;
204 
206 
209  virtual bool isDataSourceRegistered(const char* name) = 0;
210 
212 
215  virtual IDataSourceFactory* getDataSourceFactory(const char* name) = 0;
216 
218 
219  virtual void unRegisterAllDataSources() = 0;
220 
222 
224  virtual void registerEventHandler(IManagerEventHandler* handler) = 0;
225 
227 
229  virtual void unRegisterEventHandler(IManagerEventHandler* handler) = 0;
230 
232 
233  virtual void unRegisterAllEventHandlers() = 0;
234 
236  virtual IListener* getListener() = 0;
237 
238  virtual cAudioMutex *getMutex() = 0;
239 
240 #if CAUDIO_EFX_ENABLED == 1
241  virtual IAudioEffects* getEffects() = 0;
243 #endif
244 
245  protected:
246  private:
247  };
248 }
virtual void setSpeedOfSound(float speed)=0
Set Speed of Sound (for doppler computations)
virtual bool registerDataSource(IDataSourceFactory *factory, const char *name, int priority)=0
Registers a data source with this manager.
virtual bool isAudioDecoderRegistered(const char *extension)=0
Returns whether an audio decoder is currently registered for this file type.
virtual IAudioSource * getSoundByName(const char *name)=0
Returns an Audio Source by its "name" and NULL if the name is not found.
virtual IAudioSource * createFromMemory(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.
virtual bool isDataSourceRegistered(const char *name)=0
Returns whether a data source is currently registered under a certain name.
virtual void unRegisterAllDataSources()=0
Removes all previously registered data sources.
Interface for the playback capabilities of cAudio.
Definition: IAudioManager.h:24
virtual IAudioBuffer * createBuffer(const char *filename)=0
Creates a Audio Sample using the highest priority data source that has the referenced filename...
virtual float getDopplerFactor() const =0
Get Doppler Factor.
virtual bool isUpdateThreadRunning()=0
Returns if the thread used to update all Audio Managers is running.
virtual IAudioSource * createStatic(IAudioBuffer *buffer)=0
Creates an Audio Source from an Audio Buffer object (see createAudioBuffer())
virtual void unRegisterDataSource(const char *name)=0
Removes a previously registered data source.
virtual float getSpeedOfSound() const =0
Get Speed of Sound (for doppler computations)
virtual void unRegisterAudioDecoder(const char *extension)=0
Unregister a previously registered Audio Decoder.
virtual void unRegisterAllEventHandlers()=0
Unregisters all previously registered event handlers from the manager.
virtual IAudioDecoderFactory * getAudioDecoderFactory(const char *extension)=0
Returns a registered audio decoder factory.
Interface for event handlers for playback manager events.
Interface for factories that create Audio Decoders for cAudio.
Interface for a single audio source, which allow you to manipulate sound sources (speakers) in 2D or ...
Definition: IAudioSource.h:32
virtual float getMasterVolume() const =0
Get the master volume.
Interface for the listener in cAudio. This class provides abilities to move and orient where your cam...
Definition: IListener.h:13
virtual IAudioSource * createFromRaw(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.
virtual bool registerAudioDecoder(IAudioDecoderFactory *factory, const char *extension)=0
Register an Audio Decoder.
virtual IAudioSource * create(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 filenam...
Class for manipulating vectors in 3D space.
Definition: cVector3.h:22
virtual IDataSourceFactory * getDataSourceFactory(const char *name)=0
Returns a previously registered data source factory.
virtual void releaseAllSources()=0
Releases ALL Audio Sources (but does not shutdown the manager)
virtual bool initialize(const char *deviceName=0x0, int outputFrequency=-1, int eaxEffectSlots=4)=0
Initializes the manager.
virtual IAudioSource * play3D(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 filenam...
virtual void update()=0
If threading is disabled, you must call this function every frame to update the playback buffers of a...
virtual void unRegisterEventHandler(IManagerEventHandler *handler)=0
Unregisters a previously registered event handler from the manager.
virtual void release(IAudioSource *source)=0
Releases a single Audio Source, removing it from the manager.
virtual void setDopplerFactor(float factor) const =0
Set Doppler Factor.
Interface for creating data sources for use with the engine.
virtual void stopAllSounds()=0
Stops all playing sounds.
virtual void unRegisterAllAudioDecoders()=0
Unregisters all attached Audio Decoders.
virtual IListener * getListener()=0
Returns the interface for the listener.
interface for a sample (audio buffer): completely loaded into memory, shareable across sources ...
Definition: IAudioSource.h:18
virtual void setMasterVolume(float vol)=0
Sets master volume. (valid range [0 - 1.0])
virtual void shutDown()=0
Shuts the manager down, cleaning up audio sources in the process. Does not clean up decoders...
virtual IAudioSource * play2D(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 filenam...
AudioFormats
Enumeration of audio formats supported by the engine.
Definition: EAudioFormats.h:10
virtual void registerEventHandler(IManagerEventHandler *handler)=0
Registers a new event handler with the manager.
Main namespace for the entire cAudio library.
Definition: cAudioCapture.h:15
virtual IAudioSource * createFromAudioBuffer(const char *name, AudioCaptureBuffer *pBiffer, unsigned int frequency, AudioFormats format)=0
Creates an Audio Source from AudioCaptureBuffer in a memory buffer.