Address external review: transport-only Start must not revert Settings config
Review found a blocking bug: the compact header's transportOnly EngineConfigView and the Settings-sheet EngineConfigView each own independent @State pending config. reconfigureEngine mutates the engine in place, so the header instance's .task(id: engine identity) never re-syncs — pressing Start there re-applied its stale pending values, reverting rate/channel edits made in Settings. In transportOnly mode, skip the reconfigure and just start the already-configured engine. Also: remove the unused isNarrow / horizontalSizeClass (dead code), and honor showsFilterMenu in PedalPaletteView.horizontalBody (was only gated in vertical). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -178,14 +178,20 @@ public struct EngineConfigView: View {
|
||||
|
||||
private func startEngine() {
|
||||
do {
|
||||
if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig {
|
||||
try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs)
|
||||
} else {
|
||||
try shoeGaze.reconfigureEngine(
|
||||
sampleRate: pendingSampleRate,
|
||||
inputChannels: pendingInputs,
|
||||
outputChannels: pendingOutputs
|
||||
)
|
||||
// Transport-only mode does not own the config controls — the engine is already
|
||||
// configured (via the full instance's live apply, or the init defaults). Re-applying
|
||||
// this instance's cached pending state here would revert edits made in the Settings
|
||||
// sheet, so skip the reconfigure and just start.
|
||||
if !transportOnly {
|
||||
if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig {
|
||||
try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs)
|
||||
} else {
|
||||
try shoeGaze.reconfigureEngine(
|
||||
sampleRate: pendingSampleRate,
|
||||
inputChannels: pendingInputs,
|
||||
outputChannels: pendingOutputs
|
||||
)
|
||||
}
|
||||
}
|
||||
try shoeGaze.engine.start()
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user