Skip to content

armgit / raea

Public Imported from GitHub
0

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.

fingerprint: a file with no sound track has no sound to judge

shinyobjectz1858bf9befff
diff --git a/systems/columns/src/tests.rs b/systems/columns/src/tests.rs
index 56f10a32..0be5d815 100644
--- a/systems/columns/src/tests.rs
+++ b/systems/columns/src/tests.rs
@@ -130,3 +130,13 @@ fn a_script_and_a_still_get_rows() {
assert_eq!((s.sig.len(), s.dur, s.text.len()), (crate::SIG, 1.0, 0));
let _ = std::fs::remove_dir_all(&dir);
}
+
+#[test]
+fn a_file_with_no_sound_track_has_no_sound_to_judge() {
+ use crate::window::Modality;
+ // what columns() gives a render with no audio stream: one empty clip's CLAP vector, and no levels
+ let silent = Columns { sig: vec![0.0; SIG], clap: vec![0.0; CLAP], ..Default::default() };
+ assert!(Modality::Picture.in_file(&silent) && !Modality::Sound.in_file(&silent) && !Modality::Events.in_file(&silent));
+ let heard = Columns { level: vec![-30.0], ..silent };
+ assert!(Modality::Sound.in_file(&heard));
+}
diff --git a/systems/columns/src/window.rs b/systems/columns/src/window.rs
index c19dcb58..bdd48248 100644
--- a/systems/columns/src/window.rs
+++ b/systems/columns/src/window.rs
@@ -48,6 +48,11 @@ impl Modality {
}
/// Whether a file's columns have rows this modality reads: a script has no picture, a video no text
pub fn in_file(self, c: &Columns) -> bool {
+ // a file with no sound track still gets one empty clip's CLAP vector (lib.rs sound()), so sound is there only
+ // when there are levels to read: a silent render's sound axes judged nothing and flagged it as a dropout
+ if matches!(self, Modality::Sound | Modality::Events) && c.level.is_empty() {
+ return false;
+ }
!match self {
Modality::Picture | Modality::Change => &c.sig,
Modality::Look => &c.look,