载入中...
搜索中...
未找到
AudioCapabilities.cpp
浏览该文件的文档.
42const std::string& selectAudioUri(const eve::action::ActionAudioBinding& binding, std::uint64_t seed) {
107 return failure(eve::DiagnosticCode::NotFound, "audio waveform resource is no longer cached", "uri");
122 result.buckets[bucket] = sampleBucket(*data, request.binding, localStart, localEnd, frameCount);
134 static float sampleAt(const eve::sound::SoundData& data, std::size_t frame, int channel) noexcept {
178 const auto frame = std::min(frameCount - 1, static_cast<std::size_t>(media * data.getSampleRate()));
205 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "Audio parameter target is unavailable", "audio"));
210 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "Audio parameter curve is already active", "itemId"));
216 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "Audio parameter curve has no active state", "itemId"));
223 if (!std::isfinite(value) || value < 0.0 || value > static_cast<double>(std::numeric_limits<float>::max()))
224 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "Audio parameter curves produced an invalid master volume", "value"));
233 eve::action::ActionParameterOperation operation = eve::action::ActionParameterOperation::Replace;
266 if (!context.interrupted && found->second.fadeOutOnExit && found->second.fadeOutDuration > 0.0) {
281 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "audio state requires enter or exit", "event.kind"));
283 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "audio state is already active", "itemId"));
284 const auto shape = instant ? eve::action::ActionAudioShape::Instant : eve::action::ActionAudioShape::State;
290 if (!audio) return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "Audio module is unavailable", "audio"));
293 auto* data = eve::sound::Sound::create()->newSoundDataFromFile(selectAudioUri(binding.value(), seed));
295 if (!dataPin.ok()) return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "audio resource is no longer cached", "uri"));
299 configureAudioSource(*source, binding.value(), selectAudioPitch(binding.value(), seed ^ 0x9e3779b97f4a7c15ULL));
306 auto duration = eve::Duration::fromSeconds(owned.source->getDuration() / owned.source->getPitch());
315 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::Failed, error.what(), "uri"));
323 if (found == active_.end()) return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "active audio has no source", "itemId"));
324 if (found->second.spatial.mode != eve::action::ActionSpatialAttachmentMode::WorldTransformAtStart) {
348 if (transient.executionId != context.executionId || context.time < transient.endTime) return false;
398 const eve::action::ActionSpatialBinding& spatial, const eve::action::ActionNotifyContext& context) {
469 if (retainContinuous && current != current_.end() && current->second.payload == block.payload) {
608 eve::Result<std::unique_ptr<eve::action::IActionPreviewSink>> createActionPreviewSink() override {
610 return eve::Result<std::unique_ptr<eve::action::IActionPreviewSink>>::failure(eve::Diagnostic::error(
Typed audio action-block payload contract.
Optional audio waveform projection for action editors.
Extensible notify descriptors, validation and runtime routing.
Typed continuous parameter-curve action block.
Presentation-neutral action preview frame contracts.
Typed spatial payload shared by presentation action blocks.
std::map< std::string, std::vector< Key >, std::less<> > channels
Definition AnimCurveLibrary.cpp:19
Optional ECS-entity to world-pose capability.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:16
double seconds() const noexcept
Return this duration as seconds for legacy/presentation APIs.
Definition Time.cpp:28
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:411
const std::string & format() const noexcept
Returns the canonical namespace:name representation.
Definition Identity.h:436
eve::Result< ResourcePin > pin(Resource *resource)
Keeps one cached resource alive across unload()/clear()/reload.
Definition Resource.cpp:311
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Canonical notify descriptor owner and runtime handler router.
Definition ActionNotifyRegistry.h:138
Result< void > registerHandler(std::string_view type, std::shared_ptr< IActionNotifyHandler > handler)
Register an owning handler for an existing descriptor.
Definition ActionNotifyRegistry.cpp:243
Optional synchronous audio waveform service consumed by the action editor.
Definition ActionAudioWaveform.h:44
Consumer-owned handler for one registered notify type.
Definition ActionNotifyRegistry.h:68
Optional module provider that installs handlers into a new registry.
Definition ActionNotifyRegistry.h:117
Optional open target for continuous action parameters.
Definition ActionParameterCurve.h:98
Optional owner-thread provider of one independently owned action preview layer.
Definition ActionPreview.h:78
Host boundary for 3D animation, VFX, audio and camera preview.
Definition ActionPreview.h:59
constexpr std::uint64_t value() const noexcept
Returns the underlying value at an explicit protocol boundary.
Definition StrongUint64.h:26
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
Definition StrongUint64.h:24
RAII keep-alive for one RuntimeObjectRegistry entry.
Definition RuntimeRegistry.h:276
T * get() const noexcept
Borrows the pinned object; valid until the pin is released.
Definition RuntimeRegistry.h:317
Raw PCM audio buffer with format metadata (samples/rate/bit depth/channels).
Definition SoundData.h:15
@ StateEnter
ActionParameterOperation
Composition operation applied by a target-specific parameter sink.
Definition ActionParameterCurve.h:21
@ FollowTarget
Re-evaluate position and rotation from the anchor every update.
@ WorldTransformAtStart
Capture the complete world transform once on Enter.
Definition Audio.cpp:23
@ InvalidArgument
@ NotFound
@ Unsupported
@ Failed
@ Conflict
Result< EntitySpatialPose > resolveEntitySpatialPose(ecs::EntityHandle entity, std::string_view bone)
Resolve through registered providers in deterministic registration order.
Definition EntitySpatialResolver.cpp:9
@ NoOp
@ Applied
std::optional< std::reference_wrapper< T > > OptionalRef
Optional borrowed reference; it does not extend T's lifetime.
Definition BorrowedRef.h:24
Definition Container.h:602
Renderer-neutral owning world pose resolved for an ECS entity.
Definition EntitySpatialResolver.h:14
Owning per-step sample of one currently active timeline state.
Definition ActionTimeline.h:159
Owning validated settings shared by Audio runtime and editor preview.
Definition ActionAudioBlock.h:19
static Result< ActionAudioBinding > fromPayload(const Value::Object &payload, ActionAudioShape shape)
Decode an audio payload transactionally.
Definition ActionAudioBlock.cpp:30
One normalized min/max envelope bucket in timeline display order.
Definition ActionAudioWaveform.h:14
Owning request for a bounded audio-block waveform projection.
Definition ActionAudioWaveform.h:20
Owning waveform projection returned by an optional audio provider.
Definition ActionAudioWaveform.h:30
double clipDurationSeconds
Decoded source duration used for diagnostics and host labels.
Definition ActionAudioWaveform.h:32
std::vector< ActionAudioWaveformBucket > buckets
Min/max buckets in increasing block-local time.
Definition ActionAudioWaveform.h:34
Context linking a routed event to its action execution.
Definition ActionNotifyRegistry.h:34
Owning continuous parameter sample emitted by ActionBlockRuntime.
Definition ActionParameterCurve.h:74
Complete frame atomically prepared and then presented by a preview host.
Definition ActionPreview.h:41
Validated spatial settings decoded from a notify payload.
Definition ActionSpatialBlock.h:47
std::size_t targetIndex
Definition ActionSpatialBlock.h:50
ActionSpatialVector3 positionOffset
Definition ActionSpatialBlock.h:52
ActionSpatialTarget target
Definition ActionSpatialBlock.h:49
Owning event projection returned by the runtime sampler.
Definition ActionTimeline.h:146