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
@@ -384,8 +384,7 @@ public struct ShoeGazeBuilderView: View {
/// board canvas.
private var builderColumn: some View {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
transportRow
ioRow
headerSection
#if !os(macOS)
recordingRow
#endif
@@ -395,6 +394,7 @@ public struct ShoeGazeBuilderView: View {
boardArea
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.environment(\.shoeGazeTempoEnabled, shoeGaze.tempoEnabled)
}
/// Top section: the scope + CPU meters on the left (sized to align with the mixer's
@@ -415,7 +415,8 @@ public struct ShoeGazeBuilderView: View {
shoeGaze: shoeGaze,
editingBoardIndex: $selectedBoardIndex,
crossfadeSeconds: $crossfadeSeconds,
onAddBoard: { addBoard() }
onAddBoard: { addBoard() },
onClearBoards: { showClearDialog = true }
)
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
pedalPickerRow
@@ -530,9 +531,12 @@ public struct ShoeGazeBuilderView: View {
// MARK: - Transport row
private var transportRow: some View {
/// Two-row header. Left: the title with the Tempo / Tuner toggles stacked and left-aligned
/// beside it. Right: the engine options (row 1) over the input controls (row 2), trailing-
/// aligned so both right edges line up. Keeping it two rows tall frees canvas for the pedals.
private var headerSection: some View {
_ = transportTick
return HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
return HStack(alignment: .top, spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: 1) {
Text("ShoeGaze Builder")
.font(.title2).bold()
@@ -551,19 +555,60 @@ public struct ShoeGazeBuilderView: View {
.foregroundStyle(Color.red)
}
}
Spacer()
TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze)
if let midi: MIDIController = midi {
MIDIIndicatorView(controller: midi) { showMIDISheet = true }
// Tempo over Tuner, left-aligned to each other.
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze)
}
Spacer()
// Right column: engine options over input controls, both right-aligned.
VStack(alignment: .trailing, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
if let midi: MIDIController = midi {
MIDIIndicatorView(controller: midi) { showMIDISheet = true }
}
helpButton
rigBypassButton
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() }
)
}
.frame(height: TempoView.enabledHeight)
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
// Mute-rig-while-tuning toggle sits to the left of the input selector.
Toggle("Mute rig", isOn: Binding(
get: { shoeGaze.tunerMutesRig },
set: { shoeGaze.tunerMutesRig = $0 }
))
.toggleStyle(.switch)
Text("Input:")
.font(.subheadline)
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
Picker("Input", selection: inputBinding) {
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
if shoeGaze.engine.numInputChannels > 0 {
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
} else if onEnableLiveInput != nil {
// No input channel yet: offer live input; selecting it asks the host to
// request mic access and rebuild the engine with one (channel 0).
Text("Live Input").tag(0)
}
}
.labelsHidden()
.pickerStyle(.menu)
.foregroundStyle(Color.white)
}
.frame(height: TempoView.enabledHeight)
}
helpButton
rigBypassButton
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() }
)
}
}
@@ -595,40 +640,6 @@ public struct ShoeGazeBuilderView: View {
.help("Bypass the entire rig — every board passes your dry input straight through")
}
// MARK: - Input + board + save/load row
private var ioRow: some View {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
Text("Input:")
.font(.subheadline)
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
Picker("Input", selection: inputBinding) {
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
if shoeGaze.engine.numInputChannels > 0 {
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
} else if onEnableLiveInput != nil {
// No input channel yet: offer live input; selecting it asks the host to
// request mic access and rebuild the engine with one (channel 0).
Text("Live Input").tag(0)
}
}
.pickerStyle(.menu)
.foregroundStyle(Color.white)
Button("Boards…") { showBoardsSheet = true }
.buttonStyle(.bordered).tint(.orange)
.help("Rename, reorder, or delete boards")
Button("Clear") { showClearDialog = true }
.buttonStyle(.bordered).tint(.red)
.help("Remove all boards in the current rig (with the option to save first)")
Spacer()
}
}
// MARK: - Board area
private var boardArea: some View {