diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/effect_context.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/audio_core/effect_context.cpp b/src/audio_core/effect_context.cpp index c42e71c1c..2497d2f32 100644 --- a/src/audio_core/effect_context.cpp +++ b/src/audio_core/effect_context.cpp @@ -2,13 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <algorithm> #include "audio_core/effect_context.h" namespace AudioCore { EffectContext::EffectContext(std::size_t effect_count) : effect_count(effect_count) { - for (std::size_t i = 0; i < effect_count; i++) { - effects.push_back(std::make_unique<EffectStubbed>()); - } + effects.reserve(effect_count); + std::generate_n(std::back_inserter(effects), effect_count, + [] { return std::make_unique<EffectStubbed>(); }); } EffectContext::~EffectContext() = default; @@ -20,6 +21,10 @@ EffectBase* EffectContext::GetInfo(std::size_t i) { return effects.at(i).get(); } +const EffectBase* EffectContext::GetInfo(std::size_t i) const { + return effects.at(i).get(); +} + EffectStubbed::EffectStubbed() : EffectBase::EffectBase() {} EffectStubbed::~EffectStubbed() = default; |