Review nits: name pulse-settle constant, fix stale comments
Non-blocking cleanups from the clean review pass: - EngineConfigView.startEngine: collapse the redundant early-return in the sample-rate-mismatch branch into the shared tail. - InputMuteButton: hoist the 0.2s settle duration to a named pulseSettleDuration. - InputMuteTests: correct a stale "input defaults muted" comment (library default is audible; the test mutes explicitly). - Plan doc: setInputMuted(true) runs before engine.start(), not after; note the addBoard priming. 464 tests pass; macOS app builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -213,9 +213,6 @@ public struct EngineConfigView: View {
|
||||
abs(hardware - shoeGaze.engine.sampleRate) > EngineConfigView.rateEpsilon {
|
||||
shoeGaze.engine.stop()
|
||||
presentMismatch(requested: shoeGaze.engine.sampleRate, hardware: hardware)
|
||||
transportTick.toggle()
|
||||
onConfigApplied()
|
||||
return
|
||||
}
|
||||
transportTick.toggle()
|
||||
onConfigApplied()
|
||||
|
||||
@@ -1232,6 +1232,7 @@ public struct ShoeGazeBuilderView: View {
|
||||
private static let glowOpacityLow: Double = 0.35
|
||||
private static let glowOpacityHigh: Double = 0.95
|
||||
private static let pulseDuration: Double = 0.85
|
||||
private static let pulseSettleDuration: Double = 0.2
|
||||
|
||||
var body: some View {
|
||||
let muted: Bool = shoeGaze.inputMuted
|
||||
@@ -1271,7 +1272,7 @@ public struct ShoeGazeBuilderView: View {
|
||||
pulse = true
|
||||
}
|
||||
} else {
|
||||
withAnimation(.easeOut(duration: 0.2)) { pulse = false }
|
||||
withAnimation(.easeOut(duration: InputMuteButton.pulseSettleDuration)) { pulse = false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,13 +92,13 @@ struct InputMuteTests {
|
||||
@Test func mutedInputRendersSilent() throws {
|
||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.25, numAudioBuses: 256)
|
||||
defer { try? FileManager.default.removeItem(at: url) }
|
||||
let sg: ShoeGaze = ShoeGaze(engine: engine) // input defaults muted
|
||||
let sg: ShoeGaze = ShoeGaze(engine: engine)
|
||||
|
||||
try withExtendedLifetime(sg) {
|
||||
let board: PedalBoard = try sg.addBoard()
|
||||
try board.add(VolumePedal())
|
||||
try sg.finalizeBoard(board)
|
||||
sg.setInputMuted(true)
|
||||
sg.setInputMuted(true) // mute explicitly before Start (library default is audible)
|
||||
|
||||
try engine.start()
|
||||
let samples: [Float] = readStereoCAF(url: url)
|
||||
|
||||
@@ -32,9 +32,13 @@ moment the mute is meant to keep things quiet; a kill-switch mute is expected to
|
||||
|
||||
### Engine start
|
||||
|
||||
`EngineConfigView.startEngine()` calls `shoeGaze.setInputMuted(true)` after a successful
|
||||
user Start. Transient stop/start-around-rebuild paths (`applyInputSource`, `performClear`)
|
||||
call `engine.start()` directly and are unaffected — they preserve the current mute state.
|
||||
`EngineConfigView.startEngine()` calls `shoeGaze.setInputMuted(true)` **before**
|
||||
`engine.start()`, while the engine is stopped — so the gain is seeded (`previousOutputValue`
|
||||
primed to the target, no ramp) and the very first render block is already muted. Asserting it
|
||||
after start would leave the opening blocks unmuted. Transient stop/start-around-rebuild paths
|
||||
(`applyInputSource`, `performClear`) call `engine.start()` directly and are unaffected — they
|
||||
preserve the current mute state. Nodes are also primed at creation in `addBoard()` (before the
|
||||
node is spliced into the graph), so a board added while muted has no first-block leak either.
|
||||
|
||||
### MIDI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user