mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
wip: "multiple cascading refactors"
https://loglog.games/blog/leaving-rust-gamedev/#orphan-rule-should-be-optional is on point
This commit is contained in:
parent
20afc397ea
commit
fa8282a9d5
18 changed files with 175 additions and 222 deletions
|
|
@ -37,7 +37,7 @@ impl Scene {
|
|||
Self { name, clips, }
|
||||
}
|
||||
/// Returns the pulse length of the longest phrase in the scene
|
||||
pub fn pulses (&self, tracks: &[Sequencer]) -> usize {
|
||||
pub fn pulses <E: Engine> (&self, tracks: &[Sequencer<E>]) -> usize {
|
||||
self.clips.iter().enumerate()
|
||||
.filter_map(|(i, c)|c
|
||||
.map(|c|tracks
|
||||
|
|
@ -50,7 +50,7 @@ impl Scene {
|
|||
.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: &[Sequencer]) -> bool {
|
||||
pub fn is_playing <E: Engine> (&self, tracks: &[Sequencer<E>]) -> bool {
|
||||
self.clips.iter().enumerate()
|
||||
.all(|(track_index, phrase_index)|match phrase_index {
|
||||
Some(i) => tracks
|
||||
|
|
@ -68,7 +68,10 @@ pub fn scene_name_max_len (scenes: &[Scene]) -> usize {
|
|||
.fold(0, usize::max)
|
||||
}
|
||||
|
||||
pub fn scene_ppqs (tracks: &[Sequencer], scenes: &[Scene]) -> Vec<(usize, usize)> {
|
||||
pub fn scene_ppqs <E: Engine> (
|
||||
tracks: &[Sequencer<E>],
|
||||
scenes: &[Scene]
|
||||
) -> Vec<(usize, usize)> {
|
||||
let mut total = 0;
|
||||
let mut scenes: Vec<(usize, usize)> = scenes.iter().map(|scene|{
|
||||
let pulses = scene.pulses(tracks).max(96);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue