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:
2026-07-04 12:31:11 -07:00
parent 4e58c9bd9b
commit 5090a9255f
12 changed files with 424 additions and 95 deletions
+17 -17
View File
@@ -26,10 +26,12 @@ public struct TunerView: View {
private static let trackingConfidenceThreshold: Double = 0.8
/// Opacity applied to the latched readout while not actively tracking.
private static let untrackedOpacity: Double = 0.35
private static let panelSpacing: CGFloat = 10
private static let rowSpacing: CGFloat = 14
private static let noteFontSize: CGFloat = 34
private static let readoutSpacing: CGFloat = 10
private static let noteFontSize: CGFloat = 24
private static let statusFontSize: CGFloat = 10
/// Fixed row height = the engaged (readout-visible) height, so toggling doesn't shift layout.
static let engagedHeight: CGFloat = 34
// MARK: - Properties
@@ -50,25 +52,23 @@ public struct TunerView: View {
// MARK: - Body
public var body: some View {
VStack(spacing: TunerView.panelSpacing) {
HStack(spacing: TunerView.rowSpacing) {
Button(shoeGaze.tunerEngaged ? "Tuner: On" : "Tuner: Off") {
shoeGaze.toggleTunerEngaged()
}
.buttonStyle(.bordered)
.tint(shoeGaze.tunerEngaged ? .green : .gray)
Toggle("Mute rig", isOn: Binding(
get: { shoeGaze.tunerMutesRig },
set: { shoeGaze.tunerMutesRig = $0 }
))
.toggleStyle(.switch)
// Single horizontal row so engaging the tuner grows it sideways, not downward — the
// transport row keeps its height and the pedals below don't jump.
HStack(spacing: TunerView.rowSpacing) {
Button(shoeGaze.tunerEngaged ? "Tuner: On" : "Tuner: Off") {
shoeGaze.toggleTunerEngaged()
}
.buttonStyle(.bordered)
.tint(shoeGaze.tunerEngaged ? .green : .gray)
.frame(width: TempoView.toggleWidth, alignment: .leading)
if shoeGaze.tunerEngaged {
readout
}
}
// Pin to the engaged height (the taller readout state) so toggling the tuner on/off never
// shifts the surrounding layout by a few pixels.
.frame(height: TunerView.engagedHeight)
.task(id: shoeGaze.tunerEngaged) {
while shoeGaze.tunerEngaged && !Task.isCancelled {
updateReading()
@@ -100,7 +100,7 @@ public struct TunerView: View {
@ViewBuilder
private var readout: some View {
if let pitch: TunerPitchReading = latchedPitch {
VStack(spacing: 6) {
HStack(spacing: TunerView.readoutSpacing) {
Text(pitch.noteName)
.font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded))
.foregroundStyle(TunerView.color(forCents: pitch.cents))
@@ -111,7 +111,7 @@ public struct TunerView: View {
}
.opacity(isTracking ? 1.0 : TunerView.untrackedOpacity)
} else {
VStack(spacing: 6) {
HStack(spacing: TunerView.readoutSpacing) {
Text("—")
.font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded))
.foregroundStyle(Color.white.opacity(0.4))