add phrase uuids; implement comparisons

This commit is contained in:
🪞👃🪞 2024-10-08 18:15:41 +03:00
parent 5b2b04dcf9
commit 690a8e8f24
6 changed files with 40 additions and 19 deletions

View file

@ -470,14 +470,17 @@ impl Scene {
}
/// Returns true if all phrases in the scene are currently playing
pub fn is_playing <E: Engine> (&self, tracks: &[ArrangementTrack<E>]) -> bool {
self.clips.iter().enumerate()
.all(|(track_index, clip)|match clip {
Some(i) => tracks
.get(track_index)
.map(|track|track.player.phrase == Some(*i))
.unwrap_or(false),
None => true
})
self.clips.iter().enumerate().all(|(track_index, clip)|match clip {
Some(clip) => tracks
.get(track_index)
.map(|track|if let Some(phrase) = &track.player.phrase {
*phrase.read().unwrap() == *clip.read().unwrap()
} else {
false
})
.unwrap_or(false),
None => true
})
}
pub fn ppqs <E: Engine> (tracks: &[ArrangementTrack<E>], scenes: &[Self]) -> Vec<(usize, usize)> {
let mut total = 0;