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:
@@ -250,6 +250,14 @@ public final class MIDIController {
|
||||
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
|
||||
+ norm * (resolved.range.upperBound - resolved.range.lowerBound)
|
||||
resolved.node.update(mapped)
|
||||
|
||||
@@ -316,6 +316,20 @@ open class Pedal: SynthesizerBase {
|
||||
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
|
||||
|
||||
/// Returns the processed (wet) mono signal for this pedal.
|
||||
|
||||
Reference in New Issue
Block a user