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 #include "ik_ISoundMixedOutputReceiver.h" 00015 00016 00017 namespace irrklang 00018 { 00019 class IAudioStreamLoader; 00020 struct SInternalAudioInterface; 00021 00023 00026 class ISoundEngine : public virtual irrklang::IRefCounted 00027 { 00028 public: 00029 00031 00033 virtual const char* getDriverName() = 0; 00034 00036 00056 virtual ISound* play2D(const char* soundFileName, 00057 bool playLooped = false, 00058 bool startPaused = false, 00059 bool track = false, 00060 E_STREAM_MODE streamMode = ESM_AUTO_DETECT, 00061 bool enableSoundEffects = false) = 0; 00062 00064 00084 virtual ISound* play2D(ISoundSource* source, 00085 bool playLooped = false, 00086 bool startPaused = false, 00087 bool track = false, 00088 bool enableSoundEffects = false) = 0; 00089 00091 00113 virtual ISound* play3D(const char* soundFileName, vec3df pos, 00114 bool playLooped = false, 00115 bool startPaused = false, 00116 bool track = false, 00117 E_STREAM_MODE streamMode = ESM_AUTO_DETECT, 00118 bool enableSoundEffects = false) = 0; 00119 00121 00142 virtual ISound* play3D(ISoundSource* source, vec3df pos, 00143 bool playLooped = false, 00144 bool startPaused = false, 00145 bool track = false, 00146 bool enableSoundEffects = false) = 0; 00147 00149 virtual void stopAllSounds() = 0; 00150 00152 virtual void setAllSoundsPaused( bool bPaused = true ) = 0; 00153 00155 00165 virtual ISoundSource* getSoundSource(const ik_c8* soundName, bool addIfNotFound=true) = 0; 00166 00168 00173 virtual ISoundSource* getSoundSource(ik_s32 index) = 0; 00174 00176 virtual ik_s32 getSoundSourceCount() = 0; 00177 00179 00190 virtual ISoundSource* addSoundSourceFromFile(const ik_c8* fileName, E_STREAM_MODE mode=ESM_AUTO_DETECT, 00191 bool preload=false) = 0; 00192 00194 00210 virtual ISoundSource* addSoundSourceFromMemory(void* memory, ik_s32 sizeInBytes, const ik_c8* soundName, 00211 bool copyMemory=true) = 0; 00212 00213 00215 00227 virtual ISoundSource* addSoundSourceFromPCMData(void* memory, ik_s32 sizeInBytes, 00228 const ik_c8* soundName, SAudioStreamFormat format, 00229 bool copyMemory=true) = 0; 00230 00232 00241 virtual ISoundSource* addSoundSourceAlias(ISoundSource* baseSource, const ik_c8* soundName) = 0; 00242 00244 00249 virtual void removeSoundSource(ISoundSource* source) = 0; 00250 00252 00257 virtual void removeSoundSource(const ik_c8* name) = 0; 00258 00260 00263 virtual void removeAllSoundSources() = 0; 00264 00266 00267 virtual void setSoundVolume(ik_f32 volume) = 0; 00268 00270 /* A value between 0.0 and 1.0. Default is 1.0. Can be changed using setSoundVolume(). */ 00271 virtual ik_f32 getSoundVolume() = 0; 00272 00274 00283 virtual void setListenerPosition(const vec3df& pos, 00284 const vec3df& lookdir, 00285 const vec3df& velPerSecond = vec3df(0,0,0), 00286 const vec3df& upVector = vec3df(0,1,0)) = 0; 00287 00289 00294 virtual void update() = 0; 00295 00297 virtual bool isCurrentlyPlaying(const char* soundName) = 0; 00298 00300 virtual bool isCurrentlyPlaying(ISoundSource* source) = 0; 00301 00303 00306 virtual void registerAudioStreamLoader(IAudioStreamLoader* loader) = 0; 00307 00309 00310 virtual bool isMultiThreaded() const = 0; 00311 00313 00315 virtual void addFileFactory(IFileFactory* fileFactory) = 0; 00316 00318 00325 virtual void setDefault3DSoundMinDistance(ik_f32 minDistance) = 0; 00326 00328 00334 virtual ik_f32 getDefault3DSoundMinDistance() = 0; 00335 00337 00348 virtual void setDefault3DSoundMaxDistance(ik_f32 maxDistance) = 0; 00349 00351 00361 virtual ik_f32 getDefault3DSoundMaxDistance() = 0; 00362 00364 00367 virtual void setRolloffFactor(ik_f32 rolloff) = 0; 00368 00370 00378 virtual void setDopplerEffectParameters(ik_f32 dopplerFactor=1.0f, ik_f32 distanceFactor=1.0f) = 0; 00379 00381 00390 virtual bool loadPlugins(const ik_c8* path) = 0; 00391 00393 00395 virtual const SInternalAudioInterface& getInternalAudioInterface() = 0; 00396 00398 00402 virtual bool setMixedDataOutputReceiver(ISoundMixedOutputReceiver* receiver) = 0; 00403 }; 00404 00405 00407 00408 struct SInternalAudioInterface 00409 { 00411 void* pIDirectSound; 00412 00414 void* pIDirectSound8; 00415 00417 void* pWinMM_HWaveOut; 00418 00420 void* pALSA_SND_PCM; 00421 00423 ik_u32 pCoreAudioDeciceID; 00424 }; 00425 00426 00427 00428 } // end namespace irrklang 00429 00430 00431 #endif
The irrKlang
Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated
by Doxygen
(1.6.1) |