Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions systems/columns/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
5 changes: 5 additions & 0 deletions systems/columns/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading