mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
30 lines
1.3 KiB
Rust
30 lines
1.3 KiB
Rust
use crate::*;
|
|
impl<E: Engine> Audio for Arranger<E> {
|
|
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
|
if let Some(ref transport) = self.transport {
|
|
transport.write().unwrap().process(client, scope);
|
|
}
|
|
let Arrangement { scenes, ref mut tracks, selected, .. } = &mut self.arrangement;
|
|
for track in tracks.iter_mut() {
|
|
track.player.process(client, scope);
|
|
}
|
|
if let ArrangementFocus::Clip(t, s) = selected {
|
|
if let Some(Some(Some(phrase))) = scenes.get(*s).map(|scene|scene.clips.get(*t)) {
|
|
if let Some(track) = tracks.get(*t) {
|
|
if let Some((ref started_at, Some(ref playing))) = track.player.phrase {
|
|
let phrase = phrase.read().unwrap();
|
|
if *playing.read().unwrap() == *phrase {
|
|
let pulse = self.clock.current.pulse.get();
|
|
let start = started_at.pulse.get();
|
|
let now = (pulse - start) % phrase.length as f64;
|
|
self.editor.now.set(now);
|
|
return Control::Continue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
self.editor.now.set(0.);
|
|
Control::Continue
|
|
}
|
|
}
|