Looper reverse fix + header layout compaction + tempo toggle
Looper: - Reverse now continues from the current play-head instead of jumping to duration-minus-position; anchor-based position tracking survives direction changes. Sync mode defers the flip to the next beat; Free applies immediately. - Sync switch relabeled "Sync to Tempo". Tempo/Tuner: - Add a Tempo on/off toggle (ShoeGaze.setTempoEnabled) that hides the indicator and forces every tempo-dependent pedal switch (PedalSwitch.tempoDependent) off; PedalSwitchView disables such switches via the shoeGazeTempoEnabled environment. - Tuner readout laid out inline; Tempo/Tuner pinned to fixed heights so toggling state no longer shifts surrounding layout. Header: - Collapsed to two rows: title + Tempo/Tuner (left, stacked) and engine options over input controls (right, trailing-aligned). TAP is a standard-height button. - Removed the redundant Boards button; moved Clear into the board bar. - Fixed the rig mute glyph size so toggling mute doesn't shift the volume row. Help: added a Looper section documenting transport, Free/Sync, knobs, tracks, and MIDI-assignable actions. Tests: TempoEnableTests + looper reverse/deferral coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// TempoEnableTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
import Foundation
|
||||
import LyrebirdSynth
|
||||
@testable import LyrebirdShoeGaze
|
||||
|
||||
@MainActor
|
||||
@Suite("Tempo enable")
|
||||
struct TempoEnableTests {
|
||||
|
||||
private func makeRigWithLooper() throws -> (ShoeGaze, SynthesisEngine, URL, LooperPedal) {
|
||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.1)
|
||||
let sg: ShoeGaze = ShoeGaze(engine: engine)
|
||||
let board: PedalBoard = try sg.addBoard()
|
||||
guard let looper: LooperPedal = PedalRegistry.makePedal(type: "Looper") as? LooperPedal else {
|
||||
fatalError("Looper pedal must be registered")
|
||||
}
|
||||
try board.add(looper)
|
||||
try sg.finalizeBoard(board)
|
||||
return (sg, engine, url, looper)
|
||||
}
|
||||
|
||||
@Test func tempoEnabledDefaultsOn() throws {
|
||||
let (sg, _, url, _): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
#expect(sg.tempoEnabled, "tempo indicator is on by default")
|
||||
}
|
||||
|
||||
@Test func looperSyncSwitchIsTempoDependent() throws {
|
||||
let (_, _, url, looper): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
let syncSwitch: PedalSwitch? = looper.effectSwitches.first { $0.tempoDependent }
|
||||
#expect(syncSwitch != nil, "the looper Sync-to-Tempo switch must be marked tempo-dependent")
|
||||
}
|
||||
|
||||
@Test func disablingTempoForcesSyncSwitchesOff() throws {
|
||||
let (sg, _, url, looper): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
|
||||
looper.syncToBeat = 1.0 // engage Sync
|
||||
sg.setTempoEnabled(false)
|
||||
#expect(!sg.tempoEnabled)
|
||||
#expect(looper.syncToBeat == 0.0, "disabling tempo forces the looper back to Free")
|
||||
|
||||
// Re-enabling leaves it Free — the user re-selects Sync if wanted.
|
||||
sg.setTempoEnabled(true)
|
||||
#expect(sg.tempoEnabled)
|
||||
#expect(looper.syncToBeat == 0.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user