00001 // Copyright (C) 2002-2018 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 00212 virtual ISoundSource* addSoundSourceFromMemory(void* memory, ik_s32 sizeInBytes, const ik_c8* soundName, 00213 bool copyMemory=true) = 0; 00214 00215 00217 00229 virtual ISoundSource* addSoundSourceFromPCMData(void* memory, ik_s32 sizeInBytes, 00230 const ik_c8* soundName, SAudioStreamFormat format, 00231 bool copyMemory=true) = 0; 00232 00234 00243 virtual ISoundSource* addSoundSourceAlias(ISoundSource* baseSource, const ik_c8* soundName) = 0; 00244 00246 00251 virtual void removeSoundSource(ISoundSource* source) = 0; 00252 00254 00259 virtual void removeSoundSource(const ik_c8* name) = 0; 00260 00262 00265 virtual void removeAllSoundSources() = 0; 00266 00268 00269 virtual void setSoundVolume(ik_f32 volume) = 0; 00270 00272 /* A value between 0.0 and 1.0. Default is 1.0. Can be changed using setSoundVolume(). */ 00273 virtual ik_f32 getSoundVolume() = 0; 00274 00276 00285 virtual void setListenerPosition(const vec3df& pos, 00286 const vec3df& lookdir, 00287 const vec3df& velPerSecond = vec3df(0,0,0), 00288 const vec3df& upVector = vec3df(0,1,0)) = 0; 00289 00291 00296 virtual void update() = 0; 00297 00299 virtual bool isCurrentlyPlaying(const char* soundName) = 0; 00300 00302 virtual bool isCurrentlyPlaying(ISoundSource* source) = 0; 00303 00305 virtual void stopAllSoundsOfSoundSource(ISoundSource* source) = 0; 00306 00308 00311 virtual void registerAudioStreamLoader(IAudioStreamLoader* loader) = 0; 00312 00314 00315 virtual bool isMultiThreaded() const = 0; 00316 00318 00320 virtual void addFileFactory(IFileFactory* fileFactory) = 0; 00321 00323 00330 virtual void setDefault3DSoundMinDistance(ik_f32 minDistance) = 0; 00331 00333 00339 virtual ik_f32 getDefault3DSoundMinDistance() = 0; 00340 00342 00353 virtual void setDefault3DSoundMaxDistance(ik_f32 maxDistance) = 0; 00354 00356 00366 virtual ik_f32 getDefault3DSoundMaxDistance() = 0; 00367 00369 00372 virtual void setRolloffFactor(ik_f32 rolloff) = 0; 00373 00375 00383 virtual void setDopplerEffectParameters(ik_f32 dopplerFactor=1.0f, ik_f32 distanceFactor=1.0f) = 0; 00384 00386 00395 virtual bool loadPlugins(const ik_c8* path) = 0; 00396 00398 00400 virtual const SInternalAudioInterface& getInternalAudioInterface() = 0; 00401 00403 00407 virtual bool setMixedDataOutputReceiver(ISoundMixedOutputReceiver* receiver) = 0; 00408 }; 00409 00410 00412 00413 struct SInternalAudioInterface 00414 { 00416 void* pIDirectSound; 00417 00419 void* pIDirectSound8; 00420 00422 void* pWinMM_HWaveOut; 00423 00425 void* pALSA_SND_PCM; 00426 00428 ik_u32 pCoreAudioDeciceID; 00429 }; 00430 00431 00432 00433 } // end namespace irrklang 00434 00435 00436 #endif
The irrKlang
Engine Documentation © 2003-2018 by Nikolaus Gebhardt. Generated
by Doxygen
(1.6.1) |