mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: reenable transport clock
This commit is contained in:
parent
5671e19910
commit
9cbe805c46
2 changed files with 39 additions and 29 deletions
|
|
@ -80,35 +80,6 @@ impl<E: Engine> TransportToolbar<E> {
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) {
|
|
||||||
let times = scope.cycle_times().unwrap();
|
|
||||||
let CycleTimes { current_frames, current_usecs, next_usecs, period_usecs } = times;
|
|
||||||
let chunk_size = scope.n_frames() as usize;
|
|
||||||
let transport = self.transport.as_ref().unwrap().query().unwrap();
|
|
||||||
self.frame = transport.pos.frame() as usize;
|
|
||||||
let mut reset = false;
|
|
||||||
if self.playing != Some(transport.state) {
|
|
||||||
match transport.state {
|
|
||||||
TransportState::Rolling => {
|
|
||||||
self.started = Some((current_frames as usize, current_usecs as usize));
|
|
||||||
},
|
|
||||||
TransportState::Stopped => {
|
|
||||||
self.started = None;
|
|
||||||
reset = true;
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.playing = Some(transport.state);
|
|
||||||
(
|
|
||||||
reset,
|
|
||||||
current_frames as usize,
|
|
||||||
chunk_size as usize,
|
|
||||||
current_usecs as usize,
|
|
||||||
next_usecs as usize,
|
|
||||||
period_usecs as f64
|
|
||||||
)
|
|
||||||
}
|
|
||||||
pub fn bpm (&self) -> usize {
|
pub fn bpm (&self) -> usize {
|
||||||
self.timebase.bpm() as usize
|
self.timebase.bpm() as usize
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,42 @@ impl<E: Engine> Audio for TransportToolbar<E> {
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl<E: Engine> TransportToolbar<E> {
|
||||||
|
pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) {
|
||||||
|
let times = scope.cycle_times().unwrap();
|
||||||
|
let CycleTimes { current_frames, current_usecs, next_usecs, period_usecs } = times;
|
||||||
|
let chunk_size = scope.n_frames() as usize;
|
||||||
|
let transport = self.transport.as_ref().unwrap().query().unwrap();
|
||||||
|
self.frame = transport.pos.frame() as usize;
|
||||||
|
let mut reset = false;
|
||||||
|
if self.playing != Some(transport.state) {
|
||||||
|
match transport.state {
|
||||||
|
TransportState::Rolling => {
|
||||||
|
self.started = Some((current_frames as usize, current_usecs as usize));
|
||||||
|
},
|
||||||
|
TransportState::Stopped => {
|
||||||
|
self.started = None;
|
||||||
|
reset = true;
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.playing = Some(transport.state);
|
||||||
|
match self.started {
|
||||||
|
Some((frames, usecs)) => {
|
||||||
|
self.usecs = current_usecs as usize - usecs;
|
||||||
|
},
|
||||||
|
None => {
|
||||||
|
self.usecs = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(
|
||||||
|
reset,
|
||||||
|
current_frames as usize,
|
||||||
|
chunk_size as usize,
|
||||||
|
current_usecs as usize,
|
||||||
|
next_usecs as usize,
|
||||||
|
period_usecs as f64
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue