Add looper pedal: beat-quantized transport, undo, reverse, timeline
Extend the looper into a double-width tempo-aware pedal: - Beat-quantized transport: record start and loop close both snap to the next beat via a LyrebirdRoutine waiting on the shared clock; loop length is an exact whole-beat span. Falls back to immediate/unquantized when no clock is present. - Loop-length read-outs (frames/seconds/beats), transport state, and a sample-clock-derived play-head position for the UI timeline. - Overdub undo (pre-dub snapshot + restore), reverse playback (live rate flip), and feedback-decay overdub (overdub preLevel via a Feedback knob). - Inject the shared LyrebirdClock + SynthesisEngine into Pedal via PedalBoard/ChainRouter so tempo-aware pedals can reach them. - New double-width LooperTimelineView (state badge, length read-out, sweeping play-head) wired into PedalView via Pedal.widthUnits. Concurrency hardening from RT-safety review: a transportGeneration counter drops superseded deferred beat/undo callbacks that LyrebirdRoutine.stop() cannot recall once enqueued; the undo restore is deferred past the RT overdub gate-close; transport routines use non-blocking stop(). Note: this commit also snapshots pre-existing uncommitted work-in-progress already in the tree (MIDI control refactor, Tuner, Tempo, preset changes), which is interleaved with the looper changes through shared files and could not be split into a separately-building commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,9 +17,19 @@ public enum RigStore {
|
||||
private static let folderName: String = "ShoeGaze"
|
||||
private static let fileName: String = "autosave-rig.json"
|
||||
|
||||
/// Test-only override for ``autosaveURL``. When non-`nil`, all autosave reads/writes use this
|
||||
/// path instead of the real Application Support location — so a test suite never overwrites or
|
||||
/// deletes the user's actual autosaved rig. Production code leaves this `nil`.
|
||||
///
|
||||
/// - Important: Any test that calls `save`/`restore`/`clear` **must** set this to a temporary
|
||||
/// file first (and reset it after), or it will clobber the running app's autosave.
|
||||
public static var autosaveURLOverride: URL?
|
||||
|
||||
/// Location of the autosave file, creating the containing folder if needed. `nil` if the
|
||||
/// Application Support directory can't be resolved.
|
||||
/// Application Support directory can't be resolved. Returns ``autosaveURLOverride`` verbatim
|
||||
/// when set (tests).
|
||||
public static var autosaveURL: URL? {
|
||||
if let override: URL = autosaveURLOverride { return override }
|
||||
let fileManager: FileManager = FileManager.default
|
||||
guard let base: URL = try? fileManager.url(
|
||||
for: .applicationSupportDirectory,
|
||||
|
||||
Reference in New Issue
Block a user