mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: fixing some assumptions
This commit is contained in:
parent
5ae99b4ada
commit
2a60808239
11 changed files with 73 additions and 125 deletions
|
|
@ -15,14 +15,14 @@ impl Scene {
|
|||
Self { name, clips, }
|
||||
}
|
||||
/// Returns the pulse length of the longest phrase in the scene
|
||||
pub fn pulses (&self, tracks: &[Track]) -> usize {
|
||||
pub fn pulses (&self, tracks: &[SequencerTrack]) -> usize {
|
||||
self.clips.iter().enumerate()
|
||||
.filter_map(|(i, c)|c.map(|c|tracks[i].phrases.get(c)))
|
||||
.filter_map(|p|p)
|
||||
.fold(0, |a, p|a.max(p.read().unwrap().length))
|
||||
}
|
||||
/// Returns true if all phrases in the scene are currently playing
|
||||
pub fn is_playing (&self, tracks: &[Track]) -> bool {
|
||||
pub fn is_playing (&self, tracks: &[SequencerTrack]) -> bool {
|
||||
self.clips.iter().enumerate()
|
||||
.all(|(track_index, phrase_index)|match phrase_index {
|
||||
Some(i) => tracks[track_index].sequence == Some(*i),
|
||||
|
|
@ -37,7 +37,7 @@ pub fn scene_name_max_len (scenes: &[Scene]) -> usize {
|
|||
.fold(0, usize::max)
|
||||
}
|
||||
|
||||
pub fn scene_ppqs (tracks: &[Track], scenes: &[Scene]) -> Vec<(usize, usize)> {
|
||||
pub fn scene_ppqs (tracks: &[SequencerTrack], scenes: &[Scene]) -> Vec<(usize, usize)> {
|
||||
let mut total = 0;
|
||||
let mut scenes: Vec<(usize, usize)> = scenes.iter().map(|scene|{
|
||||
let pulses = scene.pulses(tracks);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue