00001 // Copyright (C) 2002-2009 Nikolaus Gebhardt 00002 // This file is part of the "irrKlang" library. 00003 // For conditions of distribution and use, see copyright notice in irrKlang.h 00004 00005 #ifndef __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__ 00006 #define __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__ 00007 00008 #include "ik_IRefCounted.h" 00009 #include "ik_vec3d.h" 00010 #include "ik_ISoundSource.h" 00011 #include "ik_ISound.h" 00012 #include "ik_EStreamModes.h" 00013 #include "ik_IFileFactory.h" 00014 00015 00016 namespace irrklang 00017 { 00018 class IAudioStreamLoader; 00019 struct SInternalAudioInterface; 00020 00022 00025 class ISoundEngine : public virtual irrklang::IRefCounted 00026 { 00027 public: 00028 00030 00032 virtual const char* getDriverName() = 0; 00033 00035 00055 virtual ISound* play2D(const char* soundFileName, 00056 bool playLooped = false, 00057 bool startPaused = false, 00058 bool track = false, 00059 E_STREAM_MODE streamMode = ESM_AUTO_DETECT, 00060 bool enableSoundEffects = false) = 0; 00061 00063 00083 virtual ISound* play2D(ISoundSource* source, 00084 bool playLooped = false, 00085 bool startPaused = false, 00086 bool track = false, 00087 bool enableSoundEffects = false) = 0; 00088 00090 00112 virtual ISound* play3D(const char* soundFileName, vec3df pos, 00113 bool playLooped = false, 00114 bool startPaused = false, 00115 bool track = false, 00116 E_STREAM_MODE streamMode = ESM_AUTO_DETECT, 00117 bool enableSoundEffects = false) = 0; 00118 00120 00141 virtual ISound* play3D(ISoundSource* source, vec3df pos, 00142 bool playLooped = false, 00143 bool startPaused = false, 00144 bool track = false, 00145 bool enableSoundEffects = false) = 0; 00146 00148 virtual void stopAllSounds() = 0; 00149 00151 virtual void setAllSoundsPaused( bool bPaused = true ) = 0; 00152 00154 00164 virtual ISoundSource* getSoundSource(const ik_c8* soundName, bool addIfNotFound=true) = 0; 00165 00167 00172 virtual ISoundSource* getSoundSource(ik_s32 index) = 0; 00173 00175 virtual ik_s32 getSoundSourceCount() = 0; 00176 00178 00189 virtual ISoundSource* addSoundSourceFromFile(const ik_c8* fileName, E_STREAM_MODE mode=ESM_AUTO_DETECT, 00190 bool preload=false) = 0; 00191 00193 00209 virtual ISoundSource* addSoundSourceFromMemory(void* memory, ik_s32 sizeInBytes, const ik_c8* soundName, 00210 bool copyMemory=true) = 0; 00211 00212 00214 00226 virtual ISoundSource* addSoundSourceFromPCMData(void* memory, ik_s32 sizeInBytes, 00227 const ik_c8* soundName, SAudioStreamFormat format, 00228 bool copyMemory=true) = 0; 00229 00231 00240 virtual ISoundSource* addSoundSourceAlias(ISoundSource* baseSource, const ik_c8* soundName) = 0; 00241 00243 00248 virtual void removeSoundSource(ISoundSource* source) = 0; 00249 00251 00256 virtual void removeSoundSource(const ik_c8* name) = 0; 00257 00259 00262 virtual void removeAllSoundSources() = 0; 00263 00265 00266 virtual void setSoundVolume(ik_f32 volume) = 0; 00267 00269 /* A value between 0.0 and 1.0. Default is 1.0. Can be changed using setSoundVolume(). */ 00270 virtual ik_f32 getSoundVolume() = 0; 00271 00273 00282 virtual void setListenerPosition(const vec3df& pos, 00283 const vec3df& lookdir, 00284 const vec3df& velPerSecond = vec3df(0,0,0), 00285 const vec3df& upVector = vec3df(0,1,0)) = 0; 00286 00288 00293 virtual void update() = 0; 00294 00296 virtual bool isCurrentlyPlaying(const char* soundName) = 0; 00297 00299 virtual bool isCurrentlyPlaying(ISoundSource* source) = 0; 00300 00302 00305 virtual void registerAudioStreamLoader(IAudioStreamLoader* loader) = 0; 00306 00308 00309 virtual bool isMultiThreaded() const = 0; 00310 00312 00314 virtual void addFileFactory(IFileFactory* fileFactory) = 0; 00315 00317 00324 virtual void setDefault3DSoundMinDistance(ik_f32 minDistance) = 0; 00325 00327 00333 virtual ik_f32 getDefault3DSoundMinDistance() = 0; 00334 00336 00347 virtual void setDefault3DSoundMaxDistance(ik_f32 maxDistance) = 0; 00348 00350 00360 virtual ik_f32 getDefault3DSoundMaxDistance() = 0; 00361 00363 00366 virtual void setRolloffFactor(ik_f32 rolloff) = 0; 00367 00369 00377 virtual void setDopplerEffectParameters(ik_f32 dopplerFactor=1.0f, ik_f32 distanceFactor=1.0f) = 0; 00378 00380 00389 virtual bool loadPlugins(const ik_c8* path) = 0; 00390 00392 00394 virtual const SInternalAudioInterface& getInternalAudioInterface() = 0; 00395 }; 00396 00397 00399 00400 struct SInternalAudioInterface 00401 { 00403 void* pIDirectSound; 00404 00406 void* pIDirectSound8; 00407 00409 void* pWinMM_HWaveOut; 00410 00412 void* pALSA_SND_PCM; 00413 00415 ik_u32 pCoreAudioDeciceID; 00416 }; 00417 00418 00419 00420 } // end namespace irrklang 00421 00422 00423 #endif
The irrKlang
Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated
by Doxygen
(1.6.1) |