diff options
author | Chris Robinson <[email protected]> | 2020-04-28 07:28:22 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-28 07:28:22 -0700 |
commit | 5441fba419acc0cdd21bff96b37c03fbbf3e1eb9 (patch) | |
tree | 62e5d78496beee66713ecd0afc75a4639c088592 /alc/alc.cpp | |
parent | 187477db03aab952543582b2c5a6bafd970dbac7 (diff) |
Don't maintain a global backend list end
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 4db228d6..dcca795f 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -209,7 +209,6 @@ BackendInfo BackendList[] = { { "wave", WaveBackendFactory::getFactory }, #endif }; -auto BackendListEnd = std::end(BackendList); BackendFactory *PlaybackFactory{}; BackendFactory *CaptureFactory{}; @@ -989,13 +988,13 @@ void alc_initconfig(void) ALSOFT_GIT_BRANCH); { al::string names; - if(std::begin(BackendList) == BackendListEnd) - names += "(none)"; + if(al::size(BackendList) < 1) + names = "(none)"; else { - const al::span<const BackendInfo> infos{std::begin(BackendList), BackendListEnd}; - names += infos[0].name; - for(const auto &backend : infos.subspan(1)) + const al::span<const BackendInfo> infos{BackendList}; + names = infos[0].name; + for(const auto &backend : infos.subspan<1>()) { names += ", "; names += backend.name; @@ -1102,6 +1101,7 @@ void alc_initconfig(void) ReverbBoost *= std::pow(10.0f, valf / 20.0f); } + auto BackendListEnd = std::end(BackendList); auto devopt = al::getenv("ALSOFT_DRIVERS"); if(devopt || (devopt=ConfigValueStr(nullptr, nullptr, "drivers"))) { @@ -1156,16 +1156,16 @@ void alc_initconfig(void) BackendListEnd = backendlist_cur; } - auto init_backend = [](BackendInfo &backend) -> bool + auto init_backend = [](BackendInfo &backend) -> void { if(PlaybackFactory && CaptureFactory) - return true; + return; BackendFactory &factory = backend.getFactory(); if(!factory.init()) { WARN("Failed to initialize backend \"%s\"\n", backend.name); - return true; + return; } TRACE("Initialized backend \"%s\"\n", backend.name); @@ -1179,9 +1179,8 @@ void alc_initconfig(void) CaptureFactory = &factory; TRACE("Added \"%s\" for capture\n", backend.name); } - return false; }; - BackendListEnd = std::remove_if(std::begin(BackendList), BackendListEnd, init_backend); + std::for_each(std::begin(BackendList), BackendListEnd, init_backend); LoopbackBackendFactory::getFactory().init(); |