voice_audio_multi/include/engine/models/meanvc2/vocoder.h
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

46 lines
1.6 KiB
C++

#pragma once
#include "engine/framework/assets/tensor_source.h"
#include "engine/framework/core/execution_context.h"
#include "engine/framework/runtime/session.h"
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
namespace engine::models::meanvc2 {
struct MeanVC2VocosWeights;
struct MeanVC2VocosGraph;
class MeanVC2VocosRuntime final {
public:
MeanVC2VocosRuntime(
std::shared_ptr<const engine::assets::TensorSource> source,
engine::core::ExecutionContext & execution_context,
size_t weight_context_bytes,
size_t graph_context_bytes,
engine::assets::TensorStorageType matmul_weight_storage_type,
engine::assets::TensorStorageType conv_weight_storage_type);
~MeanVC2VocosRuntime();
runtime::AudioBuffer decode(const std::vector<float> & mel_frames, int64_t frames) const;
runtime::AudioBuffer decode_streaming(const std::vector<float> & mel_frames, int64_t frames) const;
void reset_streaming_state() const;
runtime::AudioBuffer decode_streaming_chunk(const std::vector<float> & mel_frames, int64_t frames) const;
runtime::AudioBuffer finish_streaming() const;
private:
MeanVC2VocosGraph & graph_for_frames(int64_t frames) const;
engine::core::ExecutionContext & execution_context_;
size_t graph_context_bytes_ = 0;
std::shared_ptr<const engine::assets::TensorSource> source_;
std::shared_ptr<const MeanVC2VocosWeights> weights_;
mutable std::vector<std::unique_ptr<MeanVC2VocosGraph>> graphs_;
mutable std::vector<float> streaming_mel_cache_;
mutable std::vector<float> streaming_last_wav_;
};
} // namespace engine::models::meanvc2