mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 06:53:19 -10:00
fingerprint: a file with no sound track has no sound to judge
Columns::sound embeds at least one clip, so a render with no audio stream got one empty clip's CLAP vector, and Modality::Sound.in_file said it had sound. Its sound axes then judged silence, and score could hold it back as a gating dropout or clip over the whole file. Sound and sound events are now in a file only when it has levels to read; the embedding is unchanged, so evidence rows and damage windows keep their features.
This commit is contained in:
1 parent
69fb3d8f87
commit
1858bf9bef
2 files changed
+15
No files matched your search
@@ -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));
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user