1.2.1 release to support some ShoeGaze features
This commit is contained in:
@@ -10,10 +10,14 @@ import Synchronization
|
||||
|
||||
/// Interpolated read from `buffer` at a fractional frame `phase` for one `channel`.
|
||||
///
|
||||
/// - For `loop == true`: frames wrap modulo `buffer.count` (seamless looping). `wrappedFrame`
|
||||
/// handles negative frame indices via `r += frameCount`, so backward reads across the loop
|
||||
/// point are correct.
|
||||
/// - For `loop == false`: frames are clamped to `[0, buffer.count − 1]` (hold at ends).
|
||||
/// - For `loop == true`: frames wrap modulo `buffer.loopLength` (seamless looping).
|
||||
/// `wrappedFrame` handles negative frame indices via `r += frameCount`, so backward
|
||||
/// reads across the loop point are correct.
|
||||
/// - For `loop == false`: frames are clamped to `[0, buffer.loopLength − 1]` (hold at ends).
|
||||
///
|
||||
/// `buffer.loopLength` defaults to `buffer.count` (full-buffer looping) but may be
|
||||
/// narrowed at runtime — e.g. a looper pedal that recorded a take shorter than its
|
||||
/// max-duration buffer allocation — to bound wrap/clamp to just the recorded region.
|
||||
///
|
||||
/// Used by `PlayBuffer.Audio` and `PlayBuffer.Control`; exposed as `internal` for reuse by
|
||||
/// future buffer-reading generators (e.g. `BufferGrain`).
|
||||
@@ -25,7 +29,7 @@ internal func lyrebirdBufferRead(
|
||||
interpolation: TableInterpolation,
|
||||
loop: Bool
|
||||
) -> Double {
|
||||
let frameCount: Int = buffer.count
|
||||
let frameCount: Int = buffer.loopLength
|
||||
|
||||
@inline(__always)
|
||||
func clampedFrame(_ f: Int) -> Int {
|
||||
@@ -356,7 +360,7 @@ public enum PlayBuffer {
|
||||
return _result
|
||||
}
|
||||
|
||||
let bufferFrames: Double = Double(buffer.count)
|
||||
let bufferFrames: Double = Double(buffer.loopLength)
|
||||
|
||||
@inline(__always)
|
||||
func rateAt(_ i: Int) -> Double {
|
||||
@@ -526,7 +530,7 @@ public enum PlayBuffer {
|
||||
// Read one output value for this block.
|
||||
let outputVal: Double
|
||||
if let buffer: LyrebirdBuffer = _slot.load(engine: graph.engine), buffer.isValid, !_isDone {
|
||||
let bufferFrames: Double = Double(buffer.count)
|
||||
let bufferFrames: Double = Double(buffer.loopLength)
|
||||
outputVal = lyrebirdBufferRead(
|
||||
buffer, channel: 0, phase: _phase,
|
||||
interpolation: interpolation, loop: loop
|
||||
|
||||
Reference in New Issue
Block a user