voice_audio_multi/include/engine/models/demucs/session.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

49 lines
1.7 KiB
C++

#pragma once
#include "engine/framework/model_spec/metadata.h"
#include "engine/framework/runtime/session_base.h"
#include "engine/models/demucs/assets.h"
#include "engine/models/demucs/pipeline.h"
#include <memory>
#include <vector>
namespace engine::models::demucs {
std::shared_ptr<runtime::IVoiceModelLoader> make_htdemucs_loader();
std::shared_ptr<runtime::IVoiceModelLoader> make_htdemucs_6stems_loader();
class HTDemucsSession final
: public runtime::RuntimeSessionBase
, public runtime::IOfflineVoiceTaskSession {
public:
HTDemucsSession(
runtime::TaskSpec task,
runtime::SessionOptions options,
std::shared_ptr<const HTDemucsAssets> assets,
std::shared_ptr<const engine::model_spec::ModelContract> contract,
std::string family_name = "htdemucs");
~HTDemucsSession() override;
std::string family() const override;
runtime::VoiceTaskKind task_kind() const override;
runtime::RunMode run_mode() const override;
void prepare(const runtime::SessionPreparationRequest & request) override;
runtime::TaskResult run(const runtime::TaskRequest & request) override;
private:
runtime::TaskSpec task_;
std::shared_ptr<const HTDemucsAssets> assets_;
std::shared_ptr<const engine::model_spec::ModelContract> contract_;
std::string family_name_;
assets::TensorStorageType weight_storage_type_ = assets::TensorStorageType::Native;
std::unique_ptr<HTDemucsPipeline> pipeline_;
int64_t chunk_size_ = 0;
int64_t step_ = 0;
std::vector<float> chunk_window_;
std::vector<float> chunk_planar_work_;
std::vector<float> result_work_;
std::vector<float> counter_work_;
};
} // namespace engine::models::demucs