Skip to content

Commit cb45e62

Browse files
committed
perf(audio): guard addAudioEvent optimization with RETAIL_COMPATIBLE_CRC flag
1 parent 360da94 commit cb45e62

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Core/GameEngine/Source/Common/Audio/GameAudio.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272

7373
///////////////////////////////////////////////////////////////////////////////////////////////////
7474

75+
#if !RETAIL_COMPATIBLE_CRC
7576
static const AsciiString s_noSoundString("NoSound");
77+
#endif
7678

7779
static const char* TheSpeakerTypes[] =
7880
{
@@ -409,7 +411,11 @@ void AudioManager::getInfoForAudioEvent( const AudioEventRTS *eventToFindAndFill
409411
//-------------------------------------------------------------------------------------------------
410412
AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd)
411413
{
414+
#if RETAIL_COMPATIBLE_CRC
415+
if (eventToAdd->getEventName().isEmpty() || eventToAdd->getEventName() == AsciiString("NoSound")) {
416+
#else
412417
if (eventToAdd->getEventName().isEmpty() || eventToAdd->getEventName() == s_noSoundString) {
418+
#endif
413419
return AHSV_NoSound;
414420
}
415421

@@ -445,11 +451,13 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd)
445451
return AHSV_NoSound;
446452
}
447453

454+
#if !RETAIL_COMPATIBLE_CRC
448455
if (!eventToAdd->getUninterruptable()) {
449456
if (!shouldPlayLocally(eventToAdd)) {
450457
return AHSV_NotForLocal;
451458
}
452459
}
460+
#endif
453461

454462
AudioEventRTS *audioEvent = MSGNEW("AudioEventRTS") AudioEventRTS(*eventToAdd); // poolify
455463
audioEvent->setPlayingHandle( allocateNewHandle() );
@@ -465,6 +473,15 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd)
465473
}
466474
}
467475

476+
#if RETAIL_COMPATIBLE_CRC
477+
if (!audioEvent->getUninterruptable()) {
478+
if (!shouldPlayLocally(audioEvent)) {
479+
releaseAudioEventRTS(audioEvent);
480+
return AHSV_NotForLocal;
481+
}
482+
}
483+
#endif
484+
468485
// cull muted audio
469486
if (audioEvent->getVolume() < m_audioSettings->m_minVolume) {
470487
#ifdef INTENSIVE_AUDIO_DEBUG

0 commit comments

Comments
 (0)