OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4SoundSystem.h File Reference
Include dependency graph for C4SoundSystem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  C4SoundSystem
 

Functions

C4SoundInstanceStartSoundEffect (const char *szSndName, bool fLoop=false, int32_t iVolume=100, C4Object *pObj=nullptr, int32_t iCustomFalloffDistance=0, int32_t iPitch=0, C4SoundModifier *modifier=nullptr)
 
C4SoundInstanceStartSoundEffectAt (const char *szSndName, int32_t iX, int32_t iY, int32_t iVolume=100, int32_t iCustomFallofDistance=0, int32_t iPitch=0, C4SoundModifier *modifier=nullptr)
 
C4SoundInstanceGetSoundInstance (const char *szSndName, C4Object *pObj)
 
void StopSoundEffect (const char *szSndName, C4Object *pObj)
 
void SoundLevel (const char *szSndName, C4Object *pObj, int32_t iLevel)
 
void SoundPan (const char *szSndName, C4Object *pObj, int32_t iPan)
 
void SoundPitch (const char *szSndName, C4Object *pObj, int32_t iPitch)
 
void SoundUpdate (C4SoundInstance *inst, int32_t iLevel, int32_t iPitch)
 

Variables

const int32_t C4MaxSoundName =100
 
const int32_t C4MaxSoundInstances =20
 
const int32_t C4NearSoundRadius =50
 
const int32_t C4AudibilityRadius =700
 
const int32_t SoundUnloadTime =60
 
const int32_t SoundMaxUnloadSize =100000
 

Function Documentation

C4SoundInstance* GetSoundInstance ( const char *  szSndName,
C4Object pObj 
)

Definition at line 289 of file C4SoundSystem.cpp.

References Application, C4SoundSystem::FindInstance(), and C4Application::SoundSystem.

