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:
@@ -24,10 +24,12 @@ public struct TempoView: View {
|
||||
private static let minBpm: Double = 30.0
|
||||
private static let maxBpm: Double = 300.0
|
||||
private static let bpmStep: Double = 1.0
|
||||
private static let ledDiameter: CGFloat = 16
|
||||
private static let panelSpacing: CGFloat = 10
|
||||
private static let rowSpacing: CGFloat = 14
|
||||
private static let tapAreaSize: CGFloat = 64
|
||||
private static let ledDiameter: CGFloat = 14
|
||||
private static let rowSpacing: CGFloat = 10
|
||||
/// Shared width for the Tempo / Tuner engage toggles so they left-align in the stacked column.
|
||||
static let toggleWidth: CGFloat = 96
|
||||
/// Fixed row height = the enabled (BPM/TAP-visible) height, so toggling doesn't shift layout.
|
||||
static let enabledHeight: CGFloat = 34
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
@@ -47,8 +49,16 @@ public struct TempoView: View {
|
||||
// MARK: - Body
|
||||
|
||||
public var body: some View {
|
||||
VStack(spacing: TempoView.panelSpacing) {
|
||||
HStack(spacing: TempoView.rowSpacing) {
|
||||
HStack(spacing: TempoView.rowSpacing) {
|
||||
Button(shoeGaze.tempoEnabled ? "Tempo: On" : "Tempo: Off") {
|
||||
shoeGaze.setTempoEnabled(!shoeGaze.tempoEnabled)
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.tint(shoeGaze.tempoEnabled ? .green : .gray)
|
||||
.frame(width: TempoView.toggleWidth, alignment: .leading)
|
||||
.help("Show the tempo indicator and enable tempo-synced controls")
|
||||
|
||||
if shoeGaze.tempoEnabled {
|
||||
led
|
||||
Text("\(Int(displayedBpm.rounded())) BPM")
|
||||
.font(.system(size: 18, weight: .semibold, design: .rounded))
|
||||
@@ -67,12 +77,15 @@ public struct TempoView: View {
|
||||
step: TempoView.bpmStep
|
||||
)
|
||||
.labelsHidden()
|
||||
}
|
||||
|
||||
tapArea
|
||||
tapArea
|
||||
}
|
||||
}
|
||||
.task {
|
||||
while !Task.isCancelled {
|
||||
// Pin to the enabled height (BPM / stepper / TAP visible) so toggling tempo on/off never
|
||||
// shifts the surrounding layout.
|
||||
.frame(height: TempoView.enabledHeight)
|
||||
.task(id: shoeGaze.tempoEnabled) {
|
||||
while shoeGaze.tempoEnabled && !Task.isCancelled {
|
||||
let beat: Double = shoeGaze.clock.currentBeat
|
||||
let phase: Double = beat - beat.rounded(.down)
|
||||
ledOn = phase < TempoView.flashDutyCycle
|
||||
@@ -91,17 +104,17 @@ public struct TempoView: View {
|
||||
}
|
||||
|
||||
private var tapArea: some View {
|
||||
// A standard-height bordered button (not a tall circle) so the tempo row matches the
|
||||
// height of the title and the engine-option buttons and top-aligns cleanly with them.
|
||||
Button {
|
||||
shoeGaze.tapTempo()
|
||||
displayedBpm = shoeGaze.clock.bpm
|
||||
} label: {
|
||||
Text("TAP")
|
||||
.font(.system(size: 14, weight: .bold, design: .rounded))
|
||||
.frame(width: TempoView.tapAreaSize, height: TempoView.tapAreaSize)
|
||||
.background(Color.white.opacity(0.08))
|
||||
.clipShape(Circle())
|
||||
.font(.system(size: 13, weight: .bold, design: .rounded))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.buttonStyle(.bordered)
|
||||
.tint(.gray)
|
||||
.foregroundStyle(Color.white)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user