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() {
|
private func startEngine() {
|
||||||
do {
|
do {
|
||||||
if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig {
|
// Transport-only mode does not own the config controls — the engine is already
|
||||||
try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs)
|
// configured (via the full instance's live apply, or the init defaults). Re-applying
|
||||||
} else {
|
// this instance's cached pending state here would revert edits made in the Settings
|
||||||
try shoeGaze.reconfigureEngine(
|
// sheet, so skip the reconfigure and just start.
|
||||||
sampleRate: pendingSampleRate,
|
if !transportOnly {
|
||||||
inputChannels: pendingInputs,
|
if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig {
|
||||||
outputChannels: pendingOutputs
|
try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs)
|
||||||
)
|
} else {
|
||||||
|
try shoeGaze.reconfigureEngine(
|
||||||
|
sampleRate: pendingSampleRate,
|
||||||
|
inputChannels: pendingInputs,
|
||||||
|
outputChannels: pendingOutputs
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try shoeGaze.engine.start()
|
try shoeGaze.engine.start()
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public struct PedalPaletteView: View {
|
|||||||
HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) {
|
HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) {
|
||||||
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
||||||
sectionTitle("PEDALS")
|
sectionTitle("PEDALS")
|
||||||
filterMenu
|
if showsFilterMenu { filterMenu }
|
||||||
}
|
}
|
||||||
ForEach(groupedVisiblePedals, id: \.category) { group in
|
ForEach(groupedVisiblePedals, id: \.category) { group in
|
||||||
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
|
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).
|
/// Help sheet presentation flag (iOS button; macOS uses the Help menu).
|
||||||
@State private var showHelpSheet: Bool = false
|
@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
|
/// Compact-layout sheet flags — the composition panels docked in the regular layout become
|
||||||
/// bottom sheets so the board canvas gets the full screen.
|
/// bottom sheets so the board canvas gets the full screen.
|
||||||
@State private var showRigsSheet: Bool = false
|
@State private var showRigsSheet: Bool = false
|
||||||
@@ -233,16 +228,6 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
#endif
|
#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 {
|
public var body: some View {
|
||||||
rootContent
|
rootContent
|
||||||
|
|||||||
Reference in New Issue
Block a user