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

Method LoadConfig

engine/PoseidonOpenAL/SoundSystemOAL.cpp:632–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630 if (preset.flDecayTime < AL_EAXREVERB_MIN_DECAY_TIME)
631 preset.flDecayTime = AL_EAXREVERB_MIN_DECAY_TIME;
632 if (preset.flDecayTime > AL_EAXREVERB_MAX_DECAY_TIME)
633 preset.flDecayTime = AL_EAXREVERB_MAX_DECAY_TIME;
634
635 preset.flDensity = size / 100.0f;
636 if (preset.flDensity < AL_EAXREVERB_MIN_DENSITY)
637 preset.flDensity = AL_EAXREVERB_MIN_DENSITY;
638 if (preset.flDensity > AL_EAXREVERB_MAX_DENSITY)
639 preset.flDensity = AL_EAXREVERB_MAX_DENSITY;
640
641 ApplyEFXProperties(_efxEffect, _efxSlot, preset);
642 LOG_DEBUG(Audio, "EFX: applied preset '{}' size={}", presetName, size);
643 return true;
644}
645
646namespace
647{
648// Path to the system-global audio.cfg. Lives directly under the
649// user-data directory (NOT the per-profile Users/<name>/ subdir) —
650// audio is per-machine, not per-game-profile.
651std::string AudioConfigPath()
652{
653 const std::string& dir = GamePaths::Instance().UserDir();
654 // GamePaths guarantees a trailing slash.
655 return dir + "audio.cfg";
656}
657
658// AudioConfig::Environment impl backed by the live audio backend.
659// The output side reads from SoundSystemOAL, the input side from
660// VoNCapture (the same enumeration the picker UI uses, so a
661// user-selected name will round-trip cleanly).
662struct LiveAudioEnv : AudioConfig::Environment
663{
664 const SoundSystemOAL* sys;
665 explicit LiveAudioEnv(const SoundSystemOAL* s) : sys(s) {}
666 std::vector<std::string> ListOutputDevices() const override
667 {
668 return sys ? sys->ListOutputDevices() : std::vector<std::string>{};
669 }
670 std::vector<std::string> ListInputDevices() const override { return VoNCapture::listDevices(); }
671};
672} // namespace
673
674void SoundSystemOAL::LoadConfig()
675{
676 const std::string path = AudioConfigPath();

Callers

nothing calls this directly

Calls 6

AudioConfigPathFunction · 0.85
LoadMethod · 0.45
LoadDefaultsMethod · 0.45
SaveMethod · 0.45
NormalizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected