mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
group sample/pulse/usecs into Instant
This commit is contained in:
parent
205dbef9b0
commit
fec6294c7b
4 changed files with 43 additions and 20 deletions
|
|
@ -4,6 +4,9 @@ impl<E: Engine> Audio for Arranger<E> {
|
|||
if let Some(ref transport) = self.transport {
|
||||
transport.write().unwrap().process(client, scope);
|
||||
}
|
||||
//for track in self.arrangement.tracks.iter_mut() {
|
||||
//track.player.process(client, scope)
|
||||
//}
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ impl<E: Engine> Audio for Sequencer<E> {
|
|||
Control::Continue
|
||||
}
|
||||
}
|
||||
|
||||
impl Phrase {
|
||||
/// Write a chunk of MIDI events to an output port.
|
||||
pub fn process_out (
|
||||
|
|
|
|||
|
|
@ -3,14 +3,10 @@ use crate::*;
|
|||
pub struct TransportTime {
|
||||
/// Current sample sr, tempo, and PPQ.
|
||||
pub timebase: Timebase,
|
||||
/// Current moment in time
|
||||
pub instant: Instant,
|
||||
/// Playback state
|
||||
pub playing: RwLock<Option<TransportState>>,
|
||||
/// Current time in samples
|
||||
pub sample: AtomicUsize,
|
||||
/// Current time in pulses
|
||||
pub pulse: AtomicUsize,
|
||||
/// Current time in microseconds
|
||||
pub usecs: AtomicUsize,
|
||||
/// Note quantization factor
|
||||
pub quant: AtomicUsize,
|
||||
/// Launch quantization factor
|
||||
|
|
@ -57,16 +53,16 @@ impl PulsesPerQuaver<usize> for TransportTime {
|
|||
#[inline] fn set_ppq (&self, ppq: usize) { self.timebase.set_ppq(ppq as f64); }
|
||||
}
|
||||
impl FramePosition<usize> for TransportTime {
|
||||
#[inline] fn sample (&self) -> usize { self.sample.load(Ordering::Relaxed) }
|
||||
#[inline] fn set_sample (&self, sample: usize) { self.sample.store(sample, Ordering::Relaxed); }
|
||||
#[inline] fn sample (&self) -> usize { self.instant.sample() }
|
||||
#[inline] fn set_sample (&self, sample: usize) { self.instant.set_sample(sample) }
|
||||
}
|
||||
impl UsecPosition<usize> for TransportTime {
|
||||
#[inline] fn usec (&self) -> usize { self.usecs.load(Ordering::Relaxed) }
|
||||
#[inline] fn set_usec (&self, usec: usize) { self.usecs.store(usec, Ordering::Relaxed); }
|
||||
#[inline] fn usec (&self) -> usize { self.instant.usec() }
|
||||
#[inline] fn set_usec (&self, usec: usize) { self.instant.set_usec(usec) }
|
||||
}
|
||||
impl PulsePosition<usize> for TransportTime {
|
||||
#[inline] fn pulse (&self) -> usize { self.pulse.load(Ordering::Relaxed) }
|
||||
#[inline] fn set_pulse (&self, usec: usize) { self.pulse.store(usec, Ordering::Relaxed); }
|
||||
#[inline] fn pulse (&self) -> usize { self.instant.pulse() }
|
||||
#[inline] fn set_pulse (&self, usec: usize) { self.instant.set_pulse(usec); }
|
||||
}
|
||||
impl Quantize<usize> for TransportTime {
|
||||
#[inline] fn quant (&self) -> usize { self.quant.load(Ordering::Relaxed) }
|
||||
|
|
@ -97,9 +93,7 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
playing: Some(TransportState::Stopped).into(),
|
||||
quant: 24.into(),
|
||||
sync: (timebase.ppq() as usize * 4).into(),
|
||||
sample: 0.into(),
|
||||
pulse: 0.into(),
|
||||
usecs: 0.into(),
|
||||
instant: Instant::default(),
|
||||
timebase,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue