Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
A fresh raea init renders again: an <Audio> behind a condition isn't one the render must hear
shinyobjectza1853618691f
diff --git a/runtime/export/src/sound.rs b/runtime/export/src/sound.rsindex 8e6f753b..99b1a812 100644--- a/runtime/export/src/sound.rs+++ b/runtime/export/src/sound.rs@@ -30,18 +30,13 @@ pub(crate) fn core_bounce(frames: &[(i64, Frame)], notes: &[raea_sys_mix::ToneCuOk(Some(a))}-/// A render that would have no sound although the edit writes <Audio>: an error, not a silent file. A wrapper that drops-/// its children (a <Mix> did, 2026-10-18: a 20 s ad rendered with no audio track), a sound that's never on screen, or-/// a generated sound that was never made all end here. What the edit renders is read from its bundle (not minified,-/// and what isn't used left out): an <Audio> is a JSX call `(…jsx)(Audio, {`. The folder's .tsx files were read before,-/// so a sibling's <Audio> refused an edit with none (10-24).+/// A render that would have no sound although the edit writes an <Audio> that always plays (raea_runtime_sound::+/// always_plays_audio, read from its bundle): an error, not a silent file. A wrapper that drops its children (a <Mix>+/// did, 2026-10-18: a 20 s ad rendered with no audio track), a sound that's never on screen, or a generated sound that+/// was never made all end here. The folder's .tsx files were read before, so a sibling's <Audio> refused an edit with+/// none (10-24); and an <Audio> behind a condition refused the starter edit before it had cuts.pub(crate) fn no_sound_but_declared(js: &Path) -> R<()> {- let code = std::fs::read_to_string(js).unwrap_or_default();- let declares = code.match_indices(")(Audio").any(|(i, m)| {- let rest = code[i + m.len()..].trim_start_matches(|c: char| c.is_ascii_digit());- rest.starts_with(", {") || rest.starts_with(",{")- });- if declares {+ if raea_runtime_sound::always_plays_audio(&std::fs::read_to_string(js).unwrap_or_default()) {return Err("the edit has <Audio> but no sound reached the render, so the file would be silent: is an <Audio> inside a component that doesn't render its children, outside every frame's Sequence, or a generated sound that wasn't made? (an <Audio> inside <Mix>...</Mix> was dropped before 2026-10-18)".into());}Ok(())diff --git a/runtime/sound/src/declared.rs b/runtime/sound/src/declared.rsnew file mode 100644index 00000000..d42d13a0--- /dev/null+++ b/runtime/sound/src/declared.rs@@ -0,0 +1,37 @@+//! Whether an edit's bundle writes an <Audio> that always plays (raea-runtime-export: a render with no sound although it+//! does is an error, not a silent file).++/// True when the bundle's JSX has an <Audio> call, `(…jsx)(Audio, {`, that isn't behind a condition. One behind `?` or+/// `&&` is silent when its condition is false, as a sound-only cut's in the starter edit is before there are any cuts+/// (`c.kind === "audio" ? <Audio … /> : <Video … />`), and that render is meant to be silent. One in a wrapper's children+/// (`children: (…jsx)(Audio, {`) always plays, so a wrapper that drops its children (a <Mix> did, 2026-10-18) is still+/// caught. What the bundle holds is what the edit renders (not minified, what isn't used left out).+pub fn always_plays_audio(bundle: &str) -> bool {+ bundle.match_indices(")(Audio").any(|(i, m)| {+ let rest = bundle[i + m.len()..].trim_start_matches(|c: char| c.is_ascii_digit());+ if !(rest.starts_with(", {") || rest.starts_with(",{")) {+ return false;+ }+ // back over the call's own `(0, import_jsx_runtime.jsx` and esbuild's `/* @__PURE__ */`+ let before = bundle[..i].rfind('(').map_or("", |j| &bundle[..j]);+ let before = before.trim_end().trim_end_matches("/* @__PURE__ */").trim_end();+ !(before.ends_with('?') || before.ends_with("&&"))+ })+}++#[cfg(test)]+mod tests {+ use super::always_plays_audio;++ #[test]+ fn an_audio_behind_a_condition_isnt_one_that_always_plays() {+ let starter = r#"children: c.kind === "audio" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Audio, { src: c.src }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Video, { src: c.src })"#;+ assert!(!always_plays_audio(starter));+ assert!(!always_plays_audio(r#"music && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Audio2, { src: music })"#));+ // a wrapper's child, and a call on its own: both always play+ assert!(always_plays_audio(r#"(0, import_jsx_runtime.jsx)(Mix, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Audio, { src: "bed.wav" }) })"#));+ assert!(always_plays_audio(r#"return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AbsoluteFill, { children: [(0, import_jsx_runtime.jsx)(Audio, { src: "a.wav" })] })"#));+ // the component's own definition and a type check aren't calls of it+ assert!(!always_plays_audio("function Audio(props) {}\nif (c.type === Audio) {}"));+ }+}diff --git a/runtime/sound/src/lib.rs b/runtime/sound/src/lib.rsindex ad1025d5..34b22d84 100644--- a/runtime/sound/src/lib.rs+++ b/runtime/sound/src/lib.rs@@ -15,6 +15,8 @@ type R<T> = Result<T, String>;pub use raea_sys_mix::Sound;mod names;+mod declared;+pub use declared::always_plays_audio;pub use names::*;/// The live mixer: the one mixer core's device stream (raea_sys_mix::live::Live).