Looper: MIDI-mappable transport; clean-through + Playback balance
MIDI: add looperStop / looperCueStop / looperReverse PedalActionKind cases and dispatch them (stopPlayback / toggleStopAtLoopEnd / toggleReverse). The MIDI mapping sheet now lists Record / Stop / Cue Stop / Reverse / Reset as Program-Change-mappable switch actions for each looper pedal (previously only Bypass was surfaced). Mix: the clean guitar now always passes through at full level and the loop bank is summed on top (dry + loop·gate) instead of crossfading dry against the loop. The Playback knob therefore sets the looped-vs-live balance. Hide the confusing wet/dry Mix knob for the looper via a new Pedal.showsMixControl (mix stays fully wet); other pedals are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -395,6 +395,12 @@ public final class MIDIController {
|
||||
node.update(node.value < toggleThreshold ? 1.0 : 0.0)
|
||||
case .looperReset:
|
||||
(pedal as? LooperPedal)?.resetLoop()
|
||||
case .looperStop:
|
||||
(pedal as? LooperPedal)?.stopPlayback()
|
||||
case .looperCueStop:
|
||||
(pedal as? LooperPedal)?.toggleStopAtLoopEnd()
|
||||
case .looperReverse:
|
||||
(pedal as? LooperPedal)?.toggleReverse()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,12 @@ public struct MIDIMap: Codable, Equatable, Sendable {
|
||||
case looperLoopToggle
|
||||
/// Looper: reset — clears all tracks and returns to the clear state.
|
||||
case looperReset
|
||||
/// Looper: immediately stops playback (`LooperPedal.stopPlayback()`).
|
||||
case looperStop
|
||||
/// Looper: arms / cancels a stop at the loop end (`LooperPedal.toggleStopAtLoopEnd()`).
|
||||
case looperCueStop
|
||||
/// Looper: flips playback direction (`LooperPedal.toggleReverse()`).
|
||||
case looperReverse
|
||||
}
|
||||
|
||||
// MARK: - Switch binding
|
||||
|
||||
@@ -107,6 +107,12 @@ open class Pedal: SynthesizerBase {
|
||||
/// Override in a widener or stereo-native subclass.
|
||||
open var channelKind: PedalChannelKind { .mono }
|
||||
|
||||
/// Whether the UI shows the common wet/dry `Mix` control for this pedal. Defaults to `true`.
|
||||
/// A pedal that manages its own dry/wet balance internally (e.g. the looper, where the clean
|
||||
/// signal always passes through) overrides this to `false` so the confusing Mix knob is hidden
|
||||
/// and `mix` stays at its fully-wet default.
|
||||
open var showsMixControl: Bool { true }
|
||||
|
||||
/// Called on the main thread when the audio engine is stopped by the user (via
|
||||
/// `ShoeGaze.stopEngine()`), not during a transient stop-around-rebuild. Stateful pedals
|
||||
/// (e.g. the looper) override this to return to a clean state. Default: no-op.
|
||||
|
||||
@@ -43,6 +43,10 @@ public final class LooperPedal: Pedal {
|
||||
/// Double-width card: the looper carries a full transport plus a track strip and timeline.
|
||||
public override var widthUnits: Int { 2 }
|
||||
|
||||
/// The looper always passes the clean signal through and adds the loop on top (see `effect`),
|
||||
/// so the wet/dry Mix knob is meaningless — hide it and keep `mix` fully wet.
|
||||
public override var showsMixControl: Bool { false }
|
||||
|
||||
// MARK: - Knobs
|
||||
|
||||
/// Fade time constant, in seconds, for the loop on/off mute and the record→play handoff.
|
||||
@@ -353,15 +357,18 @@ public final class LooperPedal: Pedal {
|
||||
// Loop bank audible only while playing and not muted; smoothed to avoid clicks.
|
||||
let combinedGate: any ValidGeneratorInput = $isPlaying * $loopOn
|
||||
let smoothedGate: Lag.Control = Lag.Control(input: combinedGate, time: $crossfadeTime)
|
||||
let dryGate: any ValidGeneratorInput = unity - smoothedGate
|
||||
|
||||
// Sum all track players. Empty buffers contribute silence.
|
||||
// Sum all track players. Empty buffers contribute silence. Each player is already
|
||||
// scaled by the `Playback` level, so `Playback` sets the loop amount against the live
|
||||
// signal below.
|
||||
var loopSum: any ValidGeneratorInput = players[0]
|
||||
for i: Int in 1 ..< players.count {
|
||||
loopSum = loopSum + players[i]
|
||||
}
|
||||
|
||||
return (dry * dryGate) + (loopSum * smoothedGate)
|
||||
// The clean (dry) signal always passes through at full level; the loop bank is added on
|
||||
// top, gated by play/mute. `Playback` controls the looped-vs-live balance.
|
||||
return dry + (loopSum * smoothedGate)
|
||||
}
|
||||
|
||||
// MARK: - Loop footswitch
|
||||
|
||||
Reference in New Issue
Block a user