Compare commits
12 Commits
cdac587454
...
dff58175f1
| Author | SHA1 | Date | |
|---|---|---|---|
| dff58175f1 | |||
| 42268b65a1 | |||
| 2c36de5c0d | |||
| f19dc2c1b3 | |||
| 6ad813601f | |||
| 652a5a76ca | |||
| 9b31be7921 | |||
| 705b4ed534 | |||
| 4627b3b800 | |||
| c25d783b71 | |||
| b4b2f58762 | |||
| c0605d295d |
@@ -175,7 +175,7 @@
|
|||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 6.0;
|
SWIFT_VERSION = 6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = 2;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 6.0;
|
SWIFT_VERSION = 6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = 2;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,16 +29,15 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>UILaunchScreen</key>
|
<key>UILaunchScreen</key>
|
||||||
<dict/>
|
<dict/>
|
||||||
|
<key>UIRequiresFullScreen</key>
|
||||||
|
<true/>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ struct ShoeGazeBuilderiOSApp: App {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
ShoeGazeBuilderView(
|
ShoeGazeBuilderView(
|
||||||
shoeGaze: model.shoeGaze,
|
shoeGaze: model.shoeGaze,
|
||||||
hardwareSampleRate: { model.hardwareSampleRate }
|
hardwareSampleRate: { model.hardwareSampleRate },
|
||||||
|
onEnableLiveInput: { model.enableLiveInput() }
|
||||||
)
|
)
|
||||||
.navigationTitle("ShoeGaze Builder")
|
.navigationTitle("ShoeGaze Builder")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
|||||||
@@ -24,16 +24,29 @@ final class ShoeGazeBuilderiOSAppModel {
|
|||||||
|
|
||||||
private static let blockSize: Int = 512
|
private static let blockSize: Int = 512
|
||||||
private static let outputChannels: Int = 2
|
private static let outputChannels: Int = 2
|
||||||
|
// Default to one input channel so live input is available immediately. The trade-off is
|
||||||
|
// that the iOS driver runs a `.playAndRecord` session with the RemoteIO input element
|
||||||
|
// enabled, so iOS prompts for microphone access at the first Start even while the input
|
||||||
|
// still defaults to `.testLoop`. (The permission-gated `enableLiveInput()` rebuild remains
|
||||||
|
// available for any future build that starts input-less.)
|
||||||
|
private static let inputChannels: Int = 1
|
||||||
private static let numAudioBuses: Int = 256
|
private static let numAudioBuses: Int = 256
|
||||||
private static let seedPedalType: String = "Overdrive"
|
private static let seedPedalType: String = "Overdrive"
|
||||||
|
|
||||||
|
/// UserDefaults key persisting the input selection. Must match the key written by the
|
||||||
|
/// builder view (`ShoeGazeBuilderView.inputSelectionDefaultsKey`).
|
||||||
|
private static let inputSelectionDefaultsKey: String = "ShoeGaze.inputSelection"
|
||||||
|
/// Persisted value meaning "live input, channel 0".
|
||||||
|
private static let liveInputChannelZeroTag: Int = 0
|
||||||
|
|
||||||
// MARK: - Owned objects
|
// MARK: - Owned objects
|
||||||
|
|
||||||
/// The active ShoeGaze builder session.
|
/// The active ShoeGaze builder session. Swapped out when live input is enabled (the engine
|
||||||
|
/// is rebuilt with an input channel); the `@Observable` change re-binds the hosting view.
|
||||||
private(set) var shoeGaze: ShoeGaze
|
private(set) var shoeGaze: ShoeGaze
|
||||||
|
|
||||||
private let engine: SynthesisEngine
|
private var engine: SynthesisEngine
|
||||||
private let iosDriver: iOSAudioDriver
|
private var iosDriver: iOSAudioDriver
|
||||||
|
|
||||||
/// The sample rate the audio session actually committed to (for the config mismatch warning).
|
/// The sample rate the audio session actually committed to (for the config mismatch warning).
|
||||||
var hardwareSampleRate: Double? { iosDriver.sessionSampleRate }
|
var hardwareSampleRate: Double? { iosDriver.sessionSampleRate }
|
||||||
@@ -41,31 +54,12 @@ final class ShoeGazeBuilderiOSAppModel {
|
|||||||
// MARK: - Init
|
// MARK: - Init
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let session: AVAudioSession = AVAudioSession.sharedInstance()
|
ShoeGazeBuilderiOSAppModel.configureAudioSession()
|
||||||
do {
|
let built: (engine: SynthesisEngine, driver: iOSAudioDriver, shoeGaze: ShoeGaze) =
|
||||||
try session.setCategory(.playAndRecord,
|
ShoeGazeBuilderiOSAppModel.buildEngine(inputChannels: ShoeGazeBuilderiOSAppModel.inputChannels)
|
||||||
mode: .default,
|
self.engine = built.engine
|
||||||
options: [.defaultToSpeaker, .allowBluetoothHFP])
|
self.iosDriver = built.driver
|
||||||
try session.setActive(true)
|
self.shoeGaze = built.shoeGaze
|
||||||
} catch {
|
|
||||||
// Surface the failure: the engine is built from `session.sampleRate` below, which may
|
|
||||||
// report a stale/default rate if activation failed.
|
|
||||||
print("[ShoeGazeBuilderiOS] AVAudioSession setup failed: \(error)")
|
|
||||||
}
|
|
||||||
let sampleRate: Double = session.sampleRate
|
|
||||||
|
|
||||||
let driver: iOSAudioDriver = iOSAudioDriver()
|
|
||||||
let eng: SynthesisEngine = SynthesisEngine(
|
|
||||||
blockSize: ShoeGazeBuilderiOSAppModel.blockSize,
|
|
||||||
sampleRate: sampleRate,
|
|
||||||
numOutputChannels: ShoeGazeBuilderiOSAppModel.outputChannels,
|
|
||||||
numInputChannels: 0,
|
|
||||||
numAudioBuses: ShoeGazeBuilderiOSAppModel.numAudioBuses,
|
|
||||||
driver: driver
|
|
||||||
)
|
|
||||||
self.iosDriver = driver
|
|
||||||
self.engine = eng
|
|
||||||
self.shoeGaze = ShoeGaze(engine: eng)
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let board: PedalBoard = try shoeGaze.addBoard()
|
let board: PedalBoard = try shoeGaze.addBoard()
|
||||||
@@ -76,6 +70,124 @@ final class ShoeGazeBuilderiOSAppModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Audio session / engine construction
|
||||||
|
|
||||||
|
/// Activates the play-and-record audio session once. Idempotent; safe to call before each
|
||||||
|
/// engine build. Activating the session does not by itself prompt for microphone access —
|
||||||
|
/// the prompt only fires when an input-enabled engine first starts.
|
||||||
|
private static func configureAudioSession() {
|
||||||
|
let session: AVAudioSession = AVAudioSession.sharedInstance()
|
||||||
|
do {
|
||||||
|
try session.setCategory(.playAndRecord,
|
||||||
|
mode: .default,
|
||||||
|
options: [.defaultToSpeaker, .allowBluetoothHFP])
|
||||||
|
try session.setActive(true)
|
||||||
|
} catch {
|
||||||
|
print("[ShoeGazeBuilderiOS] AVAudioSession setup failed: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Builds a fresh engine + driver + empty `ShoeGaze` with the given input-channel count.
|
||||||
|
private static func buildEngine(
|
||||||
|
inputChannels: Int
|
||||||
|
) -> (engine: SynthesisEngine, driver: iOSAudioDriver, shoeGaze: ShoeGaze) {
|
||||||
|
let sampleRate: Double = AVAudioSession.sharedInstance().sampleRate
|
||||||
|
let driver: iOSAudioDriver = iOSAudioDriver()
|
||||||
|
let engine: SynthesisEngine = SynthesisEngine(
|
||||||
|
blockSize: ShoeGazeBuilderiOSAppModel.blockSize,
|
||||||
|
sampleRate: sampleRate,
|
||||||
|
numOutputChannels: ShoeGazeBuilderiOSAppModel.outputChannels,
|
||||||
|
numInputChannels: inputChannels,
|
||||||
|
numAudioBuses: ShoeGazeBuilderiOSAppModel.numAudioBuses,
|
||||||
|
driver: driver
|
||||||
|
)
|
||||||
|
return (engine, driver, ShoeGaze(engine: engine))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Live input
|
||||||
|
|
||||||
|
/// Enables live input on iOS: requests microphone access, then (on grant) rebuilds the
|
||||||
|
/// engine with one input channel — preserving the current rig — and selects live input.
|
||||||
|
///
|
||||||
|
/// The rebuild is required because the input-channel count is fixed at engine construction,
|
||||||
|
/// and constructing with an input channel up-front would make iOS prompt for the microphone
|
||||||
|
/// at the first Start even in test-loop mode. Gating the rebuild behind an explicit request
|
||||||
|
/// keeps the prompt where the user expects it.
|
||||||
|
func enableLiveInput() {
|
||||||
|
MicrophonePermission.request { [weak self] granted in
|
||||||
|
guard let self, granted else { return }
|
||||||
|
self.rebuildWithLiveInput()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Snapshots the rig, rebuilds the engine with one input channel, restores the rig, and
|
||||||
|
/// selects live input on channel 0. No-op if the engine already has an input channel.
|
||||||
|
private func rebuildWithLiveInput() {
|
||||||
|
guard engine.numInputChannels == 0 else {
|
||||||
|
// Engine already has an input channel: just select live input, no rebuild.
|
||||||
|
selectLiveInputAndPersist()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let wasRunning: Bool = engine.isRunning
|
||||||
|
|
||||||
|
// Snapshot the rig BEFORE any teardown. If this fails, abort the rebuild rather than
|
||||||
|
// tear the engine down and lose the rig — the user stays on the current engine.
|
||||||
|
let snapshot: Data
|
||||||
|
do {
|
||||||
|
snapshot = try shoeGaze.rigData()
|
||||||
|
} catch {
|
||||||
|
print("[ShoeGazeBuilderiOS] rig snapshot failed; aborting live-input rebuild: \(error)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.stop()
|
||||||
|
shoeGaze.teardown()
|
||||||
|
|
||||||
|
ShoeGazeBuilderiOSAppModel.configureAudioSession()
|
||||||
|
let rebuilt: (engine: SynthesisEngine, driver: iOSAudioDriver, shoeGaze: ShoeGaze) =
|
||||||
|
ShoeGazeBuilderiOSAppModel.buildEngine(inputChannels: 1)
|
||||||
|
self.engine = rebuilt.engine
|
||||||
|
self.iosDriver = rebuilt.driver
|
||||||
|
self.shoeGaze = rebuilt.shoeGaze
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Teardown already happened, so a restore failure can only recover by seeding.
|
||||||
|
try shoeGaze.loadRig(from: snapshot)
|
||||||
|
} catch {
|
||||||
|
print("[ShoeGazeBuilderiOS] rig restore after rebuild failed: \(error)")
|
||||||
|
seedFallbackBoard()
|
||||||
|
}
|
||||||
|
|
||||||
|
selectLiveInputAndPersist()
|
||||||
|
|
||||||
|
if wasRunning { try? engine.start() }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Selects live input on channel 0 and persists the choice for restore-on-relaunch.
|
||||||
|
private func selectLiveInputAndPersist() {
|
||||||
|
do {
|
||||||
|
try shoeGaze.setInputSource(.liveInput(channel: 0))
|
||||||
|
UserDefaults.standard.set(
|
||||||
|
ShoeGazeBuilderiOSAppModel.liveInputChannelZeroTag,
|
||||||
|
forKey: ShoeGazeBuilderiOSAppModel.inputSelectionDefaultsKey
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
print("[ShoeGazeBuilderiOS] selecting live input failed: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Seeds a single default board so the rig is never empty after a failed restore.
|
||||||
|
private func seedFallbackBoard() {
|
||||||
|
do {
|
||||||
|
let board: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
board.label = "Board 1"
|
||||||
|
try shoeGaze.appendPedal(type: ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||||
|
} catch {
|
||||||
|
print("[ShoeGazeBuilderiOS] fallback seed board failed: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Transport
|
// MARK: - Transport
|
||||||
|
|
||||||
/// Stops the audio engine. Call from `.onDisappear`.
|
/// Stops the audio engine. Call from `.onDisappear`.
|
||||||
|
|||||||
@@ -174,7 +174,7 @@
|
|||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 6.0;
|
SWIFT_VERSION = 6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = 2;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 6.0;
|
SWIFT_VERSION = 6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = 2;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,16 +29,15 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>UILaunchScreen</key>
|
<key>UILaunchScreen</key>
|
||||||
<dict/>
|
<dict/>
|
||||||
|
<key>UIRequiresFullScreen</key>
|
||||||
|
<true/>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public final class DelayPedal: Pedal {
|
|||||||
public override var effectKnobs: [PedalKnob] {
|
public override var effectKnobs: [PedalKnob] {
|
||||||
[
|
[
|
||||||
PedalKnob(label: "Time", node: $time, range: timeRange),
|
PedalKnob(label: "Time", node: $time, range: timeRange),
|
||||||
PedalKnob(label: "Feedback", node: $feedback, range: feedbackRange),
|
PedalKnob(label: "Decay Time", node: $feedback, range: feedbackRange),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public final class FeedbackDelayPedal: Pedal {
|
|||||||
public override var effectKnobs: [PedalKnob] {
|
public override var effectKnobs: [PedalKnob] {
|
||||||
[
|
[
|
||||||
PedalKnob(label: "Time", node: $time, range: timeRange),
|
PedalKnob(label: "Time", node: $time, range: timeRange),
|
||||||
PedalKnob(label: "Feedback", node: $feedback, range: feedbackRange),
|
PedalKnob(label: "Decay Time", node: $feedback, range: feedbackRange),
|
||||||
PedalKnob(label: "Tone", node: $tone, range: toneRange),
|
PedalKnob(label: "Tone", node: $tone, range: toneRange),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public final class PingPongDelayPedal: Pedal {
|
|||||||
public override var effectKnobs: [PedalKnob] {
|
public override var effectKnobs: [PedalKnob] {
|
||||||
[
|
[
|
||||||
PedalKnob(label: "Time", node: $time, range: timeRange),
|
PedalKnob(label: "Time", node: $time, range: timeRange),
|
||||||
PedalKnob(label: "Feedback", node: $feedback, range: feedbackRange),
|
PedalKnob(label: "Decay Time", node: $feedback, range: feedbackRange),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,6 +261,52 @@ public final class ShoeGaze {
|
|||||||
activeBoardIndex = nil
|
activeBoardIndex = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Solos `board` exclusively — identical to ``selectBoard(_:crossfadeSeconds:)``.
|
||||||
|
///
|
||||||
|
/// Provided as the "Solo" verb alongside ``setBoard(_:audible:crossfadeSeconds:)`` so
|
||||||
|
/// callers can express *make only this board audible* without conflating it with the
|
||||||
|
/// independent per-board enable used by Blend-style mixing.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - board: The board to solo. No-op if not managed by this instance.
|
||||||
|
/// - crossfadeSeconds: Crossfade duration in seconds (`0` = instant).
|
||||||
|
public func soloBoard(_ board: PedalBoard, crossfadeSeconds: Double) {
|
||||||
|
selectBoard(board, crossfadeSeconds: crossfadeSeconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets a single board audible or silent **without** disturbing the others.
|
||||||
|
///
|
||||||
|
/// Unlike ``selectBoard(_:crossfadeSeconds:)`` (which is exclusive), this toggles one
|
||||||
|
/// board's select-gain in place, so arbitrary subsets of boards can play at once — the
|
||||||
|
/// "Blend" mixing model. Because the audible set is no longer a single soloed board,
|
||||||
|
/// ``activeBoardIndex`` is cleared to `nil`.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - board: The board to enable or silence. No-op if not managed by this instance.
|
||||||
|
/// - audible: `true` to fade the board in, `false` to fade it out.
|
||||||
|
/// - crossfadeSeconds: Crossfade duration in seconds (`0` = instant).
|
||||||
|
public func setBoard(_ board: PedalBoard, audible: Bool, crossfadeSeconds: Double) {
|
||||||
|
guard boards.contains(where: { $0 === board }) else { return }
|
||||||
|
board.crossfadeTimeNode?.update(crossfadeSeconds)
|
||||||
|
board.selectGainNode?.update(audible ? 1.0 : 0.0)
|
||||||
|
activeBoardIndex = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether `board`'s output is currently audible (its select-gain target is on).
|
||||||
|
///
|
||||||
|
/// Reads the live select-gain target, so it reflects the latest
|
||||||
|
/// ``selectBoard(_:crossfadeSeconds:)`` / ``setBoard(_:audible:crossfadeSeconds:)`` /
|
||||||
|
/// ``selectAllBoards(crossfadeSeconds:)`` call (the value the crossfade is ramping
|
||||||
|
/// toward), independent of where the crossfade currently sits.
|
||||||
|
///
|
||||||
|
/// - Parameter board: A board managed by this instance.
|
||||||
|
/// - Returns: `true` when the board's select-gain target is on; `false` when silenced
|
||||||
|
/// or when the board has no output master yet.
|
||||||
|
public func isBoardAudible(_ board: PedalBoard) -> Bool {
|
||||||
|
let selectGainOnThreshold: Double = 0.5
|
||||||
|
return (board.selectGainNode?.value ?? 0.0) > selectGainOnThreshold
|
||||||
|
}
|
||||||
|
|
||||||
/// Removes a single board and its associated input source and output master from
|
/// Removes a single board and its associated input source and output master from
|
||||||
/// the engine, then releases the board's buses. The other boards are unaffected.
|
/// the engine, then releases the board's buses. The other boards are unaffected.
|
||||||
///
|
///
|
||||||
@@ -299,6 +345,16 @@ public final class ShoeGaze {
|
|||||||
// Remove the pedals and release the board's buses.
|
// Remove the pedals and release the board's buses.
|
||||||
board.teardown()
|
board.teardown()
|
||||||
boards.remove(at: index)
|
boards.remove(at: index)
|
||||||
|
|
||||||
|
// Keep the soloed-board index valid: clear it if the soloed board was removed,
|
||||||
|
// otherwise shift it down when a board before it was removed.
|
||||||
|
if let active: Int = activeBoardIndex {
|
||||||
|
if active == index {
|
||||||
|
activeBoardIndex = nil
|
||||||
|
} else if active > index {
|
||||||
|
activeBoardIndex = active - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Chain router
|
// MARK: - Chain router
|
||||||
@@ -339,18 +395,26 @@ public final class ShoeGaze {
|
|||||||
/// Moves `board` to `targetIndex` within `boards`, locating it by identity.
|
/// Moves `board` to `targetIndex` within `boards`, locating it by identity.
|
||||||
///
|
///
|
||||||
/// This is an internal helper that mutates `boards` directly — valid only because
|
/// This is an internal helper that mutates `boards` directly — valid only because
|
||||||
/// `ShoeGaze` is `@MainActor` (no concurrent access). The method is `internal` rather than
|
/// `ShoeGaze` is `@MainActor` (no concurrent access). Reordering only permutes the
|
||||||
/// `public` so callers outside the ShoeGaze module cannot disrupt board ordering.
|
/// `boards` array; it does not touch the engine graph, so it is safe to call while the
|
||||||
|
/// engine is running.
|
||||||
///
|
///
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - board: The `PedalBoard` to reposition. No-op if not found in `boards`.
|
/// - board: The `PedalBoard` to reposition. No-op if not found in `boards`.
|
||||||
/// - index: The desired destination index. Clamped to `boards.count` after removal
|
/// - index: The desired destination index. Clamped to `boards.count` after removal
|
||||||
/// so it is always a valid insertion point.
|
/// so it is always a valid insertion point.
|
||||||
internal func moveBoard(_ board: PedalBoard, to index: Int) {
|
public func moveBoard(_ board: PedalBoard, to index: Int) {
|
||||||
guard let sourceIndex: Int = boards.firstIndex(where: { $0 === board }) else { return }
|
guard let sourceIndex: Int = boards.firstIndex(where: { $0 === board }) else { return }
|
||||||
|
// Track the soloed board by identity so its index follows the reorder.
|
||||||
|
let soloedBoard: PedalBoard? = activeBoardIndex.flatMap { idx in
|
||||||
|
idx < boards.count ? boards[idx] : nil
|
||||||
|
}
|
||||||
let removed: PedalBoard = boards.remove(at: sourceIndex)
|
let removed: PedalBoard = boards.remove(at: sourceIndex)
|
||||||
let destination: Int = min(index, boards.count)
|
let destination: Int = min(index, boards.count)
|
||||||
boards.insert(removed, at: destination)
|
boards.insert(removed, at: destination)
|
||||||
|
if let soloedBoard {
|
||||||
|
activeBoardIndex = boards.firstIndex(where: { $0 === soloedBoard })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Teardown
|
// MARK: - Teardown
|
||||||
|
|||||||
@@ -0,0 +1,310 @@
|
|||||||
|
// BoardBarView.swift
|
||||||
|
// Lyrebird
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import LyrebirdUI
|
||||||
|
import LyrebirdShoeGaze
|
||||||
|
|
||||||
|
/// A horizontal board-mixer strip for switching between, or blending, multiple `PedalBoard`s.
|
||||||
|
///
|
||||||
|
/// Each board is a channel cell with an audible LED, a Solo button, and a level fader (the
|
||||||
|
/// board's master gain). A leading **Solo / Blend** mode switch chooses the interaction:
|
||||||
|
///
|
||||||
|
/// - **Solo** — tapping a cell's LED makes that board the only audible one
|
||||||
|
/// (``ShoeGaze/soloBoard(_:crossfadeSeconds:)``); the **All** button returns to the
|
||||||
|
/// summed state (``ShoeGaze/selectAllBoards(crossfadeSeconds:)``). Amp-channel feel.
|
||||||
|
/// - **Blend** — tapping a cell's LED toggles that board in or out of the mix
|
||||||
|
/// independently (``ShoeGaze/setBoard(_:audible:crossfadeSeconds:)``), so any subset can
|
||||||
|
/// play at once — the default summed behaviour, now controllable per board.
|
||||||
|
///
|
||||||
|
/// Tapping a cell's **name** selects it as the edit target (`editingBoardIndex`), which is
|
||||||
|
/// independent of what is audible — you can audition one board while editing another. A
|
||||||
|
/// cell's context menu deletes the board.
|
||||||
|
///
|
||||||
|
/// The same view serves macOS and iOS; on iOS the cell row scrolls horizontally and the
|
||||||
|
/// context-menu delete is reached by long-press.
|
||||||
|
public struct BoardBarView: View {
|
||||||
|
|
||||||
|
// MARK: - Play mode
|
||||||
|
|
||||||
|
/// How a cell's LED tap maps to board audibility.
|
||||||
|
private enum PlayMode: Hashable {
|
||||||
|
/// Tapping a board solos it exclusively.
|
||||||
|
case solo
|
||||||
|
/// Tapping a board toggles it independently in/out of the mix.
|
||||||
|
case blend
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Layout constants
|
||||||
|
|
||||||
|
private static let barSpacing: CGFloat = 10
|
||||||
|
private static let barHeight: CGFloat = 92
|
||||||
|
private static let cellSpacing: CGFloat = 8
|
||||||
|
private static let cellWidth: CGFloat = 104
|
||||||
|
private static let cellInnerSpacing: CGFloat = 5
|
||||||
|
private static let cellPadding: CGFloat = 7
|
||||||
|
private static let cellCornerRadius: CGFloat = 8
|
||||||
|
private static let controlColumnWidth: CGFloat = 188
|
||||||
|
private static let modePickerWidth: CGFloat = 104
|
||||||
|
private static let crossfadeSliderMinWidth: CGFloat = 64
|
||||||
|
private static let ledDiameter: CGFloat = 12
|
||||||
|
private static let ledGlowRadius: CGFloat = 6
|
||||||
|
private static let ledGlowOpacity: Double = 0.75
|
||||||
|
private static let ledDimBrightness: Double = 0.16
|
||||||
|
private static let ledRimOpacity: Double = 0.30
|
||||||
|
private static let soloButtonSize: CGFloat = 22
|
||||||
|
private static let editingBorderWidth: CGFloat = 2
|
||||||
|
private static let idleBorderOpacity: Double = 0.18
|
||||||
|
private static let cellBackgroundBrightness: Double = 0.14
|
||||||
|
private static let labelOpacity: Double = 0.65
|
||||||
|
private static let nameFontSize: CGFloat = 12
|
||||||
|
private static let maxCrossfadeSeconds: Double = 10.0
|
||||||
|
private static let crossfadeStep: Double = 0.1
|
||||||
|
private static let addButtonSize: CGFloat = 30
|
||||||
|
|
||||||
|
// MARK: - Properties
|
||||||
|
|
||||||
|
private let shoeGaze: ShoeGaze
|
||||||
|
@Binding private var editingBoardIndex: Int
|
||||||
|
@Binding private var crossfadeSeconds: Double
|
||||||
|
private let onAddBoard: () -> Void
|
||||||
|
|
||||||
|
@State private var mode: PlayMode = .solo
|
||||||
|
|
||||||
|
// MARK: - Init
|
||||||
|
|
||||||
|
/// Creates a board-mixer bar.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - shoeGaze: The manager whose `boards` are switched / blended.
|
||||||
|
/// - editingBoardIndex: The index of the board currently being edited (a cell's name
|
||||||
|
/// tap writes this).
|
||||||
|
/// - crossfadeSeconds: Crossfade duration applied to every board switch / toggle.
|
||||||
|
/// - onAddBoard: Called when the trailing **+** button is tapped.
|
||||||
|
public init(
|
||||||
|
shoeGaze: ShoeGaze,
|
||||||
|
editingBoardIndex: Binding<Int>,
|
||||||
|
crossfadeSeconds: Binding<Double>,
|
||||||
|
onAddBoard: @escaping () -> Void
|
||||||
|
) {
|
||||||
|
self.shoeGaze = shoeGaze
|
||||||
|
self._editingBoardIndex = editingBoardIndex
|
||||||
|
self._crossfadeSeconds = crossfadeSeconds
|
||||||
|
self.onAddBoard = onAddBoard
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Body
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
// One horizontal scroll group so the whole bar hugs its content and stays a short,
|
||||||
|
// fixed-height band — leaving the canvas below for the pedals.
|
||||||
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
|
HStack(alignment: .center, spacing: BoardBarView.barSpacing) {
|
||||||
|
controlColumn
|
||||||
|
Divider().overlay(Color.white.opacity(BoardBarView.idleBorderOpacity))
|
||||||
|
ForEach(Array(shoeGaze.boards.enumerated()), id: \.offset) { pair in
|
||||||
|
boardCell(index: pair.offset, board: pair.element)
|
||||||
|
}
|
||||||
|
addButton
|
||||||
|
}
|
||||||
|
.frame(height: BoardBarView.barHeight)
|
||||||
|
}
|
||||||
|
.frame(height: BoardBarView.barHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Control column
|
||||||
|
|
||||||
|
private var controlColumn: some View {
|
||||||
|
VStack(alignment: .leading, spacing: BoardBarView.cellInnerSpacing) {
|
||||||
|
HStack(spacing: BoardBarView.cellInnerSpacing) {
|
||||||
|
Picker("Mode", selection: $mode) {
|
||||||
|
Text("Solo").tag(PlayMode.solo)
|
||||||
|
Text("Blend").tag(PlayMode.blend)
|
||||||
|
}
|
||||||
|
.pickerStyle(.segmented)
|
||||||
|
.labelsHidden()
|
||||||
|
.frame(width: BoardBarView.modePickerWidth)
|
||||||
|
|
||||||
|
Button("All") {
|
||||||
|
shoeGaze.selectAllBoards(crossfadeSeconds: clampedCrossfade)
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.tint(.orange)
|
||||||
|
.help("Play all boards (summed)")
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack(spacing: BoardBarView.cellInnerSpacing) {
|
||||||
|
Text("XFade")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundStyle(Color.white.opacity(BoardBarView.labelOpacity))
|
||||||
|
Slider(
|
||||||
|
value: $crossfadeSeconds,
|
||||||
|
in: 0 ... BoardBarView.maxCrossfadeSeconds,
|
||||||
|
step: BoardBarView.crossfadeStep
|
||||||
|
)
|
||||||
|
.frame(minWidth: BoardBarView.crossfadeSliderMinWidth)
|
||||||
|
Text(String(format: "%.1fs", clampedCrossfade))
|
||||||
|
.font(.caption2)
|
||||||
|
.monospacedDigit()
|
||||||
|
.foregroundStyle(Color.white.opacity(BoardBarView.labelOpacity))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(width: BoardBarView.controlColumnWidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Board cell
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func boardCell(index: Int, board: PedalBoard) -> some View {
|
||||||
|
let isEditing: Bool = index == editingBoardIndex
|
||||||
|
let isAudible: Bool = shoeGaze.isBoardAudible(board)
|
||||||
|
let isSoloed: Bool = shoeGaze.activeBoardIndex == index
|
||||||
|
|
||||||
|
VStack(spacing: BoardBarView.cellInnerSpacing) {
|
||||||
|
Text(boardLabel(index: index, board: board))
|
||||||
|
.font(.system(size: BoardBarView.nameFontSize, weight: .semibold))
|
||||||
|
.foregroundStyle(Color.white)
|
||||||
|
.lineLimit(1)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
.onTapGesture { editingBoardIndex = index }
|
||||||
|
|
||||||
|
HStack(spacing: BoardBarView.cellSpacing) {
|
||||||
|
ledButton(board: board, isAudible: isAudible)
|
||||||
|
soloButton(board: board, isSoloed: isSoloed)
|
||||||
|
}
|
||||||
|
|
||||||
|
levelFader(board: board)
|
||||||
|
}
|
||||||
|
.padding(BoardBarView.cellPadding)
|
||||||
|
.frame(width: BoardBarView.cellWidth)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: BoardBarView.cellCornerRadius)
|
||||||
|
.fill(Color(white: BoardBarView.cellBackgroundBrightness))
|
||||||
|
)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: BoardBarView.cellCornerRadius)
|
||||||
|
.stroke(
|
||||||
|
isEditing ? Color.orange : Color.white.opacity(BoardBarView.idleBorderOpacity),
|
||||||
|
lineWidth: isEditing ? BoardBarView.editingBorderWidth : 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.contextMenu {
|
||||||
|
Button("Edit This Board") { editingBoardIndex = index }
|
||||||
|
Button(isAudible ? "Silence" : "Enable") {
|
||||||
|
shoeGaze.setBoard(board, audible: !isAudible, crossfadeSeconds: clampedCrossfade)
|
||||||
|
}
|
||||||
|
Divider()
|
||||||
|
Button("Delete Board", role: .destructive) {
|
||||||
|
shoeGaze.removeBoard(board)
|
||||||
|
clampEditingIndex()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The audible LED — tap behaviour depends on the current ``PlayMode``.
|
||||||
|
private func ledButton(board: PedalBoard, isAudible: Bool) -> some View {
|
||||||
|
Button {
|
||||||
|
switch mode {
|
||||||
|
case .solo:
|
||||||
|
shoeGaze.soloBoard(board, crossfadeSeconds: clampedCrossfade)
|
||||||
|
case .blend:
|
||||||
|
shoeGaze.setBoard(board, audible: !isAudible, crossfadeSeconds: clampedCrossfade)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
ZStack {
|
||||||
|
if isAudible {
|
||||||
|
Circle()
|
||||||
|
.fill(Color.green.opacity(BoardBarView.ledGlowOpacity))
|
||||||
|
.frame(
|
||||||
|
width: BoardBarView.ledDiameter + BoardBarView.ledGlowRadius,
|
||||||
|
height: BoardBarView.ledDiameter + BoardBarView.ledGlowRadius
|
||||||
|
)
|
||||||
|
.blur(radius: BoardBarView.ledGlowRadius / 2)
|
||||||
|
}
|
||||||
|
Circle()
|
||||||
|
.fill(isAudible ? Color.green : Color(white: BoardBarView.ledDimBrightness))
|
||||||
|
.frame(width: BoardBarView.ledDiameter, height: BoardBarView.ledDiameter)
|
||||||
|
.overlay(
|
||||||
|
Circle().stroke(Color.white.opacity(BoardBarView.ledRimOpacity), lineWidth: 0.5)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.frame(width: BoardBarView.ledDiameter + BoardBarView.ledGlowRadius,
|
||||||
|
height: BoardBarView.ledDiameter + BoardBarView.ledGlowRadius)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.help(mode == .solo ? "Solo this board" : (isAudible ? "Silence this board" : "Add this board to the mix"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Exclusive solo button — lit when this board is the soloed one.
|
||||||
|
private func soloButton(board: PedalBoard, isSoloed: Bool) -> some View {
|
||||||
|
Button {
|
||||||
|
shoeGaze.soloBoard(board, crossfadeSeconds: clampedCrossfade)
|
||||||
|
} label: {
|
||||||
|
Text("S")
|
||||||
|
.font(.system(size: BoardBarView.nameFontSize, weight: .bold))
|
||||||
|
.foregroundStyle(isSoloed ? Color.black : Color.white)
|
||||||
|
.frame(width: BoardBarView.soloButtonSize, height: BoardBarView.soloButtonSize)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 4)
|
||||||
|
.fill(isSoloed ? Color.yellow : Color(white: BoardBarView.ledDimBrightness))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.help("Solo this board (exclusive)")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Board master-gain fader. Hidden until the board's output master is connected.
|
||||||
|
@ViewBuilder
|
||||||
|
private func levelFader(board: PedalBoard) -> some View {
|
||||||
|
if let gainNode: UIParamNode = board.masterGainNode {
|
||||||
|
Slider(
|
||||||
|
value: Binding(
|
||||||
|
get: { gainNode.value },
|
||||||
|
set: { gainNode.update($0) }
|
||||||
|
),
|
||||||
|
in: 0.0 ... 1.0
|
||||||
|
)
|
||||||
|
.controlSize(.mini)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Add button
|
||||||
|
|
||||||
|
private var addButton: some View {
|
||||||
|
Button(action: onAddBoard) {
|
||||||
|
Image(systemName: "plus")
|
||||||
|
.font(.system(size: BoardBarView.nameFontSize, weight: .bold))
|
||||||
|
.foregroundStyle(Color.white)
|
||||||
|
.frame(width: BoardBarView.addButtonSize, height: BoardBarView.addButtonSize)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: BoardBarView.cellCornerRadius)
|
||||||
|
.stroke(Color.white.opacity(BoardBarView.idleBorderOpacity), lineWidth: 1)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.help("Add a board")
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
/// Display label for a board, falling back to a 1-based position when unnamed.
|
||||||
|
private func boardLabel(index: Int, board: PedalBoard) -> String {
|
||||||
|
board.label.isEmpty ? "Board \(index + 1)" : board.label
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `crossfadeSeconds` clamped to the supported range.
|
||||||
|
private var clampedCrossfade: Double {
|
||||||
|
min(max(crossfadeSeconds, 0.0), BoardBarView.maxCrossfadeSeconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Keeps the edit target valid after a delete.
|
||||||
|
private func clampEditingIndex() {
|
||||||
|
let count: Int = shoeGaze.boards.count
|
||||||
|
guard count > 0 else { editingBoardIndex = 0; return }
|
||||||
|
editingBoardIndex = min(editingBoardIndex, count - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
// BoardsSheetView.swift
|
||||||
|
// Lyrebird
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import LyrebirdUI
|
||||||
|
import LyrebirdShoeGaze
|
||||||
|
|
||||||
|
/// A full board manager presented as a sheet — the richer companion to the inline
|
||||||
|
/// ``BoardBarView``.
|
||||||
|
///
|
||||||
|
/// Each board is a `List` row with an audible toggle, a Solo button, a master-gain fader, an
|
||||||
|
/// inline rename field, and an "Edit" action that selects it as the builder's edit target and
|
||||||
|
/// dismisses. Rows reorder by drag (`.onMove`) and delete by swipe (`.onDelete`). A header
|
||||||
|
/// pairs the **Solo / Blend** mode switch with the crossfade slider, mirroring the board bar.
|
||||||
|
///
|
||||||
|
/// Primarily used on iOS/iPadOS (presented with `.presentationDetents`) where the inline bar
|
||||||
|
/// has no room for rename / reorder, but the view is platform-neutral.
|
||||||
|
public struct BoardsSheetView: View {
|
||||||
|
|
||||||
|
// MARK: - Play mode
|
||||||
|
|
||||||
|
private enum PlayMode: Hashable {
|
||||||
|
case solo
|
||||||
|
case blend
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Layout constants
|
||||||
|
|
||||||
|
private static let rowSpacing: CGFloat = 12
|
||||||
|
private static let faderWidth: CGFloat = 120
|
||||||
|
private static let soloButtonSize: CGFloat = 28
|
||||||
|
private static let ledDiameter: CGFloat = 14
|
||||||
|
private static let ledDimBrightness: Double = 0.16
|
||||||
|
private static let ledRimOpacity: Double = 0.30
|
||||||
|
private static let maxCrossfadeSeconds: Double = 10.0
|
||||||
|
private static let crossfadeStep: Double = 0.1
|
||||||
|
private static let headerSpacing: CGFloat = 10
|
||||||
|
|
||||||
|
// MARK: - Properties
|
||||||
|
|
||||||
|
private let shoeGaze: ShoeGaze
|
||||||
|
@Binding private var editingBoardIndex: Int
|
||||||
|
@Binding private var crossfadeSeconds: Double
|
||||||
|
private let onAddBoard: () -> Void
|
||||||
|
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
@State private var mode: PlayMode = .solo
|
||||||
|
|
||||||
|
// MARK: - Init
|
||||||
|
|
||||||
|
/// Creates a board-manager sheet.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - shoeGaze: The manager whose `boards` are edited.
|
||||||
|
/// - editingBoardIndex: The builder's edit target; a row's "Edit" action sets this.
|
||||||
|
/// - crossfadeSeconds: Crossfade duration applied to switches / toggles.
|
||||||
|
/// - onAddBoard: Called when the **Add Board** button is tapped.
|
||||||
|
public init(
|
||||||
|
shoeGaze: ShoeGaze,
|
||||||
|
editingBoardIndex: Binding<Int>,
|
||||||
|
crossfadeSeconds: Binding<Double>,
|
||||||
|
onAddBoard: @escaping () -> Void
|
||||||
|
) {
|
||||||
|
self.shoeGaze = shoeGaze
|
||||||
|
self._editingBoardIndex = editingBoardIndex
|
||||||
|
self._crossfadeSeconds = crossfadeSeconds
|
||||||
|
self.onAddBoard = onAddBoard
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Body
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
NavigationStack {
|
||||||
|
VStack(spacing: BoardsSheetView.headerSpacing) {
|
||||||
|
header
|
||||||
|
List {
|
||||||
|
ForEach(Array(shoeGaze.boards.enumerated()), id: \.offset) { pair in
|
||||||
|
boardRow(index: pair.offset, board: pair.element)
|
||||||
|
}
|
||||||
|
.onMove(perform: moveBoards)
|
||||||
|
.onDelete(perform: deleteBoards)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.top, BoardsSheetView.headerSpacing)
|
||||||
|
.navigationTitle("Boards")
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .confirmationAction) {
|
||||||
|
Button("Done") { dismiss() }
|
||||||
|
}
|
||||||
|
ToolbarItem(placement: .primaryAction) {
|
||||||
|
Button {
|
||||||
|
onAddBoard()
|
||||||
|
} label: {
|
||||||
|
Label("Add Board", systemImage: "plus")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Header
|
||||||
|
|
||||||
|
private var header: some View {
|
||||||
|
HStack(spacing: BoardsSheetView.headerSpacing) {
|
||||||
|
Picker("Mode", selection: $mode) {
|
||||||
|
Text("Solo").tag(PlayMode.solo)
|
||||||
|
Text("Blend").tag(PlayMode.blend)
|
||||||
|
}
|
||||||
|
.pickerStyle(.segmented)
|
||||||
|
.frame(maxWidth: 180)
|
||||||
|
|
||||||
|
Button("All") {
|
||||||
|
shoeGaze.selectAllBoards(crossfadeSeconds: clampedCrossfade)
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Text("XFade")
|
||||||
|
Slider(
|
||||||
|
value: $crossfadeSeconds,
|
||||||
|
in: 0 ... BoardsSheetView.maxCrossfadeSeconds,
|
||||||
|
step: BoardsSheetView.crossfadeStep
|
||||||
|
)
|
||||||
|
.frame(width: BoardsSheetView.faderWidth)
|
||||||
|
Text(String(format: "%.1fs", clampedCrossfade))
|
||||||
|
.monospacedDigit()
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Board row
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func boardRow(index: Int, board: PedalBoard) -> some View {
|
||||||
|
let isAudible: Bool = shoeGaze.isBoardAudible(board)
|
||||||
|
let isSoloed: Bool = shoeGaze.activeBoardIndex == index
|
||||||
|
|
||||||
|
HStack(spacing: BoardsSheetView.rowSpacing) {
|
||||||
|
ledButton(board: board, isAudible: isAudible)
|
||||||
|
soloButton(board: board, isSoloed: isSoloed)
|
||||||
|
|
||||||
|
TextField(
|
||||||
|
"Board \(index + 1)",
|
||||||
|
text: Binding(
|
||||||
|
get: { board.label },
|
||||||
|
set: { board.label = $0 }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.textFieldStyle(.roundedBorder)
|
||||||
|
|
||||||
|
if let gainNode: UIParamNode = board.masterGainNode {
|
||||||
|
Slider(
|
||||||
|
value: Binding(
|
||||||
|
get: { gainNode.value },
|
||||||
|
set: { gainNode.update($0) }
|
||||||
|
),
|
||||||
|
in: 0.0 ... 1.0
|
||||||
|
)
|
||||||
|
.frame(width: BoardsSheetView.faderWidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button("Edit") {
|
||||||
|
editingBoardIndex = index
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
.buttonStyle(.borderless)
|
||||||
|
}
|
||||||
|
.padding(.vertical, 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func ledButton(board: PedalBoard, isAudible: Bool) -> some View {
|
||||||
|
Button {
|
||||||
|
switch mode {
|
||||||
|
case .solo:
|
||||||
|
shoeGaze.soloBoard(board, crossfadeSeconds: clampedCrossfade)
|
||||||
|
case .blend:
|
||||||
|
shoeGaze.setBoard(board, audible: !isAudible, crossfadeSeconds: clampedCrossfade)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Circle()
|
||||||
|
.fill(isAudible ? Color.green : Color(white: BoardsSheetView.ledDimBrightness))
|
||||||
|
.frame(width: BoardsSheetView.ledDiameter, height: BoardsSheetView.ledDiameter)
|
||||||
|
.overlay(
|
||||||
|
Circle().stroke(Color.white.opacity(BoardsSheetView.ledRimOpacity), lineWidth: 0.5)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func soloButton(board: PedalBoard, isSoloed: Bool) -> some View {
|
||||||
|
Button {
|
||||||
|
shoeGaze.soloBoard(board, crossfadeSeconds: clampedCrossfade)
|
||||||
|
} label: {
|
||||||
|
Text("S")
|
||||||
|
.font(.system(size: 13, weight: .bold))
|
||||||
|
.foregroundStyle(isSoloed ? Color.black : Color.primary)
|
||||||
|
.frame(width: BoardsSheetView.soloButtonSize, height: BoardsSheetView.soloButtonSize)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 5)
|
||||||
|
.fill(isSoloed ? Color.yellow : Color.secondary.opacity(0.2))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Mutations
|
||||||
|
|
||||||
|
/// Reorders boards, translating SwiftUI's `onMove` offsets to `ShoeGaze.moveBoard`.
|
||||||
|
private func moveBoards(from source: IndexSet, to destination: Int) {
|
||||||
|
// List drag delivers a single source row; ignore any multi-selection move so a
|
||||||
|
// dropped row can never desync `shoeGaze.boards` from the displayed order.
|
||||||
|
guard source.count == 1, let sourceIndex: Int = source.first else { return }
|
||||||
|
let board: PedalBoard = shoeGaze.boards[sourceIndex]
|
||||||
|
// SwiftUI's destination is the insertion point in the pre-move list; moveBoard
|
||||||
|
// removes first, so shift down by one when moving forward.
|
||||||
|
let target: Int = destination > sourceIndex ? destination - 1 : destination
|
||||||
|
shoeGaze.moveBoard(board, to: target)
|
||||||
|
clampEditingIndex()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func deleteBoards(_ offsets: IndexSet) {
|
||||||
|
for index: Int in offsets.sorted(by: >) where index < shoeGaze.boards.count {
|
||||||
|
shoeGaze.removeBoard(shoeGaze.boards[index])
|
||||||
|
}
|
||||||
|
clampEditingIndex()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
private var clampedCrossfade: Double {
|
||||||
|
min(max(crossfadeSeconds, 0.0), BoardsSheetView.maxCrossfadeSeconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func clampEditingIndex() {
|
||||||
|
let count: Int = shoeGaze.boards.count
|
||||||
|
guard count > 0 else { editingBoardIndex = 0; return }
|
||||||
|
editingBoardIndex = min(editingBoardIndex, count - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -113,6 +113,16 @@ public struct EngineConfigView: View {
|
|||||||
} message: {
|
} message: {
|
||||||
Text(alertText)
|
Text(alertText)
|
||||||
}
|
}
|
||||||
|
// Resync the pending fields whenever the engine is rebuilt out from under this view (e.g.
|
||||||
|
// the iOS live-input rebuild swaps in a new engine with a different input-channel count).
|
||||||
|
// Keyed on the engine's object identity so it re-runs on every swap; the @State initial
|
||||||
|
// values are seeded only once, so without this the stepper would keep showing the old
|
||||||
|
// engine's channel counts even though audio reads the new one.
|
||||||
|
.task(id: ObjectIdentifier(shoeGaze.engine)) {
|
||||||
|
pendingSampleRate = shoeGaze.engine.sampleRate
|
||||||
|
pendingInputs = shoeGaze.engine.numInputChannels
|
||||||
|
pendingOutputs = shoeGaze.engine.numOutputChannels
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func label(_ text: String) -> some View {
|
private func label(_ text: String) -> some View {
|
||||||
|
|||||||
@@ -187,6 +187,9 @@ public struct PedalView: View {
|
|||||||
private static let screwInset: CGFloat = 6
|
private static let screwInset: CGFloat = 6
|
||||||
private static let knobColumnCount: Int = 3
|
private static let knobColumnCount: Int = 3
|
||||||
private static let knobSpacing: CGFloat = 10
|
private static let knobSpacing: CGFloat = 10
|
||||||
|
/// Horizontal gap between knobs within a row. Wider than `knobSpacing` so centred
|
||||||
|
/// rows keep a comfortable, touch-friendly gap between adjacent knobs.
|
||||||
|
private static let knobRowItemSpacing: CGFloat = 24
|
||||||
/// Horizontal gap between adjacent vertical faders in the slider bank.
|
/// Horizontal gap between adjacent vertical faders in the slider bank.
|
||||||
private static let sliderBankSpacing: CGFloat = 4
|
private static let sliderBankSpacing: CGFloat = 4
|
||||||
/// Approximate per-fader footprint (matches `VerticalParameterSlider.controlWidth`),
|
/// Approximate per-fader footprint (matches `VerticalParameterSlider.controlWidth`),
|
||||||
@@ -313,18 +316,22 @@ public struct PedalView: View {
|
|||||||
return VStack(spacing: PedalView.knobSpacing) {
|
return VStack(spacing: PedalView.knobSpacing) {
|
||||||
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
|
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
|
||||||
let row: [PedalKnob] = rowPair.element
|
let row: [PedalKnob] = rowPair.element
|
||||||
HStack(spacing: PedalView.knobSpacing) {
|
// Centre each row: a short row (one or two knobs) sits centred in the
|
||||||
|
// enclosure rather than left-aligned. Symmetric spacers also centre a full
|
||||||
|
// three-knob row, so every row stays horizontally centred.
|
||||||
|
// A full three-knob row keeps the tight spacing so it fits the enclosure;
|
||||||
|
// shorter centred rows use a wider, touch-friendly gap.
|
||||||
|
let rowItemSpacing: CGFloat = row.count >= PedalView.knobColumnCount
|
||||||
|
? PedalView.knobSpacing
|
||||||
|
: PedalView.knobRowItemSpacing
|
||||||
|
HStack(spacing: rowItemSpacing) {
|
||||||
|
Spacer(minLength: 0)
|
||||||
ForEach(Array(row.enumerated()), id: \.offset) { knobPair in
|
ForEach(Array(row.enumerated()), id: \.offset) { knobPair in
|
||||||
let knob: PedalKnob = knobPair.element
|
let knob: PedalKnob = knobPair.element
|
||||||
ParameterKnob(knob.label, node: knob.node, range: knob.range)
|
ParameterKnob(knob.label, node: knob.node, range: knob.range)
|
||||||
.foregroundStyle(Color.white)
|
.foregroundStyle(Color.white)
|
||||||
}
|
}
|
||||||
// Pad short rows so knobs stay aligned in their columns.
|
Spacer(minLength: 0)
|
||||||
if row.count < PedalView.knobColumnCount {
|
|
||||||
ForEach(0 ..< (PedalView.knobColumnCount - row.count), id: \.self) { _ in
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
private static let backgroundGreen: Double = 0.07
|
private static let backgroundGreen: Double = 0.07
|
||||||
private static let backgroundBlue: Double = 0.06
|
private static let backgroundBlue: Double = 0.06
|
||||||
private static let testLoopTag: Int = -1
|
private static let testLoopTag: Int = -1
|
||||||
|
/// UserDefaults key persisting the last input selection (`-1` = test loop, `>= 0` = channel).
|
||||||
|
private static let inputSelectionDefaultsKey: String = "ShoeGaze.inputSelection"
|
||||||
|
/// Maximum crossfade duration honoured by board-switch keyboard shortcuts.
|
||||||
|
private static let maxCrossfadeSeconds: Double = 10.0
|
||||||
|
/// Highest board reachable via a ⌘-number switch shortcut.
|
||||||
|
private static let maxBoardShortcuts: Int = 9
|
||||||
private static let defaultRigFileName: String = "ShoeGazeRig"
|
private static let defaultRigFileName: String = "ShoeGazeRig"
|
||||||
private static let recordDotSize: CGFloat = 9
|
private static let recordDotSize: CGFloat = 9
|
||||||
private static let folderLabelOpacity: Double = 0.55
|
private static let folderLabelOpacity: Double = 0.55
|
||||||
@@ -57,15 +63,30 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
private let shoeGaze: ShoeGaze
|
private let shoeGaze: ShoeGaze
|
||||||
private let hardwareSampleRate: () -> Double?
|
private let hardwareSampleRate: () -> Double?
|
||||||
|
|
||||||
|
/// Host hook to enable live input when the current engine has no input channel (iOS).
|
||||||
|
/// The host requests microphone access and rebuilds the engine with one input channel,
|
||||||
|
/// preserving the rig, then swaps in a new `ShoeGaze`. `nil` on platforms (macOS) whose
|
||||||
|
/// engine already exposes an input channel, where live input is selected directly.
|
||||||
|
private let onEnableLiveInput: (() -> Void)?
|
||||||
|
|
||||||
/// Index of the board currently being edited.
|
/// Index of the board currently being edited.
|
||||||
@State private var selectedBoardIndex: Int = 0
|
@State private var selectedBoardIndex: Int = 0
|
||||||
|
|
||||||
|
/// Crossfade duration (seconds) applied to board switches in the board bar.
|
||||||
|
@State private var crossfadeSeconds: Double = 0.3
|
||||||
|
|
||||||
/// Bumped on transport/edit actions to force a re-read of `engine.isRunning`.
|
/// Bumped on transport/edit actions to force a re-read of `engine.isRunning`.
|
||||||
@State private var transportTick: Bool = false
|
@State private var transportTick: Bool = false
|
||||||
|
|
||||||
/// Shown when live input is selected but microphone access is denied/restricted.
|
/// Shown when live input is selected but microphone access is denied/restricted.
|
||||||
@State private var showMicDeniedAlert: Bool = false
|
@State private var showMicDeniedAlert: Bool = false
|
||||||
|
|
||||||
|
/// Guards the one-time input-source restore in `.onAppear`.
|
||||||
|
@State private var didRestoreInput: Bool = false
|
||||||
|
|
||||||
|
/// Presentation flag for the board-manager sheet (rename / reorder / delete).
|
||||||
|
@State private var showBoardsSheet: Bool = false
|
||||||
|
|
||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
/// iOS file-dialog presentation flags + the document to export. (macOS uses the File menu.)
|
/// iOS file-dialog presentation flags + the document to export. (macOS uses the File menu.)
|
||||||
@State private var showImporter: Bool = false
|
@State private var showImporter: Bool = false
|
||||||
@@ -84,12 +105,19 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
/// create at least one board before presenting this view.
|
/// create at least one board before presenting this view.
|
||||||
/// - hardwareSampleRate: Returns the actual hardware/session sample rate (or `nil`), used by
|
/// - hardwareSampleRate: Returns the actual hardware/session sample rate (or `nil`), used by
|
||||||
/// the engine-config Start to warn on a mismatch. Defaults to `nil`.
|
/// the engine-config Start to warn on a mismatch. Defaults to `nil`.
|
||||||
|
/// - onEnableLiveInput: Host hook invoked when the user requests live input but the engine
|
||||||
|
/// has no input channel (iOS). The host should request microphone access, rebuild the
|
||||||
|
/// engine with one input channel (preserving the rig), and select live input. Defaults to
|
||||||
|
/// `nil` — on macOS the engine already has an input channel, so live input is selected
|
||||||
|
/// directly without a rebuild.
|
||||||
public init(
|
public init(
|
||||||
shoeGaze: ShoeGaze,
|
shoeGaze: ShoeGaze,
|
||||||
hardwareSampleRate: @escaping () -> Double? = { nil }
|
hardwareSampleRate: @escaping () -> Double? = { nil },
|
||||||
|
onEnableLiveInput: (() -> Void)? = nil
|
||||||
) {
|
) {
|
||||||
self.shoeGaze = shoeGaze
|
self.shoeGaze = shoeGaze
|
||||||
self.hardwareSampleRate = hardwareSampleRate
|
self.hardwareSampleRate = hardwareSampleRate
|
||||||
|
self.onEnableLiveInput = onEnableLiveInput
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Body
|
// MARK: - Body
|
||||||
@@ -102,14 +130,24 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
recordingRow
|
recordingRow
|
||||||
#endif
|
#endif
|
||||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
|
BoardBarView(
|
||||||
|
shoeGaze: shoeGaze,
|
||||||
|
editingBoardIndex: $selectedBoardIndex,
|
||||||
|
crossfadeSeconds: $crossfadeSeconds,
|
||||||
|
onAddBoard: { addBoard() }
|
||||||
|
)
|
||||||
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) {
|
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) {
|
||||||
paletteSidebar
|
paletteSidebar
|
||||||
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
|
||||||
boardArea
|
boardArea
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||||
|
// Scope + CPU meters sit under the pedal palette, matching its width.
|
||||||
ShoeGazeScopeView(shoeGaze: shoeGaze)
|
ShoeGazeScopeView(shoeGaze: shoeGaze)
|
||||||
|
.frame(width: ShoeGazeBuilderView.sidebarWidth, alignment: .leading)
|
||||||
LyrebirdStatusView(engine: shoeGaze.engine)
|
LyrebirdStatusView(engine: shoeGaze.engine)
|
||||||
|
.frame(width: ShoeGazeBuilderView.sidebarWidth, alignment: .leading)
|
||||||
}
|
}
|
||||||
.padding(ShoeGazeBuilderView.outerPadding)
|
.padding(ShoeGazeBuilderView.outerPadding)
|
||||||
.frame(minWidth: ShoeGazeBuilderView.minWidth, minHeight: ShoeGazeBuilderView.minHeight)
|
.frame(minWidth: ShoeGazeBuilderView.minWidth, minHeight: ShoeGazeBuilderView.minHeight)
|
||||||
@@ -120,6 +158,17 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
blue: ShoeGazeBuilderView.backgroundBlue
|
blue: ShoeGazeBuilderView.backgroundBlue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.background(boardSwitchShortcuts)
|
||||||
|
.onAppear { restoreInputSelection() }
|
||||||
|
.sheet(isPresented: $showBoardsSheet) {
|
||||||
|
BoardsSheetView(
|
||||||
|
shoeGaze: shoeGaze,
|
||||||
|
editingBoardIndex: $selectedBoardIndex,
|
||||||
|
crossfadeSeconds: $crossfadeSeconds,
|
||||||
|
onAddBoard: { addBoard() }
|
||||||
|
)
|
||||||
|
.presentationDetents([.medium, .large])
|
||||||
|
}
|
||||||
.alert("Microphone Access Needed", isPresented: $showMicDeniedAlert) {
|
.alert("Microphone Access Needed", isPresented: $showMicDeniedAlert) {
|
||||||
Button("OK", role: .cancel) { }
|
Button("OK", role: .cancel) { }
|
||||||
} message: {
|
} message: {
|
||||||
@@ -184,29 +233,22 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
|
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
|
||||||
Picker("Input", selection: inputBinding) {
|
Picker("Input", selection: inputBinding) {
|
||||||
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
|
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
|
||||||
ForEach(Array(0..<max(0, shoeGaze.engine.numInputChannels)), id: \.self) { channel in
|
if shoeGaze.engine.numInputChannels > 0 {
|
||||||
|
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
|
||||||
Text("In \(channel)").tag(channel)
|
Text("In \(channel)").tag(channel)
|
||||||
}
|
}
|
||||||
}
|
} else if onEnableLiveInput != nil {
|
||||||
.pickerStyle(.menu)
|
// No input channel yet: offer live input; selecting it asks the host to
|
||||||
.foregroundStyle(Color.white)
|
// request mic access and rebuild the engine with one (channel 0).
|
||||||
|
Text("Live Input").tag(0)
|
||||||
Text("Board:")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
|
|
||||||
Picker("Board", selection: $selectedBoardIndex) {
|
|
||||||
ForEach(Array(shoeGaze.boards.enumerated()), id: \.offset) { pair in
|
|
||||||
let label: String = pair.element.label.isEmpty
|
|
||||||
? "Board \(pair.offset + 1)"
|
|
||||||
: pair.element.label
|
|
||||||
Text(label).tag(pair.offset)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.pickerStyle(.menu)
|
.pickerStyle(.menu)
|
||||||
.foregroundStyle(Color.white)
|
.foregroundStyle(Color.white)
|
||||||
|
|
||||||
Button("Add Board") { addBoard() }
|
Button("Boards…") { showBoardsSheet = true }
|
||||||
.buttonStyle(.bordered).tint(.orange)
|
.buttonStyle(.bordered).tint(.orange)
|
||||||
|
.help("Rename, reorder, or delete boards")
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
@@ -280,10 +322,15 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
set: { newValue in
|
set: { newValue in
|
||||||
let source: InputSource = newValue == ShoeGazeBuilderView.testLoopTag
|
if newValue == ShoeGazeBuilderView.testLoopTag {
|
||||||
? .testLoop
|
switchInput(to: .testLoop)
|
||||||
: .liveInput(channel: newValue)
|
} else if newValue < shoeGaze.engine.numInputChannels {
|
||||||
switchInput(to: source)
|
switchInput(to: .liveInput(channel: newValue))
|
||||||
|
} else if let onEnableLiveInput {
|
||||||
|
// Requested a channel the current engine doesn't have (iOS, 0 channels):
|
||||||
|
// hand off to the host to grant mic + rebuild with an input channel.
|
||||||
|
onEnableLiveInput()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -335,6 +382,7 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
if wasRunning { shoeGaze.engine.stop() }
|
if wasRunning { shoeGaze.engine.stop() }
|
||||||
do {
|
do {
|
||||||
try shoeGaze.setInputSource(source)
|
try shoeGaze.setInputSource(source)
|
||||||
|
persistInputSelection(source)
|
||||||
} catch {
|
} catch {
|
||||||
print("[ShoeGazeBuilderView] setInputSource failed: \(error)")
|
print("[ShoeGazeBuilderView] setInputSource failed: \(error)")
|
||||||
}
|
}
|
||||||
@@ -344,6 +392,70 @@ public struct ShoeGazeBuilderView: View {
|
|||||||
transportTick.toggle()
|
transportTick.toggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Input persistence
|
||||||
|
|
||||||
|
/// Saves the current input choice so it is restored on the next launch.
|
||||||
|
private func persistInputSelection(_ source: InputSource) {
|
||||||
|
let value: Int
|
||||||
|
switch source {
|
||||||
|
case .testLoop:
|
||||||
|
value = ShoeGazeBuilderView.testLoopTag
|
||||||
|
case .liveInput(let channel):
|
||||||
|
value = channel
|
||||||
|
}
|
||||||
|
UserDefaults.standard.set(value, forKey: ShoeGazeBuilderView.inputSelectionDefaultsKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Restores the saved input choice once on appear. With no saved choice, defaults to live
|
||||||
|
/// input when the microphone is already authorised and the engine has an input channel —
|
||||||
|
/// otherwise stays on the test loop. A saved live channel that no longer fits the engine, or
|
||||||
|
/// a since-revoked permission, falls back to the test loop via `switchInput(to:)`.
|
||||||
|
private func restoreInputSelection() {
|
||||||
|
guard !didRestoreInput else { return }
|
||||||
|
didRestoreInput = true
|
||||||
|
|
||||||
|
let defaults: UserDefaults = UserDefaults.standard
|
||||||
|
if defaults.object(forKey: ShoeGazeBuilderView.inputSelectionDefaultsKey) != nil {
|
||||||
|
let stored: Int = defaults.integer(forKey: ShoeGazeBuilderView.inputSelectionDefaultsKey)
|
||||||
|
if stored >= 0, stored < shoeGaze.engine.numInputChannels {
|
||||||
|
switchInput(to: .liveInput(channel: stored))
|
||||||
|
} else if stored >= 0, shoeGaze.engine.numInputChannels == 0,
|
||||||
|
MicrophonePermission.isAuthorized, let onEnableLiveInput {
|
||||||
|
// iOS: a live choice was saved and the mic is already authorised — rebuild the
|
||||||
|
// engine with an input channel silently (no prompt, since access is granted).
|
||||||
|
onEnableLiveInput()
|
||||||
|
}
|
||||||
|
// A test-loop choice (or live with no host hook / no permission) leaves the test loop.
|
||||||
|
} else if MicrophonePermission.isAuthorized, shoeGaze.engine.numInputChannels > 0 {
|
||||||
|
// First launch with no saved choice but mic already granted → default to live input.
|
||||||
|
switchInput(to: .liveInput(channel: 0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Board-switch shortcuts
|
||||||
|
|
||||||
|
/// Hidden ⌘1…⌘9 buttons that solo (live-switch to) the matching board and select it as the
|
||||||
|
/// edit target. Kept at zero opacity so the shortcuts stay active without showing chrome.
|
||||||
|
private var boardSwitchShortcuts: some View {
|
||||||
|
ZStack {
|
||||||
|
ForEach(0 ..< min(ShoeGazeBuilderView.maxBoardShortcuts, shoeGaze.boards.count), id: \.self) { index in
|
||||||
|
Button("") { switchToBoard(index) }
|
||||||
|
.keyboardShortcut(KeyEquivalent(Character("\(index + 1)")), modifiers: .command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.opacity(0)
|
||||||
|
.frame(width: 0, height: 0)
|
||||||
|
.accessibilityHidden(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Solos board `index` (a live amp-channel-style switch) and makes it the edit target.
|
||||||
|
private func switchToBoard(_ index: Int) {
|
||||||
|
guard index < shoeGaze.boards.count else { return }
|
||||||
|
selectedBoardIndex = index
|
||||||
|
let seconds: Double = min(max(crossfadeSeconds, 0.0), ShoeGazeBuilderView.maxCrossfadeSeconds)
|
||||||
|
shoeGaze.soloBoard(shoeGaze.boards[index], crossfadeSeconds: seconds)
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Save / Load (iOS)
|
// MARK: - Save / Load (iOS)
|
||||||
|
|
||||||
// On macOS, Save/Load are driven from the app's File menu (the app shell owns the
|
// On macOS, Save/Load are driven from the app's File menu (the app shell owns the
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ public struct ShoeGazeView: View {
|
|||||||
/// Crossfade duration used for the next board-select transition.
|
/// Crossfade duration used for the next board-select transition.
|
||||||
@State private var crossfadeSeconds: Double = ShoeGazeView.defaultCrossfadeSeconds
|
@State private var crossfadeSeconds: Double = ShoeGazeView.defaultCrossfadeSeconds
|
||||||
|
|
||||||
|
/// Highlighted board in the board bar (the bar's edit-target binding). The player shows
|
||||||
|
/// every board strip, so this only drives the bar's selection outline.
|
||||||
|
@State private var selectedBoardIndex: Int = 0
|
||||||
|
|
||||||
/// Controls presentation of the iOS `.fileImporter` directory picker.
|
/// Controls presentation of the iOS `.fileImporter` directory picker.
|
||||||
/// On macOS the picker is opened imperatively via `NSOpenPanel`; this flag is
|
/// On macOS the picker is opened imperatively via `NSOpenPanel`; this flag is
|
||||||
/// only meaningful on iOS / non-macOS targets.
|
/// only meaningful on iOS / non-macOS targets.
|
||||||
@@ -108,7 +112,12 @@ public struct ShoeGazeView: View {
|
|||||||
recordingRow
|
recordingRow
|
||||||
Divider()
|
Divider()
|
||||||
.overlay(Color.white.opacity(ShoeGazeView.dividerOpacity))
|
.overlay(Color.white.opacity(ShoeGazeView.dividerOpacity))
|
||||||
boardSelectRow
|
BoardBarView(
|
||||||
|
shoeGaze: shoeGaze,
|
||||||
|
editingBoardIndex: $selectedBoardIndex,
|
||||||
|
crossfadeSeconds: $crossfadeSeconds,
|
||||||
|
onAddBoard: { addBoard() }
|
||||||
|
)
|
||||||
Divider()
|
Divider()
|
||||||
.overlay(Color.white.opacity(ShoeGazeView.dividerOpacity))
|
.overlay(Color.white.opacity(ShoeGazeView.dividerOpacity))
|
||||||
boardList
|
boardList
|
||||||
@@ -230,77 +239,6 @@ public struct ShoeGazeView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `Binding<Int>` that maps between the Picker's integer tag and `ShoeGaze` select API.
|
|
||||||
///
|
|
||||||
/// Tag `-1` represents "All boards audible" (`activeBoardIndex == nil`).
|
|
||||||
/// Tags `0 ..< boards.count` represent the soloed board at that index.
|
|
||||||
/// Setting the binding calls `selectBoard(_:crossfadeSeconds:)` or
|
|
||||||
/// `selectAllBoards(crossfadeSeconds:)` with the current `crossfadeSeconds` value.
|
|
||||||
private var boardSelectBinding: Binding<Int> {
|
|
||||||
Binding(
|
|
||||||
get: { shoeGaze.activeBoardIndex ?? -1 },
|
|
||||||
set: { newValue in
|
|
||||||
// Clamp here so a value typed into the crossfade text field (which has no
|
|
||||||
// built-in bounds) can never pass a negative or oversized lag time.
|
|
||||||
let seconds: Double = min(max(crossfadeSeconds, 0.0), ShoeGazeView.maxCrossfadeSeconds)
|
|
||||||
if newValue == -1 {
|
|
||||||
shoeGaze.selectAllBoards(crossfadeSeconds: seconds)
|
|
||||||
} else if newValue >= 0, newValue < shoeGaze.boards.count {
|
|
||||||
shoeGaze.selectBoard(shoeGaze.boards[newValue], crossfadeSeconds: seconds)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Board-select row: an "Active" Picker to solo a board (or hear all), a crossfade-
|
|
||||||
/// seconds text field, and a companion Stepper for convenient adjustment.
|
|
||||||
///
|
|
||||||
/// The row is always visible. When `boards.count <= 1` the Picker has only one or two
|
|
||||||
/// options, which is still useful for the "All" / single-board toggle.
|
|
||||||
private var boardSelectRow: some View {
|
|
||||||
HStack(spacing: ShoeGazeView.boardSelectSpacing) {
|
|
||||||
Text("Active:")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(Color.white.opacity(ShoeGazeView.labelOpacity))
|
|
||||||
|
|
||||||
Picker("Active", selection: boardSelectBinding) {
|
|
||||||
Text("All").tag(-1)
|
|
||||||
ForEach(Array(shoeGaze.boards.enumerated()), id: \.offset) { pair in
|
|
||||||
let label: String = pair.element.label.isEmpty
|
|
||||||
? "Board \(pair.offset + 1)"
|
|
||||||
: pair.element.label
|
|
||||||
Text(label).tag(pair.offset)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pickerStyle(.menu)
|
|
||||||
.foregroundStyle(Color.white)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Text("Crossfade (s):")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(Color.white.opacity(ShoeGazeView.labelOpacity))
|
|
||||||
|
|
||||||
TextField(
|
|
||||||
"s",
|
|
||||||
value: $crossfadeSeconds,
|
|
||||||
format: .number.precision(.fractionLength(1))
|
|
||||||
)
|
|
||||||
.frame(width: ShoeGazeView.crossfadeFieldWidth)
|
|
||||||
#if os(macOS)
|
|
||||||
.textFieldStyle(.squareBorder)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Stepper(
|
|
||||||
"",
|
|
||||||
value: $crossfadeSeconds,
|
|
||||||
in: 0...ShoeGazeView.maxCrossfadeSeconds,
|
|
||||||
step: ShoeGazeView.crossfadeStepIncrement
|
|
||||||
)
|
|
||||||
.labelsHidden()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Vertically scrollable list of board strips.
|
/// Vertically scrollable list of board strips.
|
||||||
///
|
///
|
||||||
/// Keyed by `\.offset` on an enumerated snapshot; see the doc-comment on
|
/// Keyed by `\.offset` on an enumerated snapshot; see the doc-comment on
|
||||||
|
|||||||
@@ -97,9 +97,9 @@ struct FeedbackDelayPedalTests {
|
|||||||
#expect(ssd > 0, "short and long feedback produced identical output")
|
#expect(ssd > 0, "short and long feedback produced identical output")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test func exposesTimeFeedbackAndToneKnobs() throws {
|
@Test func exposesTimeDecayAndToneKnobs() throws {
|
||||||
let pedal: FeedbackDelayPedal = FeedbackDelayPedal()
|
let pedal: FeedbackDelayPedal = FeedbackDelayPedal()
|
||||||
let labels: [String] = pedal.effectKnobs.map { $0.label }
|
let labels: [String] = pedal.effectKnobs.map { $0.label }
|
||||||
#expect(labels == ["Time", "Feedback", "Tone"])
|
#expect(labels == ["Time", "Decay Time", "Tone"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,176 @@ struct ShoeGazeMultiBoardTests {
|
|||||||
#expect(shoeGaze.boards.count == 2)
|
#expect(shoeGaze.boards.count == 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test func rigSnapshotRestoresAcrossEnginesWithInputChannel() throws {
|
||||||
|
// Backs the iOS "enable live input" rebuild: a rig captured on a 0-input engine must
|
||||||
|
// restore onto a freshly built 1-input engine, and live input must then be selectable.
|
||||||
|
let renderDuration: Double = 0.05
|
||||||
|
|
||||||
|
// Source engine: no input channels (the iOS default before live input is enabled).
|
||||||
|
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
|
||||||
|
duration: renderDuration,
|
||||||
|
numInputChannels: 0,
|
||||||
|
numAudioBuses: 64
|
||||||
|
)
|
||||||
|
defer { try? FileManager.default.removeItem(at: urlA) }
|
||||||
|
|
||||||
|
let shoeGazeA: ShoeGaze = ShoeGaze(engine: engineA)
|
||||||
|
let board1: PedalBoard = try shoeGazeA.addBoard()
|
||||||
|
board1.label = "Lead"
|
||||||
|
try shoeGazeA.appendPedal(type: "Overdrive", to: board1)
|
||||||
|
try shoeGazeA.finalizeBoard(board1)
|
||||||
|
let board2: PedalBoard = try shoeGazeA.addBoard()
|
||||||
|
board2.label = "Clean"
|
||||||
|
try shoeGazeA.appendPedal(type: "Graphic EQ", to: board2)
|
||||||
|
try shoeGazeA.finalizeBoard(board2)
|
||||||
|
|
||||||
|
let snapshot: Data = try shoeGazeA.rigData()
|
||||||
|
|
||||||
|
// Destination engine: one input channel (the rebuilt engine for live input).
|
||||||
|
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
|
||||||
|
duration: renderDuration,
|
||||||
|
numInputChannels: 1,
|
||||||
|
numAudioBuses: 64
|
||||||
|
)
|
||||||
|
defer { try? FileManager.default.removeItem(at: urlB) }
|
||||||
|
|
||||||
|
let shoeGazeB: ShoeGaze = ShoeGaze(engine: engineB)
|
||||||
|
try shoeGazeB.loadRig(from: snapshot)
|
||||||
|
|
||||||
|
// The rig round-trips: same board count and labels.
|
||||||
|
#expect(shoeGazeB.boards.count == 2)
|
||||||
|
#expect(shoeGazeB.boards.first?.label == "Lead")
|
||||||
|
#expect(shoeGazeB.boards.last?.label == "Clean")
|
||||||
|
|
||||||
|
// Live input is now selectable on the rebuilt engine.
|
||||||
|
#expect(throws: Never.self) {
|
||||||
|
try shoeGazeB.setInputSource(.liveInput(channel: 0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func activeBoardIndexTracksReorderAndRemoval() throws {
|
||||||
|
let renderDuration: Double = 0.05
|
||||||
|
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
|
||||||
|
duration: renderDuration,
|
||||||
|
numAudioBuses: 64
|
||||||
|
)
|
||||||
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
|
||||||
|
let shoeGaze: ShoeGaze = ShoeGaze(engine: engine)
|
||||||
|
let board1: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board1.add(OverdrivePedal())
|
||||||
|
try shoeGaze.finalizeBoard(board1)
|
||||||
|
let board2: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board2.add(DelayPedal())
|
||||||
|
try shoeGaze.finalizeBoard(board2)
|
||||||
|
let board3: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board3.add(OverdrivePedal())
|
||||||
|
try shoeGaze.finalizeBoard(board3)
|
||||||
|
|
||||||
|
// Solo board3 (index 2), then move it to the front — index must follow the board.
|
||||||
|
shoeGaze.soloBoard(board3, crossfadeSeconds: 0.0)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 2)
|
||||||
|
shoeGaze.moveBoard(board3, to: 0)
|
||||||
|
#expect(shoeGaze.boards.first === board3)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 0)
|
||||||
|
|
||||||
|
// Now order is [board3, board1, board2], soloed index 0. Removing a later board
|
||||||
|
// leaves the soloed index unchanged.
|
||||||
|
shoeGaze.removeBoard(board2)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 0)
|
||||||
|
|
||||||
|
// Re-solo board1 (now index 1), then remove the earlier board3 (index 0):
|
||||||
|
// the soloed index shifts down to 0.
|
||||||
|
shoeGaze.soloBoard(board1, crossfadeSeconds: 0.0)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 1)
|
||||||
|
shoeGaze.removeBoard(board3)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 0)
|
||||||
|
|
||||||
|
// Removing the soloed board clears the index.
|
||||||
|
shoeGaze.removeBoard(board1)
|
||||||
|
#expect(shoeGaze.activeBoardIndex == nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func soloBlendAndAllControlBoardAudibility() throws {
|
||||||
|
let renderDuration: Double = 0.05
|
||||||
|
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
|
||||||
|
duration: renderDuration,
|
||||||
|
numAudioBuses: 64
|
||||||
|
)
|
||||||
|
defer { try? FileManager.default.removeItem(at: url) }
|
||||||
|
|
||||||
|
let shoeGaze: ShoeGaze = ShoeGaze(engine: engine)
|
||||||
|
|
||||||
|
let board1: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board1.add(OverdrivePedal())
|
||||||
|
try shoeGaze.finalizeBoard(board1)
|
||||||
|
let board2: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board2.add(DelayPedal())
|
||||||
|
try shoeGaze.finalizeBoard(board2)
|
||||||
|
let board3: PedalBoard = try shoeGaze.addBoard()
|
||||||
|
try board3.add(OverdrivePedal())
|
||||||
|
try shoeGaze.finalizeBoard(board3)
|
||||||
|
|
||||||
|
let instantCrossfade: Double = 0.0
|
||||||
|
|
||||||
|
// Default: every board audible, no solo.
|
||||||
|
#expect(shoeGaze.isBoardAudible(board1))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board2))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board3))
|
||||||
|
#expect(shoeGaze.activeBoardIndex == nil)
|
||||||
|
|
||||||
|
// Solo board2 — exclusive.
|
||||||
|
shoeGaze.soloBoard(board2, crossfadeSeconds: instantCrossfade)
|
||||||
|
#expect(!shoeGaze.isBoardAudible(board1))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board2))
|
||||||
|
#expect(!shoeGaze.isBoardAudible(board3))
|
||||||
|
#expect(shoeGaze.activeBoardIndex == 1)
|
||||||
|
|
||||||
|
// Blend: re-enable board1 without disturbing the others, and clear the solo index.
|
||||||
|
shoeGaze.setBoard(board1, audible: true, crossfadeSeconds: instantCrossfade)
|
||||||
|
#expect(shoeGaze.isBoardAudible(board1))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board2))
|
||||||
|
#expect(!shoeGaze.isBoardAudible(board3))
|
||||||
|
#expect(shoeGaze.activeBoardIndex == nil)
|
||||||
|
|
||||||
|
// Silence a single board.
|
||||||
|
shoeGaze.setBoard(board1, audible: false, crossfadeSeconds: instantCrossfade)
|
||||||
|
#expect(!shoeGaze.isBoardAudible(board1))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board2))
|
||||||
|
|
||||||
|
// All back to summed.
|
||||||
|
shoeGaze.selectAllBoards(crossfadeSeconds: instantCrossfade)
|
||||||
|
#expect(shoeGaze.isBoardAudible(board1))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board2))
|
||||||
|
#expect(shoeGaze.isBoardAudible(board3))
|
||||||
|
#expect(shoeGaze.activeBoardIndex == nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func setBoardIgnoresUnmanagedBoard() throws {
|
||||||
|
let renderDuration: Double = 0.05
|
||||||
|
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(duration: renderDuration, numAudioBuses: 64)
|
||||||
|
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(duration: renderDuration, numAudioBuses: 64)
|
||||||
|
defer {
|
||||||
|
try? FileManager.default.removeItem(at: urlA)
|
||||||
|
try? FileManager.default.removeItem(at: urlB)
|
||||||
|
}
|
||||||
|
|
||||||
|
let shoeGazeA: ShoeGaze = ShoeGaze(engine: engineA)
|
||||||
|
let shoeGazeB: ShoeGaze = ShoeGaze(engine: engineB)
|
||||||
|
|
||||||
|
let boardA: PedalBoard = try shoeGazeA.addBoard()
|
||||||
|
try boardA.add(OverdrivePedal())
|
||||||
|
try shoeGazeA.finalizeBoard(boardA)
|
||||||
|
let boardB: PedalBoard = try shoeGazeB.addBoard()
|
||||||
|
try boardB.add(DelayPedal())
|
||||||
|
try shoeGazeB.finalizeBoard(boardB)
|
||||||
|
|
||||||
|
// Toggling a board not owned by this manager is a no-op and must not change state.
|
||||||
|
shoeGazeA.setBoard(boardB, audible: false, crossfadeSeconds: 0.0)
|
||||||
|
#expect(shoeGazeA.isBoardAudible(boardA))
|
||||||
|
#expect(shoeGazeB.isBoardAudible(boardB))
|
||||||
|
}
|
||||||
|
|
||||||
@Test func removeBoardLeavesOtherBoards() throws {
|
@Test func removeBoardLeavesOtherBoards() throws {
|
||||||
let renderDuration: Double = 0.05
|
let renderDuration: Double = 0.05
|
||||||
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
|
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
|
||||||
|
|||||||
Reference in New Issue
Block a user