mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
reset transport position on stop
This commit is contained in:
parent
7aad6d1678
commit
61992ab2a2
1 changed files with 8 additions and 5 deletions
|
|
@ -7,12 +7,12 @@ impl<E: Engine> Audio for TransportToolbar<E> {
|
||||||
}
|
}
|
||||||
impl<E: Engine> TransportToolbar<E> {
|
impl<E: Engine> TransportToolbar<E> {
|
||||||
pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) {
|
pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) {
|
||||||
let times = scope.cycle_times().unwrap();
|
let times = scope.cycle_times().unwrap();
|
||||||
let CycleTimes { current_frames, current_usecs, next_usecs, period_usecs } = times;
|
let CycleTimes { current_frames, current_usecs, next_usecs, period_usecs } = times;
|
||||||
let chunk_size = scope.n_frames() as usize;
|
let chunk_size = scope.n_frames() as usize;
|
||||||
let transport = self.transport.as_ref().unwrap().query().unwrap();
|
let transport = self.transport.as_ref().unwrap().query().unwrap();
|
||||||
self.frame = transport.pos.frame() as usize;
|
self.frame = transport.pos.frame() as usize;
|
||||||
let mut reset = false;
|
let mut reset = false;
|
||||||
if self.playing != Some(transport.state) {
|
if self.playing != Some(transport.state) {
|
||||||
match transport.state {
|
match transport.state {
|
||||||
TransportState::Rolling => {
|
TransportState::Rolling => {
|
||||||
|
|
@ -26,8 +26,11 @@ impl<E: Engine> TransportToolbar<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.playing = Some(transport.state);
|
self.playing = Some(transport.state);
|
||||||
|
if self.playing == Some(TransportState::Stopped) {
|
||||||
|
self.started = None;
|
||||||
|
}
|
||||||
match self.started {
|
match self.started {
|
||||||
Some((frames, usecs)) => {
|
Some((_, usecs)) => {
|
||||||
self.usecs = current_usecs as usize - usecs;
|
self.usecs = current_usecs as usize - usecs;
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue