Release 2.0.0: metronome, rig mute + shortcuts, set-list ordering, per-rig persistence
- Visual metronome tempo indicator (pendulum playhead) replacing the flashing LED - Rig Mute (Cmd-Z) hard-silence, distinct from Bypass Rig; wired to header, board menu, MIDI - Keyboard shortcuts: Cmd-1..9 board switch, Cmd-Shift-1..0 set-list rig load, Cmd-Z mute (macOS native menus + iOS/iPadOS hardware keyboards) - Rig set-list ordering: drag or Move Up/Down in the picker; order saved and archive-portable - Persist tempo, input selection, and engine I/O with a rig (I/O applied via opt-in applyChannelLayout, not forced on load) - Fix archive import colliding set-list positions with existing rigs - Remove ShoeGazeDemo / ShoeGazeiOSDemo apps and projects; keep the two Builder apps - Bump marketing version to 2.0.0 on both Builder projects; pin Lyrebird 1.2.3 - Add CHANGELOG.md Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -19,13 +19,32 @@ public struct TempoView: View {
|
||||
// MARK: - Constants
|
||||
|
||||
private static let pollIntervalNanoseconds: UInt64 = 33_333_333 // ~30 Hz
|
||||
/// Fraction of each beat the LED stays lit — a short flash, not a 50% duty-cycle blink.
|
||||
private static let flashDutyCycle: Double = 0.15
|
||||
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 = 14
|
||||
private static let rowSpacing: CGFloat = 10
|
||||
|
||||
// Metronome track: a dot swings wall-to-wall once per beat, pausing at each wall (the beat)
|
||||
// so the eye can anticipate the hit. Pendulum easing comes for free from the cosine map.
|
||||
private static let trackWidth: CGFloat = 150
|
||||
private static let trackHeight: CGFloat = 16
|
||||
private static let trackCornerRadius: CGFloat = 4
|
||||
private static let trackBrightness: Double = 0.14
|
||||
private static let trackBorderOpacity: Double = 0.35
|
||||
private static let trackBorderWidth: CGFloat = 1
|
||||
/// Vertical playhead sweeping horizontally across the track (Looper-style), full track height.
|
||||
private static let lineWidth: CGFloat = 3
|
||||
/// Playhead opacity floor at mid-swing; ramps to full at the walls so it fades as it travels
|
||||
/// toward center and re-brightens into each beat.
|
||||
private static let lineMinOpacity: Double = 0.25
|
||||
/// Curve on the wall-proximity → brightness map; > 1 dims harder through the middle.
|
||||
private static let brightnessFadeCurve: Double = 1.6
|
||||
/// Soft glow drawn behind the playhead; its opacity peaks at the turnaround (on the beat).
|
||||
private static let glowWidth: CGFloat = 16
|
||||
private static let glowMaxOpacity: Double = 0.7
|
||||
/// End-wall tick marks sit on the beat positions.
|
||||
private static let wallTickWidth: CGFloat = 2
|
||||
private static let wallTickOpacity: Double = 0.4
|
||||
/// Fixed row height = the enabled (BPM/TAP-visible) height, so toggling doesn't shift layout.
|
||||
static let enabledHeight: CGFloat = 34
|
||||
|
||||
@@ -34,7 +53,8 @@ public struct TempoView: View {
|
||||
private let shoeGaze: ShoeGaze
|
||||
|
||||
@State private var displayedBpm: Double
|
||||
@State private var ledOn: Bool = false
|
||||
/// Continuous beat position, polled from the clock; drives the metronome dot.
|
||||
@State private var beat: Double = 0.0
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
@@ -57,7 +77,7 @@ public struct TempoView: View {
|
||||
.help("Show the tempo indicator and enable tempo-synced controls")
|
||||
|
||||
if shoeGaze.tempoEnabled {
|
||||
led
|
||||
metronome
|
||||
Text("\(Int(displayedBpm.rounded())) BPM")
|
||||
.font(.system(size: 18, weight: .semibold, design: .rounded))
|
||||
.foregroundStyle(Color.white)
|
||||
@@ -84,9 +104,7 @@ public struct TempoView: View {
|
||||
.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
|
||||
beat = shoeGaze.clock.currentBeat
|
||||
displayedBpm = shoeGaze.clock.bpm
|
||||
try? await Task.sleep(nanoseconds: TempoView.pollIntervalNanoseconds)
|
||||
}
|
||||
@@ -95,10 +113,62 @@ public struct TempoView: View {
|
||||
|
||||
// MARK: - Subviews
|
||||
|
||||
private var led: some View {
|
||||
Circle()
|
||||
.fill(ledOn ? Color.red : Color.red.opacity(0.15))
|
||||
.frame(width: TempoView.ledDiameter, height: TempoView.ledDiameter)
|
||||
/// Horizontal pendulum: the dot maps `beat` through a cosine so it eases to a stop at each
|
||||
/// wall (an integer beat) and moves fastest at mid-swing — the wall pauses give the eye a
|
||||
/// runway to anticipate the beat. `x01 = (1 − cos(π·swing)) / 2`, `swing = beat mod 2`, puts
|
||||
/// the left wall on even beats and the right wall on odd beats (one wall hit per beat).
|
||||
private var metronome: some View {
|
||||
// Reduce beat mod 2 before the cosine so precision holds over a long session.
|
||||
let swing: Double = beat.truncatingRemainder(dividingBy: 2)
|
||||
let x01: Double = (1 - cos(.pi * swing)) / 2
|
||||
// Proximity to a wall in [0, 1]: 1 at a wall (on the beat), 0 at mid-swing. The curve dims
|
||||
// harder through the middle so the playhead visibly fades as it travels toward center.
|
||||
let wallGlow: Double = pow(1 - 2 * min(x01, 1 - x01), TempoView.brightnessFadeCurve)
|
||||
|
||||
return ZStack(alignment: .leading) {
|
||||
RoundedRectangle(cornerRadius: TempoView.trackCornerRadius)
|
||||
.fill(Color(white: TempoView.trackBrightness))
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: TempoView.trackCornerRadius)
|
||||
.strokeBorder(
|
||||
Color.white.opacity(TempoView.trackBorderOpacity),
|
||||
lineWidth: TempoView.trackBorderWidth
|
||||
)
|
||||
)
|
||||
// Beat-position tick marks flush against each end wall.
|
||||
.overlay(alignment: .leading) { wallTick }
|
||||
.overlay(alignment: .trailing) { wallTick }
|
||||
|
||||
playhead(x01: x01, wallGlow: wallGlow)
|
||||
}
|
||||
.frame(width: TempoView.trackWidth, height: TempoView.trackHeight)
|
||||
.clipShape(RoundedRectangle(cornerRadius: TempoView.trackCornerRadius))
|
||||
}
|
||||
|
||||
private var wallTick: some View {
|
||||
Rectangle()
|
||||
.fill(Color.white.opacity(TempoView.wallTickOpacity))
|
||||
.frame(width: TempoView.wallTickWidth)
|
||||
}
|
||||
|
||||
private func playhead(x01: Double, wallGlow: Double) -> some View {
|
||||
// Travel spans the track minus the line's own width so the playhead kisses each wall.
|
||||
let travel: CGFloat = TempoView.trackWidth - TempoView.lineWidth
|
||||
let x: CGFloat = CGFloat(x01) * travel
|
||||
let lineOpacity: Double = TempoView.lineMinOpacity + (1 - TempoView.lineMinOpacity) * wallGlow
|
||||
|
||||
// Center glow + line share a leading-aligned box; offset positions the line's leading edge.
|
||||
return ZStack {
|
||||
Rectangle()
|
||||
.fill(Color.red.opacity(TempoView.glowMaxOpacity * wallGlow))
|
||||
.frame(width: TempoView.glowWidth, height: TempoView.trackHeight)
|
||||
.blur(radius: TempoView.glowWidth / 3)
|
||||
Rectangle()
|
||||
.fill(Color.red.opacity(lineOpacity))
|
||||
.frame(width: TempoView.lineWidth, height: TempoView.trackHeight)
|
||||
}
|
||||
.frame(width: TempoView.lineWidth, height: TempoView.trackHeight, alignment: .center)
|
||||
.offset(x: x)
|
||||
}
|
||||
|
||||
private var tapArea: some View {
|
||||
|
||||
Reference in New Issue
Block a user