2.1.1: ignore MIDI CC on tempo-synced parameters
A CC bound to a pedal parameter locked to a note division is now ignored while synced — the value is tempo-derived and a CC write would be overwritten on the next tempo change. Index-stable: ccMappableControls is unchanged (persisted bindings resolve by position), and only the CC *write* is skipped. MIDIController.applyCC checks Pedal.isNodeTempoSynced(_:) (node-identity match against tempoSyncableParams) and skips the update; the binding stays intact and resumes control once set back to Free. Test: MIDIControllerCCTests.ccIsIgnoredWhileParameterIsTempoSynced. 455 tests pass. Docs: CHANGELOG.md, RELEASES.md, plan MIDI section updated to "implemented". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,16 @@ All notable changes to ShoeGaze are recorded here. The format follows
|
|||||||
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
||||||
[semantic versioning](https://semver.org/spec/v2.0.0.html).
|
[semantic versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2.1.1] — 2026-07-10
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **MIDI CC no longer fights tempo sync.** A Control Change bound to a pedal parameter
|
||||||
|
that is locked to a note division is ignored while synced — the value is derived from
|
||||||
|
the tempo, so a CC write would be overwritten on the next tempo change. The binding
|
||||||
|
stays intact (its slot index is unchanged, so other bindings are unaffected) and
|
||||||
|
resumes control the moment the parameter is set back to Free.
|
||||||
|
|
||||||
## [2.1.0] — 2026-07-10
|
## [2.1.0] — 2026-07-10
|
||||||
|
|
||||||
Tempo comes to the pedals. Delay times and modulation rates can lock to a note
|
Tempo comes to the pedals. Delay times and modulation rates can lock to a note
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
# Releases
|
# Releases
|
||||||
|
## ShoeGaze 2.1.1
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **MIDI CC vs. tempo sync** — a CC bound to a parameter locked to a note division is
|
||||||
|
ignored while synced (the tempo drives the value); the binding stays intact and
|
||||||
|
resumes control once the parameter is set back to Free.
|
||||||
|
|
||||||
## ShoeGaze 2.1.0
|
## ShoeGaze 2.1.0
|
||||||
|
|
||||||
Tempo comes to the pedals. Delay times and LFO rates can lock to note divisions of the
|
Tempo comes to the pedals. Delay times and LFO rates can lock to note divisions of the
|
||||||
|
|||||||
@@ -250,6 +250,14 @@ public final class MIDIController {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
guard let resolved: ResolvedCC = resolveCC(binding.target) else { continue }
|
guard let resolved: ResolvedCC = resolveCC(binding.target) else { continue }
|
||||||
|
// A parameter locked to a note division is driven by the tempo; a CC write would be
|
||||||
|
// overwritten on the next tempo change, so ignore it here. The binding stays intact and
|
||||||
|
// resumes control the moment the parameter is set back to Free.
|
||||||
|
if case let .pedalControl(pedalID, _, _, _) = binding.target,
|
||||||
|
let pedal: Pedal = pedal(id: pedalID),
|
||||||
|
pedal.isNodeTempoSynced(resolved.node) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
let mapped: Double = resolved.range.lowerBound
|
let mapped: Double = resolved.range.lowerBound
|
||||||
+ norm * (resolved.range.upperBound - resolved.range.lowerBound)
|
+ norm * (resolved.range.upperBound - resolved.range.lowerBound)
|
||||||
resolved.node.update(mapped)
|
resolved.node.update(mapped)
|
||||||
|
|||||||
@@ -316,6 +316,20 @@ open class Pedal: SynthesizerBase {
|
|||||||
applyTempoSync()
|
applyTempoSync()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether `node` backs a tempo-syncable parameter currently locked to a note division.
|
||||||
|
///
|
||||||
|
/// Used by MIDI to leave a synced parameter alone: its value is derived from the tempo, so a CC
|
||||||
|
/// write would be immediately overwritten on the next tempo change. Matches by node identity, so
|
||||||
|
/// it stays correct regardless of control ordering. Returns `false` for a free or non-syncable node.
|
||||||
|
public func isNodeTempoSynced(_ node: UIParamNode) -> Bool {
|
||||||
|
for param: TempoSyncableParam in tempoSyncableParams where param.node === node {
|
||||||
|
if case .division = tempoSync[param.key] ?? .free {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Subclass hook
|
// MARK: - Subclass hook
|
||||||
|
|
||||||
/// Returns the processed (wet) mono signal for this pedal.
|
/// Returns the processed (wet) mono signal for this pedal.
|
||||||
|
|||||||
@@ -181,6 +181,42 @@ struct MIDIControllerCCTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test func ccIsIgnoredWhileParameterIsTempoSynced() throws {
|
||||||
|
// A CC bound to a parameter that is locked to a note division must be ignored — the value is
|
||||||
|
// tempo-derived and a CC write would be overwritten on the next tempo change. The binding
|
||||||
|
// stays intact and resumes control once the parameter is set back to Free.
|
||||||
|
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.05, numAudioBuses: 128)
|
||||||
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
let sg: ShoeGaze = ShoeGaze(engine: engine)
|
||||||
|
sg.clock.bpm = 120.0
|
||||||
|
let board: PedalBoard = try sg.addBoard()
|
||||||
|
let delay: DelayPedal = DelayPedal()
|
||||||
|
try board.add(delay)
|
||||||
|
try sg.finalizeBoard(board)
|
||||||
|
let controller: MIDIController = MIDIController(engine: engine, shoeGaze: sg)
|
||||||
|
|
||||||
|
withExtendedLifetime(sg) {
|
||||||
|
// Bind CC 21 to Time (control 0 on a Delay pedal).
|
||||||
|
controller.armCCLearn(pedalControl(delay.id, 0))
|
||||||
|
controller.ingestForTesting(.controlChange(channel: 0, controller: 21, value: 0))
|
||||||
|
|
||||||
|
// Lock Time to a quarter note — 0.5 s at 120 BPM.
|
||||||
|
delay.setSync(.division(.quarter), for: "time")
|
||||||
|
let syncedValue: Double = delay.$time.value
|
||||||
|
#expect(abs(syncedValue - 0.5) < 1e-9)
|
||||||
|
|
||||||
|
// A CC while synced must not move the value.
|
||||||
|
controller.ingestForTesting(.controlChange(channel: 0, controller: 21, value: 127))
|
||||||
|
#expect(abs(delay.$time.value - syncedValue) < 1e-9, "CC must not drive a tempo-synced parameter")
|
||||||
|
|
||||||
|
// Back to Free — the same binding drives the control again.
|
||||||
|
delay.setSync(.free, for: "time")
|
||||||
|
let timeMax: Double = delay.ccMappableControls[0].range.upperBound
|
||||||
|
controller.ingestForTesting(.controlChange(channel: 0, controller: 21, value: 127))
|
||||||
|
#expect(abs(delay.$time.value - timeMax) < 1e-9, "CC resumes control once the parameter is Free")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test func unboundCCIsIgnored() throws {
|
@Test func unboundCCIsIgnored() throws {
|
||||||
let (controller, sg, board, url): (MIDIController, ShoeGaze, PedalBoard, URL) = try makeRig()
|
let (controller, sg, board, url): (MIDIController, ShoeGaze, PedalBoard, URL) = try makeRig()
|
||||||
defer { try? FileManager.default.removeItem(at: url) }
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
|||||||
@@ -181,15 +181,17 @@ For each param that appears in `tempoSyncableParams`:
|
|||||||
- Gate the whole affordance on the `shoeGazeTempoEnabled` environment flag — when tempo is
|
- Gate the whole affordance on the `shoeGazeTempoEnabled` environment flag — when tempo is
|
||||||
off, only the plain knob shows.
|
off, only the plain knob shows.
|
||||||
|
|
||||||
### MIDI — deferred
|
### MIDI — implemented (inert while synced)
|
||||||
|
|
||||||
A synced param's value is derived, so a CC bound to it is overwritten on the next tempo/division
|
A synced param's value is derived, so a CC bound to it would be overwritten on the next
|
||||||
change. The obvious fix — dropping `.division`-synced params from `ccMappableControls` — is
|
tempo/division change. Rather than drop `.division`-synced params from `ccMappableControls` —
|
||||||
**deferred**: that list is addressed by a *stable index* (persisted CC bindings resolve by position),
|
which is addressed by a *stable index* (persisted CC bindings resolve by position), so filtering it
|
||||||
so filtering it live would shift indices and silently re-point or break existing bindings. A correct
|
live would shift indices and break existing bindings — the exclusion is **index-stable**: the slot
|
||||||
implementation needs an index-stable exclusion (e.g. keep the slot but mark it inert while synced),
|
stays, and the CC *write* is skipped while the target parameter is division-synced.
|
||||||
which is out of scope for this change. Until then, binding a CC to a synced param is allowed but the
|
`MIDIController.applyCC` checks `Pedal.isNodeTempoSynced(_:)` (node-identity match against
|
||||||
tempo wins — documented here as a known limitation, not an oversight.
|
`tempoSyncableParams`) and ignores the incoming CC for a synced control; the binding stays intact and
|
||||||
|
resumes control the moment the parameter is set back to Free. Learning/binding a CC to a synced
|
||||||
|
param is still allowed — the tempo simply wins while synced.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user