MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / InitializeSound

Method InitializeSound

apps/cwr/Game/GameApplication.cpp:1417–1446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1415
1416bool GameApplication::InitializeSound()
1417{
1418 extern void CleanupSoundSystem();
1419 CleanupSoundSystem();
1420
1421 extern IAudioSystem* CreateAudioSystem(void* hwnd, bool noSound, bool isDedicatedServer);
1422#ifdef _WIN32
1423 GSoundsys = CreateAudioSystem(GApp->m_hwnd, ENGINE_CONFIG.noSound, false);
1424#else
1425 GSoundsys = CreateAudioSystem(nullptr, ENGINE_CONFIG.noSound, false);
1426#endif
1427
1428 if (!GSoundsys)
1429 {
1430 return false;
1431 }
1432
1433 // Load (or create defaults for) audio.cfg. This is the eager-write
1434 // boot dance: file missing → write defaults; file present →
1435 // Normalize against live device lists, apply normalized values to
1436 // the runtime, but do NOT persist normalization (a temporarily
1437 // unplugged device must not silently lose its remembered name).
1438 // The Pester smoke test exercises this via --check + an ephemeral
1439 // POSEIDON_USER_DIR.
1440 GSoundsys->LoadConfig();
1441
1442 GSoundScene = CreateSoundScene();
1443
1444 return true;
1445}
1446
1447void GameApplication::RegisterAudioBackends()
1448{
1449 Poseidon::RegisterDummyAudioBackend();

Callers 1

Calls 4

CleanupSoundSystemFunction · 0.85
CreateAudioSystemFunction · 0.85
CreateSoundSceneFunction · 0.85
LoadConfigMethod · 0.45

Tested by

no test coverage detected