Skip to main content

interp_loop_sample

Function interp_loop_sample 

Source
pub fn interp_loop_sample(
    prev: u16,
    next: u16,
    elapsed_ms: u32,
    tick_interval_ms: u32,
    ppqn: u8,
) -> u16
Expand description

Linearly interpolates between two adjacent loop samples at 1 ms resolution.

tick_interval_ms: measured duration of the last clock tick (ms). ppqn: the clock division in use. Caps the interpolation window at the interval expected at 20 BPM for that division, so output holds at next rather than drifting if the clock stalls.