voice_audio_multi/app/recipe/cli_recipe.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

48 lines
1.6 KiB
C++

#pragma once
#include "recipe.h"
#include "engine/framework/core/backend.h"
#include "engine/framework/runtime/registry.h"
#include <filesystem>
#include <optional>
#include <mutex>
#include <string>
#include <unordered_map>
namespace minitts::app {
struct CliRecipeOptions {
std::unordered_map<std::string, std::filesystem::path> model_paths;
std::unordered_map<std::string, std::string> model_families;
std::unordered_map<std::string, std::string> load_options;
std::unordered_map<std::string, std::string> session_options;
std::optional<std::filesystem::path> model_spec_override;
engine::core::BackendConfig backend;
};
class CliRecipeModelExecutor final : public IRecipeModelExecutor {
public:
CliRecipeModelExecutor(engine::runtime::ModelRegistry & registry, CliRecipeOptions options);
~CliRecipeModelExecutor() override;
engine::runtime::TaskResult run(
std::string_view role,
const engine::runtime::TaskSpec & task,
const engine::runtime::TaskRequest & request) override;
engine::runtime::TaskResult stream(std::string_view role,
const engine::runtime::TaskSpec & task, const engine::runtime::TaskRequest & request,
const RecipeEventSink & sink, const AudioChunkStream * source = nullptr) override;
private:
struct ModelEntry;
ModelEntry & model_for(std::string_view role, const engine::runtime::TaskSpec & task);
std::mutex models_mutex_;
engine::runtime::ModelRegistry & registry_;
CliRecipeOptions options_;
std::unordered_map<std::string, std::unique_ptr<ModelEntry>> models_;
};
} // namespace minitts::app