mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: down to 13 errors
This commit is contained in:
parent
6ce83fb27a
commit
ebdb8881e9
19 changed files with 793 additions and 691 deletions
|
|
@ -177,4 +177,25 @@ impl Clock {
|
|||
pub fn next_launch_instant (&self) -> Moment {
|
||||
Moment::from_pulse(self.timebase(), self.next_launch_pulse() as f64)
|
||||
}
|
||||
|
||||
/// Get index of first sample to populate.
|
||||
///
|
||||
/// Greater than 0 means that the first pulse of the clip
|
||||
/// falls somewhere in the middle of the chunk.
|
||||
pub fn get_sample_offset (&self, scope: &ProcessScope, started: &Moment) -> usize{
|
||||
(scope.last_frame_time() as usize).saturating_sub(
|
||||
started.sample.get() as usize +
|
||||
self.started.read().unwrap().as_ref().unwrap().sample.get() as usize
|
||||
)
|
||||
}
|
||||
|
||||
// Get iterator that emits sample paired with pulse.
|
||||
//
|
||||
// * Sample: index into output buffer at which to write MIDI event
|
||||
// * Pulse: index into clip from which to take the MIDI event
|
||||
//
|
||||
// Emitted for each sample of the output buffer that corresponds to a MIDI pulse.
|
||||
pub fn get_pulses (&self, scope: &ProcessScope, offset: usize) -> TicksIterator {
|
||||
self.timebase().pulses_between_samples(offset, offset + scope.n_frames() as usize)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue