wip: arranger: colors

This commit is contained in:
🪞👃🪞 2024-08-23 00:09:13 +03:00
parent 70b1ec5a02
commit 08327d2ec0
5 changed files with 120 additions and 99 deletions

View file

@ -39,7 +39,13 @@ impl Scene {
/// Returns the pulse length of the longest phrase in the scene
pub fn pulses (&self, tracks: &[Sequencer]) -> usize {
self.clips.iter().enumerate()
.filter_map(|(i, c)|c.map(|c|tracks[i].phrases.get(c)))
.filter_map(|(i, c)|c
.map(|c|tracks
.get(i)
.map(|track|track
.phrases
.get(c))))
.filter_map(|p|p)
.filter_map(|p|p)
.fold(0, |a, p|a.max(p.read().unwrap().length))
}
@ -47,7 +53,10 @@ impl Scene {
pub fn is_playing (&self, tracks: &[Sequencer]) -> bool {
self.clips.iter().enumerate()
.all(|(track_index, phrase_index)|match phrase_index {
Some(i) => tracks[track_index].sequence == Some(*i),
Some(i) => tracks
.get(track_index)
.map(|track|track.sequence == Some(*i))
.unwrap_or(false),
None => true
})
}