载入中...
搜索中...
未找到
AudioSourcePresentation.cpp
浏览该文件的文档.
2
3namespace eve::audio_editor {
5 return {source_.revision(), source_.target().targetId().value(), source_.canUndo(), source_.canRedo(),
6 source_.isPlaying()};
7}
9 auto schema = source_.target().schema({});
10 for (auto& field : schema.properties) {
11 // This tone-preview host has no clip resolver or mixer routing provider.
12 if (field.path.value() == "clip.asset" || field.path.value() == "clip.mode" ||
13 field.path.value() == "play.autoplay" || field.path.value() == "mixer.bus")
14 field.flags = field.flags | editor::PropertyFlag::ReadOnly;
15 // UI labels are a projection; constraints remain the domain schema's truth.
16 const auto separator = field.path.value().find_last_of('.');
17 field.displayNameKey = field.path.value().substr(separator + 1);
18 if (field.path.value() == "play.loop-start" || field.path.value() == "play.loop-end")
19 field.numeric.maximum = source_.duration();
20 }
21 return schema;
22}
28 const auto descriptor = schema().find(path);
29 if (!descriptor || editor::hasPropertyFlag(descriptor->flags, editor::PropertyFlag::ReadOnly))
30 return editing::failed<void>(editor::EditorStatus::Rejected, editor::RuleId("editor.audio.property"),
31 "Property is unavailable in this preview host");
32 return source_.setProperty(path.value(), value);
33}
35 if (id == "undo" || id == "redo") {
36 auto result = id == "undo" ? source_.undo() : source_.redo();
37 if (!result.ok()) return editor::Result<void>::failure(result.status());
38 return editing::applied<void>();
39 }
40 if (id == "play-pause") return source_.isPlaying() ? source_.pause() : source_.play();
41 if (id == "stop") return source_.stop();
42 return editing::failed<void>(editor::EditorStatus::NotFound, editor::RuleId("editor.audio.action"),
43 "Unknown audio action");
44}
45} // namespace eve::audio_editor
std::string descriptor
Poco::JSON::Object::Ptr result
std::string path
Definition PlayHost.cpp:111
Object::Ptr value
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
PropertySchema schema(const SelectionSnapshot &selection) const override
Schema.
TargetId targetId() const override
Target id.
Definition AudioTarget.h:28
audio_editing::Result< void > play()
Play.
const audio_editing::AudioSourceTarget & target() const noexcept
Borrow the authoritative source document.
audio_editing::Result< editor::TransactionReceipt > redo()
Redo.
audio_editing::PropertyReadResult read(const std::string &path) const
Read a property using the source selection.
bool canRedo() const noexcept
Can redo.
audio_editing::Result< editor::TransactionReceipt > undo()
Undo.
audio_editing::Result< void > setProperty(const std::string &path, const audio_editing::EditorValue &value)
Commit an absolute property assignment through the document transaction path.
bool isPlaying() const noexcept
True when playing.
audio_editing::Result< void > pause()
Pause.
audio_editing::Result< void > stop()
Stops .
double duration() const noexcept
Duration.
std::uint64_t revision() const noexcept
Revision.
editor::PropertySchema schema() const override
Owning schema; field identity is its canonical property path.
editor::Result< void > action(std::string_view id) override
Execute a domain action, including undo/redo on its sole history backend.
editor::WorkspacePresentationState state() const override
Snapshot of document revision, selection/playhead context and history availability.
editor::PropertyReadResult read(const editor::PropertyPath &path) const override
Read a field for the current selection without mutation.
editor::Result< void > write(const editor::PropertyPath &path, const editor::EditorValue &value) override
Commit one validated field through the domain's existing transaction path.
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
PropertyReadResult public API.
EVENGINE_API_PLATFORM public API.
std::vector< PropertyDescriptor > properties
PropertyDescriptorLookup find(const PropertyPath &path) const
Finds find.
Owning state projection; the bound domain remains the only document/history owner.