Looper: multitrack redesign with smart Loop footswitch
Replace the one-at-a-time slot model with a synchronized multitrack looper: four track players summed to one output, track A's first take defining the master loop length, and tracks B–D recorded as phase-locked overdub layers on the same grid (overdub recorders run continuously while playing, reset to the top at play-start, gated per-track by recLevel so only the selected track layers new input — instant, drift-free overdub toggles). A single smart Loop footswitch drives the whole transport by state: record A → set end (quantized) → auto-overdub on wrap → toggle overdub/play; B–D toggle overdub aligned to A's play-head. Selecting a track ends the prior overdub. Stop / Cue Stop pause; Loop resumes. Reset returns to clear. UI: transport row is now Loop / Stop / Cue Stop / Reverse / Reset; the old action row is replaced by a one-line state indicator; the A/B/C/D timeline dots are tappable to select a track; every stomp button shows a live caption of what its next press does (Record → Set End → Overdub → Play, etc.). Overdub-undo dropped. All transport routines keep the transportGeneration guard on deferred beat/stop callbacks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -47,9 +47,7 @@ public struct PedalButtonView: View {
|
||||
VStack(spacing: PedalButtonView.sectionSpacing) {
|
||||
LEDIndicator(isOn: isOn)
|
||||
FootswitchButton(action: pedalButton.action ?? {})
|
||||
Text(pedalButton.label)
|
||||
.font(.system(size: PedalButtonView.captionFontSize))
|
||||
.foregroundStyle(Color.white)
|
||||
caption
|
||||
}
|
||||
} else {
|
||||
ParameterButton(pedalButton.label, action: pedalButton.action ?? {})
|
||||
@@ -61,11 +59,48 @@ public struct PedalButtonView: View {
|
||||
VStack(spacing: PedalButtonView.sectionSpacing) {
|
||||
LEDIndicator(isOn: isOn)
|
||||
FootswitchButton(node: node)
|
||||
Text(pedalButton.label)
|
||||
.font(.system(size: PedalButtonView.captionFontSize))
|
||||
.foregroundStyle(Color.white)
|
||||
caption
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The button caption — a live "what the next press does" label when the descriptor supplies
|
||||
/// a `dynamicLabel`, otherwise the static label.
|
||||
@ViewBuilder
|
||||
private var caption: some View {
|
||||
if let provider: () -> String = pedalButton.dynamicLabel {
|
||||
DynamicCaption(provider: provider, fallback: pedalButton.label)
|
||||
.font(.system(size: PedalButtonView.captionFontSize))
|
||||
.foregroundStyle(Color.white)
|
||||
} else {
|
||||
Text(pedalButton.label)
|
||||
.font(.system(size: PedalButtonView.captionFontSize))
|
||||
.foregroundStyle(Color.white)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - DynamicCaption
|
||||
|
||||
/// A caption that polls a text provider (RT-adjacent pedal state that isn't `@Observable`), on
|
||||
/// the same `.task` cadence as the looper timeline, so a state-driven button label stays current.
|
||||
private struct DynamicCaption: View {
|
||||
|
||||
private static let pollIntervalNanoseconds: UInt64 = 33_000_000 // ~30 Hz
|
||||
|
||||
let provider: () -> String
|
||||
let fallback: String
|
||||
|
||||
@State private var text: String = ""
|
||||
|
||||
var body: some View {
|
||||
Text(text.isEmpty ? fallback : text)
|
||||
.task {
|
||||
while !Task.isCancelled {
|
||||
text = provider()
|
||||
try? await Task.sleep(nanoseconds: DynamicCaption.pollIntervalNanoseconds)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user