290 {
291  return Application.SoundSystem.FindInstance(szSndName, pObj);
292 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4SoundInstance * FindInstance(const char *szSound, C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

void SoundLevel ( const char *  szSndName,
C4Object pObj,
int32_t  iLevel 
)

Definition at line 302 of file C4SoundSystem.cpp.

References Application, C4SoundInstance::Execute(), C4SoundSystem::FindInstance(), C4SoundInstance::SetVolume(), C4Application::SoundSystem, StartSoundEffect(), and StopSoundEffect().

303 {
304  // Sound level zero? Stop
305  if (!iLevel) { StopSoundEffect(szSndName, pObj); return; }
306  // Find or create instance
307  C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
308  if (!pInst) pInst = StartSoundEffect(szSndName, true, iLevel, pObj);
309  if (!pInst) return;
310  // Set volume
311  pInst->SetVolume(iLevel);
312  pInst->Execute();
313 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void StopSoundEffect(const char *szSndName, C4Object *pObj)
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
void SetVolume(int32_t inVolume)
C4SoundInstance * FindInstance(const char *szSound, C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

void SoundPan ( const char *  szSndName,
C4Object pObj,
int32_t  iPan 
)

Definition at line 315 of file C4SoundSystem.cpp.

References Application, C4SoundInstance::Execute(), C4SoundSystem::FindInstance(), C4SoundInstance::SetPan(), and C4Application::SoundSystem.

316 {
317  // Find instance
318  C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
319  if (!pInst) return;
320  // Set pan
321  pInst->SetPan(iPan);
322  pInst->Execute();
323 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void SetPan(int32_t inPan)
C4SoundInstance * FindInstance(const char *szSound, C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

void SoundPitch ( const char *  szSndName,
C4Object pObj,
int32_t  iPitch 
)

Definition at line 325 of file C4SoundSystem.cpp.

References Application, C4SoundInstance::Execute(), C4SoundSystem::FindInstance(), C4SoundInstance::SetPitch(), and C4Application::SoundSystem.

326 {
327  // Find instance
328  C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
329  if (!pInst) return;
330  // Set pitch
331  pInst->SetPitch(iPitch);
332  pInst->Execute();
333 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void SetPitch(int32_t inPitch)
C4SoundInstance * FindInstance(const char *szSound, C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

void SoundUpdate ( C4SoundInstance inst,
int32_t  iLevel,
int32_t  iPitch 
)

Definition at line 335 of file C4SoundSystem.cpp.

References C4SoundInstance::Execute(), C4SoundInstance::SetPitch(), and C4SoundInstance::SetVolume().

336 {
337  // Set sound data
338  pInst->SetVolume(iLevel);
339  pInst->SetPitch(iPitch);
340  // Ensure it's reflected in audio engine
341  pInst->Execute();
342 }

Here is the call graph for this function:

C4SoundInstance* StartSoundEffect ( const char *  szSndName,
bool  fLoop = false,
int32_t  iVolume = 100,
C4Object pObj = nullptr,
int32_t  iCustomFalloffDistance = 0,
int32_t  iPitch = 0,
C4SoundModifier modifier = nullptr 
)

Definition at line 269 of file C4SoundSystem.cpp.

References Application, Config, C4SoundSystem::NewEffect(), C4ConfigSound::RXSound, C4Config::Sound, and C4Application::SoundSystem.

Referenced by C4ViewportList::CloseViewport(), C4ControlEMMoveObject::CreateObject(), C4ViewportList::CreateViewport(), C4Object::DirectComContents(), C4Player::DoWealth(), C4Player::Eliminate(), C4Object::ExecLife(), C4GUI::GUISound(), C4GameLobby::MainDlg::OnCountdownPacket(), C4GameLobby::MainDlg::OnError(), C4Object::Promote(), C4Game::QuickSave(), C4Object::SetAction(), C4Player::SetHostility(), SoundLevel(), StartSoundEffectAt(), and C4Player::Surrender().

270 {
271  // Sound check
272  if (!Config.Sound.RXSound) return nullptr;
273  // Start new
274  return Application.SoundSystem.NewEffect(szSndName, fLoop, iVolume, pObj, iCustomFalloffDistance, iPitch, modifier);
275 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Config Config
Definition: C4Config.cpp:837
int32_t RXSound
Definition: C4Config.h:127
C4SoundInstance * NewEffect(const char *szSound, bool fLoop=false, int32_t iVolume=100, C4Object *pObj=nullptr, int32_t iCustomFalloffDistance=0, int32_t iPitch=0, C4SoundModifier *modifier=nullptr)
C4ConfigSound Sound
Definition: C4Config.h:255
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

C4SoundInstance* StartSoundEffectAt ( const char *  szSndName,
int32_t  iX,
int32_t  iY,
int32_t  iVolume = 100,
int32_t  iCustomFallofDistance = 0,
int32_t  iPitch = 0,
C4SoundModifier modifier = nullptr 
)

Definition at line 41 of file stub-handle.cpp.

References Config, C4ConfigSound::RXSound, C4SoundInstance::SetVolumeByPos(), C4Config::Sound, and StartSoundEffect().

Referenced by C4MaterialMap::mrfCorrode(), and C4MaterialMap::mrfPoof().

41 { return nullptr; }

Here is the call graph for this function:

Here is the caller graph for this function:

void StopSoundEffect ( const char *  szSndName,
C4Object pObj 
)

Definition at line 294 of file C4SoundSystem.cpp.

References Application, C4SoundSystem::FindInstance(), C4Application::SoundSystem, and C4SoundInstance::Stop().

Referenced by C4Object::SetAction(), and SoundLevel().

295 {
296  // Find instance
297  C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
298  if (!pInst) return;
299  // Stop
300  pInst->Stop();
301 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4SoundInstance * FindInstance(const char *szSound, C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const int32_t C4AudibilityRadius =700

Definition at line 30 of file C4SoundSystem.h.

Referenced by C4SoundInstance::Execute(), and C4ViewportList::GetAudibility().

const int32_t C4MaxSoundInstances =20

Definition at line 28 of file C4SoundSystem.h.

Referenced by C4SoundSystem::Init(), and C4SoundEffect::New().

const int32_t C4MaxSoundName =100
const int32_t C4NearSoundRadius =50

Definition at line 29 of file C4SoundSystem.h.

Referenced by C4SoundInstance::CheckStart().

const int32_t SoundMaxUnloadSize =100000

Definition at line 32 of file C4SoundSystem.h.

const int32_t SoundUnloadTime =60

Definition at line 32 of file C4SoundSystem.h.