MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / Update

Method Update

CrySoundSystem/SoundSystem.cpp:580–1029  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

578
579//////////////////////////////////////////////////////////////////////
580void CSoundSystem::Update()
581{
582 GUARD_HEAP;
583 FUNCTION_PROFILER( GetSystem(),PROFILE_SOUND );
584
585 // check if volume has changed
586 if (Ffabs(m_pCVarMusicVolume->GetFVal()-m_fMusicVolume)>0.2f)
587 {
588 if (m_pCVarMusicVolume->GetFVal()<0)
589 m_pCVarMusicVolume->Set(0.0f);
590 m_fMusicVolume=m_pCVarMusicVolume->GetFVal();
591 }
592
593 if (m_pCVarSFXVolume->GetFVal()<0)
594 m_pCVarSFXVolume->Set(0.0f);
595
596 if (m_pCVarSFXVolume->GetFVal()>1.0f)
597 m_pCVarSFXVolume->Set(1.0f);
598
599 if ((Ffabs(m_pCVarSFXVolume->GetFVal()-m_fSFXVolume)>0.2f))
600 {
601 m_fSFXVolume=m_pCVarSFXVolume->GetFVal();
602
603 // call set volume for each sound so it can rescale itself
604 for (SoundListItor It=m_vecSounds.begin();It!=m_vecSounds.end();It++)
605 {
606 CSound *cs=(*It);
607 if (cs->m_nFlags & FLAG_SOUND_MUSIC)
608 continue;
609 cs->SetVolume(cs->GetVolume());
610 } // It
611 }
612
613 if (m_pISystem && m_pCVarSoundInfo->GetIVal())
614 {
615 IRenderer *pRenderer=m_pISystem->GetIRenderer();
616 if (pRenderer)
617 {
618 int nChannels = CSound::m_PlayingChannels;
619 float x = 40;
620 float fColor[4]={1.0f, 1.0f, 1.0f, 0.7f};
621 float fColorRed[4]={1.0f, 0.0f, 0.0f, 0.7f};
622 float fColorYellow[4]={1.0f, 1.0f, 0.0f, 0.7f};
623 float fColorGreen[4]={0.0f, 1.0f, 0.0f, 0.7f};
624 pRenderer->Draw2dLabel(x, 1, 1, fColor, false, "SoundSystem[Debug]");
625 pRenderer->Draw2dLabel(x, 10, 1, fColor, false, " Current Voices: %d (Channels: %d), CPU-Mixing-Overhead: %3.1f", GetUsedVoices(),nChannels, GetCPUUsage());
626 pRenderer->Draw2dLabel(x, 20, 1, fColor, false, " Loaded SoundBuffers: %d (%d)", m_nBuffersLoaded,m_soundBuffers.size());
627 pRenderer->Draw2dLabel(x, 30, 1, fColor, false, " SoundSpots-Active: %d, Inactive: %d", (int)m_lstSoundSpotsActive.size(), (int)m_lstSoundSpotsInactive.size());
628 if (!m_bValidPos)
629 {
630 pRenderer->Draw2dLabel(x, 40, 1, fColor, false, "Listener invalid!");
631 }
632 else
633 {
634 if (m_bInside)
635 pRenderer->Draw2dLabel(x, 40, 1, fColor, false, "Listener INSIDE: Vis area=: %s",m_pVisArea->GetName());
636 else
637 pRenderer->Draw2dLabel(x, 40, 1, fColor, false, "Listener OUTSIDE ");

Callers

nothing calls this directly

Calls 15

FfabsFunction · 0.85
GetLengthSquaredFunction · 0.85
cry_ceilfFunction · 0.85
GetFValMethod · 0.80
GetIValMethod · 0.80
Draw2dLabelMethod · 0.80
IsPlayingOnChannelMethod · 0.80
IsUsingChannelMethod · 0.80
GetSampleMethod · 0.80
LoadFailureMethod · 0.80
IsPlayLengthExpiredMethod · 0.80
FadeOutMethod · 0.80

Tested by

no test coverage detected