Release 2.1.0: tempo-synced pedal parameters, editable BPM, control mapping badges
Tempo sync - Lock a delay time or modulation LFO rate to a note division (whole..sixteenth, dotted, triplet) of the shared clock. Value is derived from the tempo and follows tap tempo, the stepper, the editable BPM field, and MIDI. - Delay time: Delay, FeedbackDelay, PingPong, ReverseDelay, MultiTap (per tap). LFO rate (inverse mapping): Tremolo, Vibrato, Chorus, Flanger, Phaser, Modulation. - Core types NoteDivision / TempoSync / TempoSyncableParam; Pedal.tempoSyncableParams / tempoSync / applyTempoSync / setSync; ShoeGaze.setBpm broadcast recomputes all pedals; tempoSync persisted in PedalState (lenient decode) and recomputed on load + recall. - Observable TempoSyncRevision so the sync badge refreshes on any state-change path. UI - Division picker with drawn music-notation glyphs (NoteGlyphView + rasterized cache): noteheads, stems, flags, augmentation dot, bracketed 3 for triplets. Presented as a height-capped popover so it stays on-screen on iOS. - Editable BPM text field: integer-only, live-filtered, clamped 30-300, commit on return / Done / blur. - Divisions that clamp at the current tempo are disabled in the picker; an active clamped sync shows a warning marker. - In-context control mapping badges (PC / CC / KEY) per pedal control, with a legend. Delays - Maximum delay time raised to 5 s across the delay pedals (was 1-2 s). Docs: CHANGELOG.md, RELEASES.md, docs/plans/2.2-tempo-synced-parameters.md. All 454 tests pass; passed lyrebird_external_review (RT-safe, main-thread param writes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -139,7 +139,11 @@ public final class ShoeGaze {
|
||||
/// control by forcing each ``PedalSwitch/tempoDependent`` switch to its first option.
|
||||
public func setTempoEnabled(_ enabled: Bool) {
|
||||
tempoEnabled = enabled
|
||||
guard !enabled else { return }
|
||||
guard !enabled else {
|
||||
// Re-enabling: bring every tempo-synced parameter back in line with the current tempo.
|
||||
applyTempoSyncToAllPedals()
|
||||
return
|
||||
}
|
||||
for pedal: Pedal in allPedals() {
|
||||
for pedalSwitch: PedalSwitch in pedal.effectSwitches where pedalSwitch.tempoDependent {
|
||||
if let off: PedalSwitch.Option = pedalSwitch.options.first {
|
||||
@@ -149,6 +153,27 @@ public final class ShoeGaze {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the shared clock's tempo and recomputes every tempo-synced pedal parameter to match.
|
||||
/// Route **all** BPM changes (stepper, tap tempo, MIDI) through here so synced delay times and
|
||||
/// LFO rates follow the tempo. Recompute is skipped while tempo is disabled.
|
||||
///
|
||||
/// - Parameter bpm: The new tempo in beats per minute. A non-positive value is ignored (the
|
||||
/// clock requires a positive tempo); callers that also want an upper bound clamp before calling.
|
||||
public func setBpm(_ bpm: Double) {
|
||||
guard bpm > 0 else { return }
|
||||
clock.bpm = bpm
|
||||
guard tempoEnabled else { return }
|
||||
applyTempoSyncToAllPedals()
|
||||
}
|
||||
|
||||
/// Recomputes every tempo-synced parameter on every live pedal from the current tempo.
|
||||
/// `internal` so the preset-restore path (`ShoeGaze+Preset.swift`) can re-sync after a rig load.
|
||||
internal func applyTempoSyncToAllPedals() {
|
||||
for pedal: Pedal in allPedals() {
|
||||
pedal.applyTempoSync()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Scope state
|
||||
|
||||
/// Scope tap over the hardware input + output buses, feeding the debug scope view.
|
||||
|
||||
Reference in New Issue
Block a user