mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
extract TransportClock
This commit is contained in:
parent
ccc74fd743
commit
85e243f782
6 changed files with 130 additions and 145 deletions
|
|
@ -11,9 +11,9 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
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;
|
||||
self.clock.set_frame(transport.pos.frame() as usize);
|
||||
let mut reset = false;
|
||||
if self.playing != Some(transport.state) {
|
||||
if *self.clock.playing.read().unwrap() != Some(transport.state) {
|
||||
match transport.state {
|
||||
TransportState::Rolling => {
|
||||
self.started = Some((current_frames as usize, current_usecs as usize));
|
||||
|
|
@ -24,19 +24,15 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
self.playing = Some(transport.state);
|
||||
if self.playing == Some(TransportState::Stopped) {
|
||||
};
|
||||
*self.clock.playing.write().unwrap() = Some(transport.state);
|
||||
if *self.clock.playing.read().unwrap() == Some(TransportState::Stopped) {
|
||||
self.started = None;
|
||||
}
|
||||
match self.started {
|
||||
Some((_, usecs)) => {
|
||||
self.usecs = current_usecs as usize - usecs;
|
||||
},
|
||||
None => {
|
||||
self.usecs = 0;
|
||||
}
|
||||
}
|
||||
Some((_, usecs)) => { self.clock.set_usec(current_usecs as usize - usecs); },
|
||||
None => { self.clock.set_usec(0); }
|
||||
};
|
||||
(
|
||||
reset,
|
||||
current_frames as usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue