diff options
Diffstat (limited to 'src/audio_core/renderer/upsampler/upsampler_manager.h')
-rw-r--r-- | src/audio_core/renderer/upsampler/upsampler_manager.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.h b/src/audio_core/renderer/upsampler/upsampler_manager.h new file mode 100644 index 000000000..70cd42b08 --- /dev/null +++ b/src/audio_core/renderer/upsampler/upsampler_manager.h @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <mutex> +#include <span> + +#include "audio_core/renderer/upsampler/upsampler_info.h" +#include "common/common_types.h" + +namespace AudioCore::AudioRenderer { +/** + * Manages and has utility functions for upsampler infos. + */ +class UpsamplerManager { +public: + UpsamplerManager(u32 count, std::span<UpsamplerInfo> infos, std::span<s32> workbuffer); + + /** + * Allocate a new UpsamplerInfo. + * + * @return The allocated upsampler, may be nullptr if alloc failed. + */ + UpsamplerInfo* Allocate(); + + /** + * Free the given upsampler. + * + * @param The upsampler to be freed. + */ + void Free(UpsamplerInfo* info); + +private: + /// Maximum number of upsamplers in the buffer + const u32 count; + /// Upsamplers buffer + std::span<UpsamplerInfo> upsampler_infos; + /// Workbuffer for upsampling samples + std::span<s32> workbuffer; + /// Lock for allocate/free + std::mutex lock{}; +}; + +} // namespace AudioCore::AudioRenderer |