Add ShoeGaze Builder demo apps (macOS + iOS)
Two thin app shells hosting ShoeGazeBuilderView: - macOS (AppKit): seeds one board with an Overdrive; anchors the window ~100px from the left of the visible screen and sizes it to most of the screen height via LyrebirdWindow.nsWindow. - iOS (SwiftUI): NavigationStack hosting the builder; AVAudioSession + iOSAudioDriver; logs session-activation failures. Both .xcodeproj reference the local package (..) + the remote Lyrebird package, with fresh hex object-id prefixes; added to ShoeGaze.xcworkspace. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2026 Realized Sound. All rights reserved.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>ShoeGaze Builder can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,33 @@
|
||||
// ShoeGazeBuilderiOSApp.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import SwiftUI
|
||||
import LyrebirdShoeGazeUI
|
||||
|
||||
/// iOS entry point for the ShoeGaze Builder.
|
||||
///
|
||||
/// Holds the `ShoeGazeBuilderiOSAppModel` as `@State` so it is created once and owned for the
|
||||
/// lifetime of the app. The audio engine is **not** started automatically — the user presses
|
||||
/// Start in ``ShoeGazeBuilderView``. The engine is stopped when the view disappears.
|
||||
///
|
||||
/// ``ShoeGazeBuilderView`` manages its own scroll regions (palette + builder), so it is hosted
|
||||
/// directly rather than wrapped in an outer `ScrollView`.
|
||||
@main
|
||||
struct ShoeGazeBuilderiOSApp: App {
|
||||
|
||||
@State private var model: ShoeGazeBuilderiOSAppModel = ShoeGazeBuilderiOSAppModel()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
NavigationStack {
|
||||
ShoeGazeBuilderView(shoeGaze: model.shoeGaze)
|
||||
.navigationTitle("ShoeGaze Builder")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
.onDisappear { model.stop() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// ShoeGazeBuilderiOSAppModel.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import AVFoundation
|
||||
import Observation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdShoeGaze
|
||||
|
||||
/// Observable model owning the `SynthesisEngine` and `ShoeGaze` session for the iOS builder.
|
||||
///
|
||||
/// `AVAudioSession` is activated at init so the hardware sample rate is known before the engine
|
||||
/// is constructed (iOS devices typically lock to 48 000 Hz). The session is seeded with one board
|
||||
/// holding a single pedal so the builder opens with an audible starting point; the user adds /
|
||||
/// removes / reorders pedals from the palette. Input defaults to `.testLoop`, so no microphone
|
||||
/// permission is required to start.
|
||||
@Observable
|
||||
@MainActor
|
||||
final class ShoeGazeBuilderiOSAppModel {
|
||||
|
||||
// MARK: - Engine configuration constants
|
||||
|
||||
private static let blockSize: Int = 512
|
||||
private static let outputChannels: Int = 2
|
||||
private static let numAudioBuses: Int = 256
|
||||
private static let seedPedalType: String = "Overdrive"
|
||||
|
||||
// MARK: - Owned objects
|
||||
|
||||
/// The active ShoeGaze builder session.
|
||||
private(set) var shoeGaze: ShoeGaze
|
||||
|
||||
private let engine: SynthesisEngine
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
init() {
|
||||
let session: AVAudioSession = AVAudioSession.sharedInstance()
|
||||
do {
|
||||
try session.setCategory(.playAndRecord,
|
||||
mode: .default,
|
||||
options: [.defaultToSpeaker, .allowBluetoothHFP])
|
||||
try session.setActive(true)
|
||||
} 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 eng: SynthesisEngine = SynthesisEngine(
|
||||
blockSize: ShoeGazeBuilderiOSAppModel.blockSize,
|
||||
sampleRate: sampleRate,
|
||||
numOutputChannels: ShoeGazeBuilderiOSAppModel.outputChannels,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: ShoeGazeBuilderiOSAppModel.numAudioBuses,
|
||||
driver: iOSAudioDriver()
|
||||
)
|
||||
self.engine = eng
|
||||
self.shoeGaze = ShoeGaze(engine: eng)
|
||||
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
board.label = "Board 1"
|
||||
try shoeGaze.appendPedal(type: ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||
} catch {
|
||||
print("[ShoeGazeBuilderiOS] seed board failed: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Transport
|
||||
|
||||
/// Stops the audio engine. Call from `.onDisappear`.
|
||||
func stop() {
|
||||
engine.stop()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user