Skip to content

SoundGraph: sample-accurate external (game-code) triggers#394

Merged
drsnuggles8 merged 1 commit into
masterfrom
feature/soundgraph-sample-accurate-external-triggers
Jun 25, 2026
Merged

SoundGraph: sample-accurate external (game-code) triggers#394
drsnuggles8 merged 1 commit into
masterfrom
feature/soundgraph-sample-accurate-external-triggers

Conversation

@drsnuggles8

Copy link
Copy Markdown
Owner

Thread a per-event sample offset through SoundGraphSource's input-event queue and SoundGraph::SendInputEvent so externally scheduled triggers land on the exact sample instead of the block boundary.

Thread a per-event sample offset through SoundGraphSource's input-event queue and SoundGraph::SendInputEvent so externally scheduled triggers land on the exact sample instead of the block boundary.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@drsnuggles8, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 54 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e109736c-b3ca-406d-9b95-e97eda53b035

📥 Commits

Reviewing files that changed from the base of the PR and between 288cfc9 and 117ae00.

📒 Files selected for processing (5)
  • OloEngine/src/OloEngine/Audio/SoundGraph/SoundGraph.h
  • OloEngine/src/OloEngine/Audio/SoundGraph/SoundGraphSource.cpp
  • OloEngine/src/OloEngine/Audio/SoundGraph/SoundGraphSource.h
  • OloEngine/tests/SoundGraphSampleAccurateTriggerTest.cpp
  • docs/soundgraph-metasounds-refactor.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@drsnuggles8

Copy link
Copy Markdown
Owner Author

🤖 Self-review (finish-pr) @ 117ae001

Reviewed the full PR diff (origin/master...HEAD, 5 files / +351) at high effort: line-by-line correctness scan, removed-behavior audit, cross-file caller tracing, plus cleanup/altitude/convention angles. Cross-checked the 8 SonarCloud new-code findings.

Correctness: no bugs found. Verified the load-bearing paths:

  • Identifier(string)GenerateFNVHash and Identifier(u32) round-trip to the same m_Hash that InEvents keys on, so the external string overload resolves to the right endpoint.
  • SPSC hand-off (m_InputEventQueue) mirrors the existing m_ParameterUpdateQueue contract (main-thread producer / audio-thread consumer); DrainInputEvents runs before Process; ReplaceGraph clears the queue under the same suspend protocol as the param queue.
  • ClampInputEventOffset correct for negative (→0), in-range, over-range (→blockSize-1) and blockSize==0 (→0); SendInputEvent sanitises NaN/Inf payload to 1.0f per the float-validation rule.
  • InputEvent::operator() prefers m_OffsetEvent, so the route rebind in AddRoute is correct and value-only fires still default to offset 0.

CI is fully green and ctest discovers + runs the new SoundGraphSampleAccurateTriggerTest.* cases (not just builds), so green covers them.

  • Findings: 10 (0 correctness) · Fixed: none required
  • Dismissed:
    • SonarCloud S1238 (pass choc::value::ValueView by const-ref) — false positive: ValueView is a lightweight Type+pointer view (pass-by-value like string_view); signature already passed by value pre-PR.
    • SonarCloud S1712 ×5 (replace default args with overloads) — declined: default args are the established pattern across the SoundGraph event system and the defaults intentionally preserve existing callers' block-boundary timing.
    • SonarCloud S5350 (capturePtr → pointer-to-const) — trivial test-only cosmetic, no functional effect; not worth resetting a fully-green CI run.
    • SonarCloud S1917 (mixed // and /* */) — false positive: /*sampleOffset=*/ inline param label alongside a // banner is idiomatic.
    • code-review: std::clamp in ClampInputEventOffset — declined: std::clamp(x,0,maxOffset) is UB when blockSize==0 (maxOffset=-1, lo>hi); the explicit form keeps the necessary guard and documents the legacy-negative intent.
    • code-review: duplicated 6-line envelope setup across two tests — declined: self-contained test bodies are preferred for independence; duplication is minor.

@drsnuggles8 drsnuggles8 added the self-reviewed finish-pr self-review done label Jun 25, 2026
@drsnuggles8 drsnuggles8 merged commit 82a04b8 into master Jun 25, 2026
10 checks passed
@drsnuggles8 drsnuggles8 deleted the feature/soundgraph-sample-accurate-external-triggers branch June 25, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

self-reviewed finish-pr self-review done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant