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 {
|
||||
|
||||
@@ -198,7 +198,7 @@ public struct PedalPaletteView: View {
|
||||
HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) {
|
||||
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
||||
sectionTitle("PEDALS")
|
||||
filterMenu
|
||||
if showsFilterMenu { filterMenu }
|
||||
}
|
||||
ForEach(groupedVisiblePedals, id: \.category) { group in
|
||||
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
||||
|
||||
@@ -162,11 +162,6 @@ public struct ShoeGazeBuilderView: View {
|
||||
/// Help sheet presentation flag (iOS button; macOS uses the Help menu).
|
||||
@State private var showHelpSheet: Bool = false
|
||||
|
||||
/// Compact-layout size class. `.compact` width (iPhone, iPad portrait / split view) switches to
|
||||
/// the canvas-first layout where composition panels live in sheets; `.regular` keeps the docked
|
||||
/// desktop-style layout. `nil` (unknown) is treated as regular.
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass: UserInterfaceSizeClass?
|
||||
|
||||
/// Compact-layout sheet flags — the composition panels docked in the regular layout become
|
||||
/// bottom sheets so the board canvas gets the full screen.
|
||||
@State private var showRigsSheet: Bool = false
|
||||
@@ -233,16 +228,6 @@ public struct ShoeGazeBuilderView: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
/// `true` on the smaller iPads / split-view widths, where even the canvas-first docked strip
|
||||
/// (mixer + scope + Tempo/Tuner) is tight and more can move into sheets. Reserved for
|
||||
/// size-specific tuning; `.regular` is a full-screen iPad.
|
||||
private var isNarrow: Bool {
|
||||
#if os(iOS)
|
||||
return horizontalSizeClass == .compact
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
rootContent
|
||||
|
||||
Reference in New Issue
Block a user