载入中...
搜索中...
未找到
AudioEditorModule.cpp
浏览该文件的文档.
2
7#include "common/Capability.h"
10
11#include <simplesquirrel/simplesquirrel.hpp>
12
13#include <stdexcept>
14#include <string_view>
15#include <vector>
16
18
20public:
21 std::vector<std::string_view> types() const override { return {"audio-source", "audio-mixer", "audio-effects"}; }
22
24 const editor::TargetId& target, std::string_view type,
25 const editor::EditorValue::Object&) override {
27 if (type == "audio-source") {
28 owned.target = std::make_unique<audio_editing::AudioSourceTarget>(target.value());
29 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(owned));
30 }
31 if (type == "audio-mixer") {
32 owned.target = std::make_unique<audio_editing::AudioMixerTarget>(target.value());
33 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(owned));
34 }
35 owned.target = std::make_unique<audio_editing::AudioEffectChainTarget>(target.value());
36 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(owned));
37 }
38};
39
41
43 auto* registry = eve::cap::query<editing::IEditingCommandRegistry>();
44 if (!registry || !audio_editing::registerEditingCommands(*registry).ok())
45 throw std::runtime_error("Failed to register audio editing commands");
46 eve::cap::addListener<editor::IEditorAutomationTargetFactory>(factory_.get());
47}
48
50 eve::cap::removeListener<editor::IEditorAutomationTargetFactory>(factory_.get());
51 if (auto* registry = eve::cap::query<editing::IEditingCommandRegistry>())
52 registry->unregisterOwner("audio_editing").ignore("audio editor adapter shutdown");
53}
54
55void AudioEditorModule::expose(ssq::Table& table) {
56 auto module = table.addClass(name, AudioEditorModule::create, false);
58}
59void AudioEditorModule::expose(ssq::Class&) {}
60
61} // namespace eve::audio_editor
LogicalId target
ActiveSource owned
Squirrel adapter for the audio source editor.
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
Move-only operation result carrying either a value or Status.
Definition Result.h:155
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
std::vector< std::string_view > types() const override
Stable target type names this factory accepts.
editor::Result< editor::AutomationOwnedTarget > create(const editor::TargetId &target, std::string_view type, const editor::EditorValue::Object &) override
Create a domain target from an automation request. @ownership Success transfers the target and any su...
Composition adapter that contributes audio editing commands, automation targets, and the script-owned...
~AudioEditorModule() override
Audio editor module.
std::map< std::string, Value > Object
Multi-provider extension point for domain-specific automation target creation.
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry &registry)
Register audio-owned planned commands with a generic editing host.
void exposeAudioSourceEditorScriptBindings(ssq::Table &table, ssq::Class &moduleClass)
Expose the script-owned AudioSourceEditor factory on AudioEditorModule.
Target plus optional borrowed-dependency owner returned by an automation factory.
std::unique_ptr< IEditableTarget > target