commit current state
This commit is contained in:
@@ -55,6 +55,7 @@ public struct ShoeGazeBuilderView: View {
|
||||
// MARK: - Properties
|
||||
|
||||
private let shoeGaze: ShoeGaze
|
||||
private let hardwareSampleRate: () -> Double?
|
||||
|
||||
/// Index of the board currently being edited.
|
||||
@State private var selectedBoardIndex: Int = 0
|
||||
@@ -75,10 +76,17 @@ public struct ShoeGazeBuilderView: View {
|
||||
|
||||
/// Creates a builder view.
|
||||
///
|
||||
/// - Parameter shoeGaze: The `ShoeGaze` manager whose boards and engine are edited. The
|
||||
/// caller should create at least one board before presenting this view.
|
||||
public init(shoeGaze: ShoeGaze) {
|
||||
/// - Parameters:
|
||||
/// - shoeGaze: The `ShoeGaze` manager whose boards and engine are edited. The caller should
|
||||
/// create at least one board before presenting this view.
|
||||
/// - hardwareSampleRate: Returns the actual hardware/session sample rate (or `nil`), used by
|
||||
/// the engine-config Start to warn on a mismatch. Defaults to `nil`.
|
||||
public init(
|
||||
shoeGaze: ShoeGaze,
|
||||
hardwareSampleRate: @escaping () -> Double? = { nil }
|
||||
) {
|
||||
self.shoeGaze = shoeGaze
|
||||
self.hardwareSampleRate = hardwareSampleRate
|
||||
}
|
||||
|
||||
// MARK: - Body
|
||||
@@ -132,7 +140,6 @@ public struct ShoeGazeBuilderView: View {
|
||||
|
||||
private var transportRow: some View {
|
||||
_ = transportTick
|
||||
let isRunning: Bool = shoeGaze.engine.isRunning
|
||||
return HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
|
||||
Text("ShoeGaze Builder")
|
||||
.font(.title2).bold()
|
||||
@@ -150,18 +157,11 @@ public struct ShoeGazeBuilderView: View {
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
Button("Start") {
|
||||
do { try shoeGaze.engine.start() }
|
||||
catch { print("[ShoeGazeBuilderView] engine.start() failed: \(error)") }
|
||||
transportTick.toggle()
|
||||
}
|
||||
.buttonStyle(.borderedProminent).tint(.green).disabled(isRunning)
|
||||
|
||||
Button("Stop") {
|
||||
shoeGaze.engine.stop()
|
||||
transportTick.toggle()
|
||||
}
|
||||
.buttonStyle(.bordered).tint(.red).disabled(!isRunning)
|
||||
EngineConfigView(
|
||||
shoeGaze: shoeGaze,
|
||||
hardwareSampleRate: hardwareSampleRate,
|
||||
onConfigApplied: { transportTick.toggle() }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public struct ShoeGazeBuilderView: View {
|
||||
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
|
||||
Picker("Input", selection: inputBinding) {
|
||||
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
|
||||
ForEach(0..<shoeGaze.engine.numInputChannels, id: \.self) { channel in
|
||||
ForEach(Array(0..<max(0, shoeGaze.engine.numInputChannels)), id: \.self) { channel in
|
||||
Text("In \(channel)").tag(channel)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user