Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c058493a98 |
@@ -71,7 +71,6 @@ The `.githooks/pre-commit` hook calls `--check`. Skips silently when `~/.claude/
|
||||
- Dev workflow / phase branches / build → `docs/tooling/workflow.md`
|
||||
- Xcode project templates → `docs/tooling/xcode-templates.md`
|
||||
- AUv3 plugin internals (`LyrebirdAudioUnit`, `LyrebirdAUVoicePoolBinding`, `AUInput`, preset codable, parameter slots) → `Sources/Lyrebird/Lyrebird.docc/AUv3.md`
|
||||
- ShoeGaze guitar-pedalboard sub-package (`Pedal`, `PedalBoard`, `ShoeGaze`, built-in pedals, `.testLoop` vs `.liveInput`, `lyrebird new --template shoegaze` workflow) → `docs/stdlib/shoegaze.md`
|
||||
|
||||
**UI**
|
||||
- LyrebirdUI / parameter binding → `docs/ui/gui-system.md`
|
||||
|
||||
+7
-9
@@ -11,9 +11,8 @@ functionality in a backward-compatible way.
|
||||
|
||||
A minor release. Adds roughly forty SuperCollider-parity generators —
|
||||
triggers, time-domain analysis, chaotic oscillators, resonator banks, dynamics,
|
||||
waveshaping, routing/morph, and psychoacoustic metering — plus a `shoegaze`
|
||||
guitar-pedalboard project template and an iOS path fix. Fully
|
||||
backward-compatible; no changes to existing public API.
|
||||
waveshaping, routing/morph, and psychoacoustic metering — plus an iOS path fix.
|
||||
Fully backward-compatible; no changes to existing public API.
|
||||
|
||||
### New generators
|
||||
|
||||
@@ -59,12 +58,11 @@ gain lag).
|
||||
|
||||
### Tooling
|
||||
|
||||
- **`shoegaze` project template.** `lyrebird new MyRig --template shoegaze`
|
||||
scaffolds a guitar-pedalboard app (macOS or iOS) that depends on the ShoeGaze
|
||||
package — a set of effect "pedals" chained into boards, with knobs, bypass,
|
||||
parallel routing, and recording. Ships with an Xcode "ShoeGaze Pedal" file
|
||||
template for authoring custom pedals. ShoeGaze itself now lives in its own
|
||||
repository rather than in-tree.
|
||||
- **ShoeGaze moved out of tree.** The guitar-pedalboard framework and its
|
||||
project/pedal scaffolding now live in a standalone ShoeGaze repository that
|
||||
depends on Lyrebird as a package. Lyrebird's CLI no longer ships the
|
||||
`shoegaze` / `shoegaze-ios` project templates or the "ShoeGaze Pedal" Xcode
|
||||
file template.
|
||||
|
||||
### Fixes
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:.">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -18,13 +18,10 @@ public enum CLICommand: Equatable {
|
||||
/// When `lyrebirdPath` is set, the generated `Package.swift` and (where
|
||||
/// applicable) `.xcodeproj` reference Lyrebird as a local SPM package at
|
||||
/// that absolute path instead of pulling from the published Git URL.
|
||||
/// When `shoegazePath` is set (shoegaze template only), the ShoeGaze
|
||||
/// package is wired as a local SPM dependency at that absolute path.
|
||||
case new(
|
||||
name: String,
|
||||
template: ProjectTemplate,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String?
|
||||
lyrebirdPath: String?
|
||||
)
|
||||
/// Run the current project with `swift run`.
|
||||
case run(release: Bool)
|
||||
@@ -76,21 +73,10 @@ public enum CLICommand: Equatable {
|
||||
} else {
|
||||
lyrebirdPath = nil
|
||||
}
|
||||
// Optional `--shoegaze-path <abs-path>` for shoegaze template only.
|
||||
// Value must not be a flag token.
|
||||
let shoegazePath: String?
|
||||
if let sIdx: Array<String>.Index = arguments.firstIndex(of: "--shoegaze-path"),
|
||||
sIdx + 1 < arguments.count,
|
||||
!arguments[sIdx + 1].hasPrefix("-") {
|
||||
shoegazePath = arguments[sIdx + 1]
|
||||
} else {
|
||||
shoegazePath = nil
|
||||
}
|
||||
return .new(
|
||||
name: arguments[2],
|
||||
template: template,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath
|
||||
lyrebirdPath: lyrebirdPath
|
||||
)
|
||||
|
||||
case "run":
|
||||
|
||||
@@ -25,8 +25,8 @@ struct LyrebirdCLIMain {
|
||||
print("lyrebird \(lyrebirdVersion)")
|
||||
case .help:
|
||||
printHelp()
|
||||
case .new(let name, let template, let lyrebirdPath, let shoegazePath):
|
||||
runNew(name: name, template: template, lyrebirdPath: lyrebirdPath, shoegazePath: shoegazePath)
|
||||
case .new(let name, let template, let lyrebirdPath):
|
||||
runNew(name: name, template: template, lyrebirdPath: lyrebirdPath)
|
||||
case .run(let release):
|
||||
runProject(release: release)
|
||||
case .export(let name, let toPath, let overwrite):
|
||||
@@ -106,8 +106,7 @@ struct LyrebirdCLIMain {
|
||||
private static func runNew(
|
||||
name: String,
|
||||
template: ProjectTemplate,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String? = nil
|
||||
lyrebirdPath: String?
|
||||
) {
|
||||
let resolvedPath: String?
|
||||
if let p: String = lyrebirdPath {
|
||||
@@ -131,33 +130,11 @@ struct LyrebirdCLIMain {
|
||||
""", stderr)
|
||||
}
|
||||
|
||||
// Resolve ShoeGaze path (shoegaze template only).
|
||||
let resolvedShoegazePath: String?
|
||||
if let p: String = shoegazePath {
|
||||
resolvedShoegazePath = URL(fileURLWithPath: p).standardizedFileURL.path
|
||||
} else {
|
||||
resolvedShoegazePath = nil
|
||||
}
|
||||
if template == .shoegaze || template == .shoegazeIOS {
|
||||
if let path: String = resolvedShoegazePath {
|
||||
print("ShoeGaze dependency: local checkout at \(path)")
|
||||
} else {
|
||||
fputs("""
|
||||
note: --shoegaze-path not supplied; the generated project will use \
|
||||
the placeholder URL \(ProjectScaffolder.shoegazePackageURL). \
|
||||
Edit the project or re-run with --shoegaze-path <path to ShoeGaze checkout> \
|
||||
until ShoeGaze is published at that URL.
|
||||
|
||||
""", stderr)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
try ProjectScaffolder.scaffold(
|
||||
name: name,
|
||||
template: template,
|
||||
lyrebirdPath: effectivePath,
|
||||
shoegazePath: resolvedShoegazePath
|
||||
lyrebirdPath: effectivePath
|
||||
)
|
||||
print("Created \(name)/")
|
||||
} catch ProjectScaffolder.Error.projectExists(let n) {
|
||||
@@ -222,8 +199,6 @@ struct LyrebirdCLIMain {
|
||||
SPM templates (open Package.swift in Xcode):
|
||||
basic (default), demo, ui-demo, nrt, score
|
||||
Xcode-project templates (build to .app or .appex):
|
||||
shoegaze macOS guitar-pedalboard app (Xcode, .app)
|
||||
shoegaze-ios iOS guitar-pedalboard app (Xcode, .app)
|
||||
macos-ui-xcode macOS @UIParam synth app
|
||||
ios-ui iOS @UIParam synth app
|
||||
auv3 AUv3 host + .appex
|
||||
@@ -240,8 +215,6 @@ struct LyrebirdCLIMain {
|
||||
--template <t> Template name (see above)
|
||||
--lyrebird-path <path> Use a local Lyrebird checkout instead of the
|
||||
published remote package URL
|
||||
--shoegaze-path <path> (shoegaze / shoegaze-ios) Use a local ShoeGaze
|
||||
checkout instead of the placeholder remote URL
|
||||
|
||||
Run `lyrebird` with no arguments for an interactive shell.
|
||||
""")
|
||||
|
||||
@@ -1,526 +0,0 @@
|
||||
// ProjectScaffolder+ShoeGazeIOS.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - shoegaze-ios template
|
||||
|
||||
extension ProjectScaffolder {
|
||||
|
||||
/// Write the full `shoegaze-ios` template tree at `projectRoot`.
|
||||
///
|
||||
/// Single iOS application target. SwiftUI `@main` entry point wired to
|
||||
/// `iOSAudioDriver` via `AVAudioSession`. Lyrebird + LyrebirdUI +
|
||||
/// LyrebirdShoeGaze + LyrebirdShoeGazeUI pulled in via SPM dependencies.
|
||||
/// A default board (Overdrive → Delay → Reverb → Modulation) fed by the
|
||||
/// built-in test loop is constructed at launch inside an `@Observable`
|
||||
/// `AppModel`.
|
||||
static func writeShoeGazeIOSFiles(
|
||||
name: String,
|
||||
projectRoot: String,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String?,
|
||||
fm: FileManager
|
||||
) throws {
|
||||
let appGroupDir: String = (projectRoot as NSString).appendingPathComponent(name)
|
||||
let xcodeprojDir: String = (projectRoot as NSString).appendingPathComponent("\(name).xcodeproj")
|
||||
let schemeDir: String = (xcodeprojDir as NSString)
|
||||
.appendingPathComponent("xcshareddata/xcschemes")
|
||||
|
||||
for dir: String in [appGroupDir, xcodeprojDir, schemeDir] {
|
||||
do {
|
||||
try fm.createDirectory(atPath: dir,
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil)
|
||||
} catch {
|
||||
try? fm.removeItem(atPath: projectRoot)
|
||||
throw Error.fileSystemError(path: dir, reason: error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
let files: [(String, String)] = [
|
||||
((appGroupDir as NSString).appendingPathComponent("Info.plist"),
|
||||
iOSAppInfoPlist(name: name)),
|
||||
((appGroupDir as NSString).appendingPathComponent("\(name)App.swift"),
|
||||
shoegazeIOSAppSwift(name: name)),
|
||||
((appGroupDir as NSString).appendingPathComponent("\(name)AppModel.swift"),
|
||||
shoegazeIOSAppModelSwift(name: name)),
|
||||
((xcodeprojDir as NSString).appendingPathComponent("project.pbxproj"),
|
||||
shoegazeIOSPBXProj(name: name,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath)),
|
||||
((schemeDir as NSString).appendingPathComponent("\(name).xcscheme"),
|
||||
appScheme(name: name, productExtension: "app")),
|
||||
]
|
||||
try writeFiles(files, fm: fm, projectRoot: projectRoot)
|
||||
}
|
||||
|
||||
// MARK: - Source files
|
||||
|
||||
/// `<name>App.swift` — SwiftUI `@main` entry point for the shoegaze-ios template.
|
||||
///
|
||||
/// Emitted source must not contain the Lyrebird MIT copyright header.
|
||||
static func shoegazeIOSAppSwift(name: String) -> String {
|
||||
"""
|
||||
// \(name) — entry point
|
||||
import SwiftUI
|
||||
import LyrebirdShoeGazeUI
|
||||
|
||||
@main
|
||||
struct \(name)App: App {
|
||||
@State private var model: \(name)AppModel = \(name)AppModel()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
NavigationStack {
|
||||
ScrollView {
|
||||
ShoeGazeView(shoeGaze: model.shoeGaze)
|
||||
.padding(.horizontal, 12)
|
||||
}
|
||||
.navigationTitle("\(name)")
|
||||
}
|
||||
.onAppear { model.start() }
|
||||
.onDisappear { model.stop() }
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
/// `<name>AppModel.swift` — `@Observable` model owning the engine and `ShoeGaze`.
|
||||
///
|
||||
/// Emitted source must not contain the Lyrebird MIT copyright header.
|
||||
static func shoegazeIOSAppModelSwift(name: String) -> String {
|
||||
let blockSize: Int = scaffoldDefaultBlockSize
|
||||
let outputChannels: Int = scaffoldDefaultOutputChannels
|
||||
return """
|
||||
// \(name)AppModel.swift
|
||||
import AVFoundation
|
||||
import Observation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdShoeGaze
|
||||
|
||||
/// Owns the `SynthesisEngine` and `ShoeGaze` manager for \(name).
|
||||
///
|
||||
/// Call `start()` when the root view appears and `stop()` when it disappears.
|
||||
/// The engine uses the hardware sample rate from `AVAudioSession` so pitch
|
||||
/// and timing are accurate on all iOS devices.
|
||||
@Observable
|
||||
@MainActor
|
||||
final class \(name)AppModel {
|
||||
|
||||
private(set) var shoeGaze: ShoeGaze
|
||||
private let engine: SynthesisEngine
|
||||
|
||||
init() {
|
||||
// Activate the session before querying `sampleRate` so the
|
||||
// hardware rate is known (iOS locks to 48 000 Hz on most devices
|
||||
// regardless of the preferred rate).
|
||||
let session: AVAudioSession = AVAudioSession.sharedInstance()
|
||||
try? session.setCategory(.playback, mode: .default)
|
||||
try? session.setActive(true)
|
||||
let sampleRate: Double = session.sampleRate
|
||||
|
||||
let eng: SynthesisEngine = SynthesisEngine(
|
||||
blockSize: \(blockSize),
|
||||
sampleRate: sampleRate,
|
||||
numOutputChannels: \(outputChannels),
|
||||
numInputChannels: 0,
|
||||
driver: iOSAudioDriver()
|
||||
)
|
||||
self.engine = eng
|
||||
self.shoeGaze = ShoeGaze(engine: eng)
|
||||
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try board.add(DelayPedal())
|
||||
try board.add(ReverbPedal())
|
||||
try board.add(ModulationPedal())
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
} catch {
|
||||
print("[\(name)] board build failed: \\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/// Start the audio engine. Call from `.onAppear`.
|
||||
func start() {
|
||||
do {
|
||||
try engine.start()
|
||||
} catch {
|
||||
print("[\(name)] engine.start failed: \\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/// Stop the audio engine. Call from `.onDisappear`.
|
||||
func stop() {
|
||||
engine.stop()
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - pbxproj
|
||||
|
||||
/// `project.pbxproj` for the `shoegaze-ios` template.
|
||||
///
|
||||
/// Identical in structure to the `ios-ui` pbxproj but:
|
||||
/// - Declares two source files (`<name>App.swift` + `<name>AppModel.swift`)
|
||||
/// using the `sg`-prefixed UUID constants so they don't collide with the
|
||||
/// `ios-ui` constants.
|
||||
/// - References three SPM products: `LyrebirdUI`, `LyrebirdShoeGaze`, and
|
||||
/// `LyrebirdShoeGazeUI` — the last two from a second package reference
|
||||
/// pointing at the ShoeGaze package.
|
||||
static func shoegazeIOSPBXProj(
|
||||
name: String,
|
||||
lyrebirdPath: String? = nil,
|
||||
shoegazePath: String? = nil
|
||||
) -> String {
|
||||
let bundleID: String = "\(defaultBundleIdentifierPrefix).\(name)"
|
||||
let lyrebirdRefLabel: String = pbxPackageReferenceLabel(lyrebirdPath: lyrebirdPath)
|
||||
let lyrebirdRefSection: String = pbxPackageReferenceSection(lyrebirdPath: lyrebirdPath)
|
||||
let shoegazeRefLabel: String = shoegazePackageReferenceLabel(shoegazePath: shoegazePath)
|
||||
let shoegazeRefSection: String = shoegazePackageReferenceSection(shoegazePath: shoegazePath)
|
||||
|
||||
return """
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
\tarchiveVersion = 1;
|
||||
\tclasses = {
|
||||
\t};
|
||||
\tobjectVersion = 60;
|
||||
\tobjects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
\t\t\(pbxSGAppFileBuild) /* \(name)App.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGAppFileRef) /* \(name)App.swift */; };
|
||||
\t\t\(pbxSGAppModelBuild) /* \(name)AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGAppModelRef) /* \(name)AppModel.swift */; };
|
||||
\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxLyrebirdUIProductDep) /* LyrebirdUI */; };
|
||||
\t\t\(pbxSGShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGShoeGazeDep) /* LyrebirdShoeGaze */; };
|
||||
\t\t\(pbxSGShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGShoeGazeUIDep) /* LyrebirdShoeGazeUI */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
\t\t\(pbxAppProductRef) /* \(name).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = \(name).app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
\t\t\(pbxInfoPlistRef) /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
\t\t\(pbxSGAppFileRef) /* \(name)App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)App.swift; sourceTree = "<group>"; };
|
||||
\t\t\(pbxSGAppModelRef) /* \(name)AppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)AppModel.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
\t\t\(pbxFrameworksPhase) /* Frameworks */ = {
|
||||
\t\t\tisa = PBXFrameworksBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */,
|
||||
\t\t\t\t\(pbxSGShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */,
|
||||
\t\t\t\t\(pbxSGShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */,
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
\t\t\(pbxMainGroup) = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxAppGroup) /* \(name) */,
|
||||
\t\t\t\t\(pbxProductsGroup) /* Products */,
|
||||
\t\t\t);
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
\t\t\(pbxProductsGroup) /* Products */ = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxAppProductRef) /* \(name).app */,
|
||||
\t\t\t);
|
||||
\t\t\tname = Products;
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
\t\t\(pbxAppGroup) /* \(name) */ = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxSGAppFileRef) /* \(name)App.swift */,
|
||||
\t\t\t\t\(pbxSGAppModelRef) /* \(name)AppModel.swift */,
|
||||
\t\t\t\t\(pbxInfoPlistRef) /* Info.plist */,
|
||||
\t\t\t);
|
||||
\t\t\tpath = \(name);
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
\t\t\(pbxBlueprintIDApp) /* \(name) */ = {
|
||||
\t\t\tisa = PBXNativeTarget;
|
||||
\t\t\tbuildConfigurationList = \(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */;
|
||||
\t\t\tbuildPhases = (
|
||||
\t\t\t\t\(pbxSourcesPhase) /* Sources */,
|
||||
\t\t\t\t\(pbxFrameworksPhase) /* Frameworks */,
|
||||
\t\t\t\t\(pbxResourcesPhase) /* Resources */,
|
||||
\t\t\t);
|
||||
\t\t\tbuildRules = (
|
||||
\t\t\t);
|
||||
\t\t\tdependencies = (
|
||||
\t\t\t);
|
||||
\t\t\tname = \(name);
|
||||
\t\t\tpackageProductDependencies = (
|
||||
\t\t\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */,
|
||||
\t\t\t\t\(pbxSGShoeGazeDep) /* LyrebirdShoeGaze */,
|
||||
\t\t\t\t\(pbxSGShoeGazeUIDep) /* LyrebirdShoeGazeUI */,
|
||||
\t\t\t);
|
||||
\t\t\tproductName = \(name);
|
||||
\t\t\tproductReference = \(pbxAppProductRef) /* \(name).app */;
|
||||
\t\t\tproductType = "com.apple.product-type.application";
|
||||
\t\t};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
\t\t\(pbxRootObject) /* Project object */ = {
|
||||
\t\t\tisa = PBXProject;
|
||||
\t\t\tattributes = {
|
||||
\t\t\t\tBuildIndependentTargetsInParallel = 1;
|
||||
\t\t\t\tLastSwiftUpdateCheck = 1600;
|
||||
\t\t\t\tLastUpgradeCheck = 1600;
|
||||
\t\t\t\tTargetAttributes = {
|
||||
\t\t\t\t\t\(pbxBlueprintIDApp) = {
|
||||
\t\t\t\t\t\tCreatedOnToolsVersion = 16.0;
|
||||
\t\t\t\t\t};
|
||||
\t\t\t\t};
|
||||
\t\t\t};
|
||||
\t\t\tbuildConfigurationList = \(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */;
|
||||
\t\t\tcompatibilityVersion = "Xcode 14.0";
|
||||
\t\t\tdevelopmentRegion = en;
|
||||
\t\t\thasScannedForEncodings = 0;
|
||||
\t\t\tknownRegions = (
|
||||
\t\t\t\ten,
|
||||
\t\t\t\tBase,
|
||||
\t\t\t);
|
||||
\t\t\tmainGroup = \(pbxMainGroup);
|
||||
\t\t\tpackageReferences = (
|
||||
\t\t\t\t\(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */,
|
||||
\t\t\t\t\(pbxSGShoeGazePackageRef) /* \(shoegazeRefLabel) */,
|
||||
\t\t\t);
|
||||
\t\t\tproductRefGroup = \(pbxProductsGroup) /* Products */;
|
||||
\t\t\tprojectDirPath = "";
|
||||
\t\t\tprojectRoot = "";
|
||||
\t\t\ttargets = (
|
||||
\t\t\t\t\(pbxBlueprintIDApp) /* \(name) */,
|
||||
\t\t\t);
|
||||
\t\t};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
\t\t\(pbxResourcesPhase) /* Resources */ = {
|
||||
\t\t\tisa = PBXResourcesBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
\t\t\(pbxSourcesPhase) /* Sources */ = {
|
||||
\t\t\tisa = PBXSourcesBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t\t\(pbxSGAppFileBuild) /* \(name)App.swift in Sources */,
|
||||
\t\t\t\t\(pbxSGAppModelBuild) /* \(name)AppModel.swift in Sources */,
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
\t\t\(pbxAppDebugConfig) /* Debug */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tCODE_SIGN_STYLE = Automatic;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
|
||||
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
|
||||
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
|
||||
\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
|
||||
\t\t\t\t\t"$(inherited)",
|
||||
\t\t\t\t\t"@executable_path/Frameworks",
|
||||
\t\t\t\t);
|
||||
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
|
||||
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
|
||||
\t\t\t\tSWIFT_VERSION = 6.0;
|
||||
\t\t\t\tTARGETED_DEVICE_FAMILY = "1,2";
|
||||
\t\t\t};
|
||||
\t\t\tname = Debug;
|
||||
\t\t};
|
||||
\t\t\(pbxAppReleaseConfig) /* Release */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tCODE_SIGN_STYLE = Automatic;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
|
||||
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
|
||||
\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
|
||||
\t\t\t\t\t"$(inherited)",
|
||||
\t\t\t\t\t"@executable_path/Frameworks",
|
||||
\t\t\t\t);
|
||||
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
|
||||
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
|
||||
\t\t\t\tSWIFT_VERSION = 6.0;
|
||||
\t\t\t\tTARGETED_DEVICE_FAMILY = "1,2";
|
||||
\t\t\t};
|
||||
\t\t\tname = Release;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectDebugConfig) /* Debug */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
|
||||
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
|
||||
\t\t\t\tCOPY_PHASE_STRIP = NO;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
|
||||
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
\t\t\t\tENABLE_TESTABILITY = YES;
|
||||
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
|
||||
\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;
|
||||
\t\t\t\tONLY_ACTIVE_ARCH = YES;
|
||||
\t\t\t\tSDKROOT = iphoneos;
|
||||
\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
\t\t\t};
|
||||
\t\t\tname = Debug;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectReleaseConfig) /* Release */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
|
||||
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
|
||||
\t\t\t\tCOPY_PHASE_STRIP = NO;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
\t\t\t\tENABLE_NS_ASSERTIONS = NO;
|
||||
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
|
||||
\t\t\t\tSDKROOT = iphoneos;
|
||||
\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;
|
||||
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
\t\t\t};
|
||||
\t\t\tname = Release;
|
||||
\t\t};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
\t\t\(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */ = {
|
||||
\t\t\tisa = XCConfigurationList;
|
||||
\t\t\tbuildConfigurations = (
|
||||
\t\t\t\t\(pbxAppDebugConfig) /* Debug */,
|
||||
\t\t\t\t\(pbxAppReleaseConfig) /* Release */,
|
||||
\t\t\t);
|
||||
\t\t\tdefaultConfigurationIsVisible = 0;
|
||||
\t\t\tdefaultConfigurationName = Release;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */ = {
|
||||
\t\t\tisa = XCConfigurationList;
|
||||
\t\t\tbuildConfigurations = (
|
||||
\t\t\t\t\(pbxProjectDebugConfig) /* Debug */,
|
||||
\t\t\t\t\(pbxProjectReleaseConfig) /* Release */,
|
||||
\t\t\t);
|
||||
\t\t\tdefaultConfigurationIsVisible = 0;
|
||||
\t\t\tdefaultConfigurationName = Release;
|
||||
\t\t};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
\(lyrebirdRefSection)
|
||||
|
||||
\(shoegazeRefSection)
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdUI;
|
||||
\t\t};
|
||||
\t\t\(pbxSGShoeGazeDep) /* LyrebirdShoeGaze */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxSGShoeGazePackageRef) /* \(shoegazeRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdShoeGaze;
|
||||
\t\t};
|
||||
\t\t\(pbxSGShoeGazeUIDep) /* LyrebirdShoeGazeUI */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxSGShoeGazePackageRef) /* \(shoegazeRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdShoeGazeUI;
|
||||
\t\t};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
\t};
|
||||
\trootObject = \(pbxRootObject) /* Project object */;
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - ShoeGaze package reference helpers
|
||||
|
||||
/// pbxproj snippet for the ShoeGaze SPM package reference. Emits either an
|
||||
/// `XCRemoteSwiftPackageReference` (when `shoegazePath == nil`) or an
|
||||
/// `XCLocalSwiftPackageReference` pointing at the absolute path.
|
||||
static func shoegazePackageReferenceSection(shoegazePath: String?) -> String {
|
||||
if let path: String = shoegazePath {
|
||||
let escaped: String = pbxQuoteEscape(path)
|
||||
return """
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
\t\t\(pbxSGShoeGazePackageRef) /* XCLocalSwiftPackageReference "shoegaze" */ = {
|
||||
\t\t\tisa = XCLocalSwiftPackageReference;
|
||||
\t\t\trelativePath = "\(escaped)";
|
||||
\t\t};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
"""
|
||||
} else {
|
||||
return """
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
\t\t\(pbxSGShoeGazePackageRef) /* XCRemoteSwiftPackageReference "shoegaze" */ = {
|
||||
\t\t\tisa = XCRemoteSwiftPackageReference;
|
||||
\t\t\trepositoryURL = "\(shoegazePackageURL)";
|
||||
\t\t\trequirement = {
|
||||
\t\t\t\tkind = upToNextMajorVersion;
|
||||
\t\t\t\tminimumVersion = \(shoegazeMinimumVersion);
|
||||
\t\t\t};
|
||||
\t\t};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
/// Comment label used in pbxproj for the ShoeGaze package reference.
|
||||
static func shoegazePackageReferenceLabel(shoegazePath: String?) -> String {
|
||||
shoegazePath == nil
|
||||
? #"XCRemoteSwiftPackageReference "shoegaze""#
|
||||
: #"XCLocalSwiftPackageReference "shoegaze""#
|
||||
}
|
||||
|
||||
// MARK: - shoegaze-ios PBX UUID constants
|
||||
//
|
||||
// All UUIDs in the `0x03xx` range — no collision with ios-ui (`0x02xx`),
|
||||
// macos-ui-xcode (`0x01xx`), or auv3 (`0x03Axx` / `0x03xx` note: auv3
|
||||
// uses `0x03A0`–`0x03A8`, so shoegaze-ios uses `0x03B0`–`0x03B8`).
|
||||
|
||||
/// `<name>App.swift` file reference UUID.
|
||||
static let pbxSGAppFileRef: String = "AABB000000000000000003B0"
|
||||
/// `<name>App.swift` build file UUID.
|
||||
static let pbxSGAppFileBuild: String = "AABB000000000000000003B1"
|
||||
/// `<name>AppModel.swift` file reference UUID.
|
||||
static let pbxSGAppModelRef: String = "AABB000000000000000003B2"
|
||||
/// `<name>AppModel.swift` build file UUID.
|
||||
static let pbxSGAppModelBuild: String = "AABB000000000000000003B3"
|
||||
/// Package reference UUID for the ShoeGaze SPM package.
|
||||
static let pbxSGShoeGazePackageRef: String = "AABB000000000000000003B4"
|
||||
/// Product dependency UUID for `LyrebirdShoeGaze`.
|
||||
static let pbxSGShoeGazeDep: String = "AABB000000000000000003B5"
|
||||
/// Build file UUID for `LyrebirdShoeGaze` in Frameworks.
|
||||
static let pbxSGShoeGazeBuild: String = "AABB000000000000000003B6"
|
||||
/// Product dependency UUID for `LyrebirdShoeGazeUI`.
|
||||
static let pbxSGShoeGazeUIDep: String = "AABB000000000000000003B7"
|
||||
/// Build file UUID for `LyrebirdShoeGazeUI` in Frameworks.
|
||||
static let pbxSGShoeGazeUIBuild: String = "AABB000000000000000003B8"
|
||||
}
|
||||
@@ -1,610 +0,0 @@
|
||||
// ProjectScaffolder+ShoeGazeMacOS.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - shoegaze (macOS Xcode app) template
|
||||
|
||||
extension ProjectScaffolder {
|
||||
|
||||
/// Write the full `shoegaze` macOS app template tree at `projectRoot`.
|
||||
///
|
||||
/// Single macOS application target. SwiftUI `@main` entry point wired to
|
||||
/// `CoreAudioDriver`. Lyrebird + LyrebirdUI + LyrebirdShoeGaze +
|
||||
/// LyrebirdShoeGazeUI pulled in via SPM dependencies. A default board
|
||||
/// (Overdrive → Delay → Reverb → Modulation) fed by the built-in test loop
|
||||
/// is constructed at launch inside an `@Observable` `AppModel`.
|
||||
///
|
||||
/// An **Audio** menu with **Mute ⌘M** is added via `.commands`. Quit ⌘Q is
|
||||
/// standard in SwiftUI App and requires no extra code. Recording (Choose
|
||||
/// Folder / Record / Stop) is already provided by `ShoeGazeView`.
|
||||
static func writeShoeGazeMacOSFiles(
|
||||
name: String,
|
||||
projectRoot: String,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String?,
|
||||
fm: FileManager
|
||||
) throws {
|
||||
let appGroupDir: String = (projectRoot as NSString).appendingPathComponent(name)
|
||||
let xcodeprojDir: String = (projectRoot as NSString).appendingPathComponent("\(name).xcodeproj")
|
||||
let schemeDir: String = (xcodeprojDir as NSString)
|
||||
.appendingPathComponent("xcshareddata/xcschemes")
|
||||
|
||||
for dir: String in [appGroupDir, xcodeprojDir, schemeDir] {
|
||||
do {
|
||||
try fm.createDirectory(atPath: dir,
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil)
|
||||
} catch {
|
||||
try? fm.removeItem(atPath: projectRoot)
|
||||
throw Error.fileSystemError(path: dir, reason: error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
let files: [(String, String)] = [
|
||||
((appGroupDir as NSString).appendingPathComponent("Info.plist"),
|
||||
shoegazeMacOSInfoPlist(name: name)),
|
||||
((appGroupDir as NSString).appendingPathComponent("\(name)App.swift"),
|
||||
shoegazeMacOSAppSwift(name: name)),
|
||||
((appGroupDir as NSString).appendingPathComponent("\(name)AppModel.swift"),
|
||||
shoegazeMacOSAppModelSwift(name: name)),
|
||||
((xcodeprojDir as NSString).appendingPathComponent("project.pbxproj"),
|
||||
shoegazeMacOSPBXProj(name: name,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath)),
|
||||
((schemeDir as NSString).appendingPathComponent("\(name).xcscheme"),
|
||||
appScheme(name: name, productExtension: "app")),
|
||||
]
|
||||
try writeFiles(files, fm: fm, projectRoot: projectRoot)
|
||||
}
|
||||
|
||||
// MARK: - Source files
|
||||
|
||||
/// `Info.plist` for the shoegaze macOS app.
|
||||
///
|
||||
/// Extends the standard macOS plist with `NSMicrophoneUsageDescription`
|
||||
/// (required when switching to `.liveInput`), `NSHighResolutionCapable`,
|
||||
/// and `LSApplicationCategoryType` set to music.
|
||||
static func shoegazeMacOSInfoPlist(name: String) -> String {
|
||||
let bundleIdSetting: String = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
||||
let bundleNameSetting: String = "$(PRODUCT_NAME)"
|
||||
let executableNameSetting: String = "$(EXECUTABLE_NAME)"
|
||||
let deploymentTargetSetting: String = "$(MACOSX_DEPLOYMENT_TARGET)"
|
||||
return """
|
||||
<?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>\(executableNameSetting)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>\(bundleIdSetting)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>\(bundleNameSetting)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.music</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>\(deploymentTargetSetting)</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>\(name) requires microphone access for live guitar and audio input.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © \(currentYearString()) \(name). All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
"""
|
||||
}
|
||||
|
||||
/// `<name>App.swift` — SwiftUI `@main` entry point for the shoegaze macOS template.
|
||||
///
|
||||
/// Emitted source must not contain the Lyrebird MIT copyright header.
|
||||
static func shoegazeMacOSAppSwift(name: String) -> String {
|
||||
"""
|
||||
// \(name) — entry point
|
||||
import SwiftUI
|
||||
import LyrebirdShoeGazeUI
|
||||
|
||||
@main
|
||||
struct \(name)App: App {
|
||||
@State private var model: \(name)AppModel = \(name)AppModel()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ShoeGazeView(shoeGaze: model.shoeGaze)
|
||||
.frame(minWidth: 960, minHeight: 480)
|
||||
.onAppear { model.start() }
|
||||
.onDisappear { model.stop() }
|
||||
}
|
||||
.commands {
|
||||
CommandMenu("Audio") {
|
||||
Button(model.muted ? "Unmute" : "Mute") {
|
||||
model.toggleMute()
|
||||
}
|
||||
.keyboardShortcut("m", modifiers: .command)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
/// `<name>AppModel.swift` — `@Observable` model owning the engine and `ShoeGaze`.
|
||||
///
|
||||
/// Emitted source must not contain the Lyrebird MIT copyright header.
|
||||
static func shoegazeMacOSAppModelSwift(name: String) -> String {
|
||||
let blockSize: Int = scaffoldDefaultBlockSize
|
||||
let sampleRate: Double = 48_000.0
|
||||
let outputChannels: Int = scaffoldDefaultOutputChannels
|
||||
let audioBusCount: Int = 256
|
||||
return """
|
||||
// \(name)AppModel.swift
|
||||
import Observation
|
||||
import LyrebirdSynth
|
||||
import LyrebirdShoeGaze
|
||||
|
||||
/// Owns the `SynthesisEngine` and `ShoeGaze` manager for \(name).
|
||||
///
|
||||
/// Call `start()` when the root view appears and `stop()` when it disappears.
|
||||
/// `toggleMute()` stops and restarts the engine, providing a click-free
|
||||
/// silence while parameters remain live.
|
||||
@Observable
|
||||
@MainActor
|
||||
final class \(name)AppModel {
|
||||
|
||||
private(set) var shoeGaze: ShoeGaze
|
||||
private(set) var muted: Bool = false
|
||||
private let engine: SynthesisEngine
|
||||
|
||||
init() {
|
||||
let eng: SynthesisEngine = SynthesisEngine(
|
||||
blockSize: \(blockSize),
|
||||
sampleRate: \(sampleRate),
|
||||
numOutputChannels: \(outputChannels),
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: \(audioBusCount),
|
||||
driver: CoreAudioDriver()
|
||||
)
|
||||
self.engine = eng
|
||||
self.shoeGaze = ShoeGaze(engine: eng)
|
||||
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try board.add(DelayPedal())
|
||||
try board.add(ReverbPedal())
|
||||
try board.add(ModulationPedal())
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
} catch {
|
||||
print("[\(name)] board build failed: \\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/// Start the audio engine. Call from `.onAppear`.
|
||||
func start() {
|
||||
guard !muted else { return }
|
||||
do {
|
||||
try engine.start()
|
||||
} catch {
|
||||
print("[\(name)] engine.start failed: \\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/// Stop the audio engine. Call from `.onDisappear`.
|
||||
func stop() {
|
||||
engine.stop()
|
||||
}
|
||||
|
||||
/// Toggle mute by stopping/starting the engine.
|
||||
func toggleMute() {
|
||||
if muted {
|
||||
muted = false
|
||||
do {
|
||||
try engine.start()
|
||||
} catch {
|
||||
print("[\(name)] engine.start (unmute) failed: \\(error)")
|
||||
}
|
||||
} else {
|
||||
engine.stop()
|
||||
muted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - pbxproj
|
||||
|
||||
/// `project.pbxproj` for the `shoegaze` macOS app template.
|
||||
///
|
||||
/// Structure mirrors `shoegazeIOSPBXProj` but uses `SDKROOT = macosx`,
|
||||
/// `MACOSX_DEPLOYMENT_TARGET = 15.0`, macOS-style `LD_RUNPATH_SEARCH_PATHS`,
|
||||
/// `ENABLE_HARDENED_RUNTIME`, `COMBINE_HIDPI_IMAGES`, and `DEAD_CODE_STRIPPING`.
|
||||
/// UUIDs are in the `0x03Cxx` range — no collision with ios-ui (`0x02xx`),
|
||||
/// macos-ui-xcode (`0x01xx`), auv3 (`0x03Axx`), or shoegaze-ios (`0x03Bxx`).
|
||||
/// Depends on four SPM products: `Lyrebird`, `LyrebirdUI`, `LyrebirdShoeGaze`,
|
||||
/// `LyrebirdShoeGazeUI`.
|
||||
static func shoegazeMacOSPBXProj(
|
||||
name: String,
|
||||
lyrebirdPath: String? = nil,
|
||||
shoegazePath: String? = nil
|
||||
) -> String {
|
||||
let bundleID: String = "\(defaultBundleIdentifierPrefix).\(name)"
|
||||
let lyrebirdRefLabel: String = pbxPackageReferenceLabel(lyrebirdPath: lyrebirdPath)
|
||||
let lyrebirdRefSection: String = pbxPackageReferenceSection(lyrebirdPath: lyrebirdPath)
|
||||
let shoegazeRefLabel: String = shoegazeMacOSPackageReferenceLabel(shoegazePath: shoegazePath)
|
||||
let shoegazeRefSection: String = shoegazeMacOSPackageReferenceSection(shoegazePath: shoegazePath)
|
||||
|
||||
return """
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
\tarchiveVersion = 1;
|
||||
\tclasses = {
|
||||
\t};
|
||||
\tobjectVersion = 60;
|
||||
\tobjects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
\t\t\(pbxSGMacAppFileBuild) /* \(name)App.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGMacAppFileRef) /* \(name)App.swift */; };
|
||||
\t\t\(pbxSGMacAppModelBuild) /* \(name)AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGMacAppModelRef) /* \(name)AppModel.swift */; };
|
||||
\t\t\(pbxSGMacLyrebirdBuild) /* Lyrebird in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacLyrebirdDep) /* Lyrebird */; };
|
||||
\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxLyrebirdUIProductDep) /* LyrebirdUI */; };
|
||||
\t\t\(pbxSGMacShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */; };
|
||||
\t\t\(pbxSGMacShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
\t\t\(pbxAppProductRef) /* \(name).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = \(name).app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
\t\t\(pbxInfoPlistRef) /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
\t\t\(pbxSGMacAppFileRef) /* \(name)App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)App.swift; sourceTree = "<group>"; };
|
||||
\t\t\(pbxSGMacAppModelRef) /* \(name)AppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)AppModel.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
\t\t\(pbxFrameworksPhase) /* Frameworks */ = {
|
||||
\t\t\tisa = PBXFrameworksBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t\t\(pbxSGMacLyrebirdBuild) /* Lyrebird in Frameworks */,
|
||||
\t\t\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */,
|
||||
\t\t\t\t\(pbxSGMacShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */,
|
||||
\t\t\t\t\(pbxSGMacShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */,
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
\t\t\(pbxMainGroup) = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxAppGroup) /* \(name) */,
|
||||
\t\t\t\t\(pbxProductsGroup) /* Products */,
|
||||
\t\t\t);
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
\t\t\(pbxProductsGroup) /* Products */ = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxAppProductRef) /* \(name).app */,
|
||||
\t\t\t);
|
||||
\t\t\tname = Products;
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
\t\t\(pbxAppGroup) /* \(name) */ = {
|
||||
\t\t\tisa = PBXGroup;
|
||||
\t\t\tchildren = (
|
||||
\t\t\t\t\(pbxSGMacAppFileRef) /* \(name)App.swift */,
|
||||
\t\t\t\t\(pbxSGMacAppModelRef) /* \(name)AppModel.swift */,
|
||||
\t\t\t\t\(pbxInfoPlistRef) /* Info.plist */,
|
||||
\t\t\t);
|
||||
\t\t\tpath = \(name);
|
||||
\t\t\tsourceTree = "<group>";
|
||||
\t\t};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
\t\t\(pbxBlueprintIDApp) /* \(name) */ = {
|
||||
\t\t\tisa = PBXNativeTarget;
|
||||
\t\t\tbuildConfigurationList = \(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */;
|
||||
\t\t\tbuildPhases = (
|
||||
\t\t\t\t\(pbxSourcesPhase) /* Sources */,
|
||||
\t\t\t\t\(pbxFrameworksPhase) /* Frameworks */,
|
||||
\t\t\t\t\(pbxResourcesPhase) /* Resources */,
|
||||
\t\t\t);
|
||||
\t\t\tbuildRules = (
|
||||
\t\t\t);
|
||||
\t\t\tdependencies = (
|
||||
\t\t\t);
|
||||
\t\t\tname = \(name);
|
||||
\t\t\tpackageProductDependencies = (
|
||||
\t\t\t\t\(pbxSGMacLyrebirdDep) /* Lyrebird */,
|
||||
\t\t\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */,
|
||||
\t\t\t\t\(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */,
|
||||
\t\t\t\t\(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */,
|
||||
\t\t\t);
|
||||
\t\t\tproductName = \(name);
|
||||
\t\t\tproductReference = \(pbxAppProductRef) /* \(name).app */;
|
||||
\t\t\tproductType = "com.apple.product-type.application";
|
||||
\t\t};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
\t\t\(pbxRootObject) /* Project object */ = {
|
||||
\t\t\tisa = PBXProject;
|
||||
\t\t\tattributes = {
|
||||
\t\t\t\tBuildIndependentTargetsInParallel = 1;
|
||||
\t\t\t\tLastSwiftUpdateCheck = 1600;
|
||||
\t\t\t\tLastUpgradeCheck = 1600;
|
||||
\t\t\t\tTargetAttributes = {
|
||||
\t\t\t\t\t\(pbxBlueprintIDApp) = {
|
||||
\t\t\t\t\t\tCreatedOnToolsVersion = 16.0;
|
||||
\t\t\t\t\t};
|
||||
\t\t\t\t};
|
||||
\t\t\t};
|
||||
\t\t\tbuildConfigurationList = \(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */;
|
||||
\t\t\tcompatibilityVersion = "Xcode 14.0";
|
||||
\t\t\tdevelopmentRegion = en;
|
||||
\t\t\thasScannedForEncodings = 0;
|
||||
\t\t\tknownRegions = (
|
||||
\t\t\t\ten,
|
||||
\t\t\t\tBase,
|
||||
\t\t\t);
|
||||
\t\t\tmainGroup = \(pbxMainGroup);
|
||||
\t\t\tpackageReferences = (
|
||||
\t\t\t\t\(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */,
|
||||
\t\t\t\t\(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */,
|
||||
\t\t\t);
|
||||
\t\t\tproductRefGroup = \(pbxProductsGroup) /* Products */;
|
||||
\t\t\tprojectDirPath = "";
|
||||
\t\t\tprojectRoot = "";
|
||||
\t\t\ttargets = (
|
||||
\t\t\t\t\(pbxBlueprintIDApp) /* \(name) */,
|
||||
\t\t\t);
|
||||
\t\t};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
\t\t\(pbxResourcesPhase) /* Resources */ = {
|
||||
\t\t\tisa = PBXResourcesBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
\t\t\(pbxSourcesPhase) /* Sources */ = {
|
||||
\t\t\tisa = PBXSourcesBuildPhase;
|
||||
\t\t\tbuildActionMask = \(pbxBuildActionMask);
|
||||
\t\t\tfiles = (
|
||||
\t\t\t\t\(pbxSGMacAppFileBuild) /* \(name)App.swift in Sources */,
|
||||
\t\t\t\t\(pbxSGMacAppModelBuild) /* \(name)AppModel.swift in Sources */,
|
||||
\t\t\t);
|
||||
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
||||
\t\t};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
\t\t\(pbxAppDebugConfig) /* Debug */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tCODE_SIGN_STYLE = Automatic;
|
||||
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
|
||||
\t\t\t\tDEAD_CODE_STRIPPING = YES;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
|
||||
\t\t\t\tENABLE_HARDENED_RUNTIME = YES;
|
||||
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
|
||||
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
|
||||
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
|
||||
\t\t\t\t\t"$(inherited)",
|
||||
\t\t\t\t\t"@executable_path/../Frameworks",
|
||||
\t\t\t\t);
|
||||
\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 15.0;
|
||||
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
|
||||
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
|
||||
\t\t\t\tSWIFT_VERSION = 6.0;
|
||||
\t\t\t};
|
||||
\t\t\tname = Debug;
|
||||
\t\t};
|
||||
\t\t\(pbxAppReleaseConfig) /* Release */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tCODE_SIGN_STYLE = Automatic;
|
||||
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
|
||||
\t\t\t\tDEAD_CODE_STRIPPING = YES;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
\t\t\t\tENABLE_HARDENED_RUNTIME = YES;
|
||||
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
|
||||
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
|
||||
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
|
||||
\t\t\t\t\t"$(inherited)",
|
||||
\t\t\t\t\t"@executable_path/../Frameworks",
|
||||
\t\t\t\t);
|
||||
\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 15.0;
|
||||
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
|
||||
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
|
||||
\t\t\t\tSWIFT_VERSION = 6.0;
|
||||
\t\t\t};
|
||||
\t\t\tname = Release;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectDebugConfig) /* Debug */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
|
||||
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
|
||||
\t\t\t\tCOPY_PHASE_STRIP = NO;
|
||||
\t\t\t\tDEAD_CODE_STRIPPING = YES;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
|
||||
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
\t\t\t\tENABLE_TESTABILITY = YES;
|
||||
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
|
||||
\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;
|
||||
\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (
|
||||
\t\t\t\t\t"DEBUG=1",
|
||||
\t\t\t\t\t"$(inherited)",
|
||||
\t\t\t\t);
|
||||
\t\t\t\tONLY_ACTIVE_ARCH = YES;
|
||||
\t\t\t\tSDKROOT = macosx;
|
||||
\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
\t\t\t};
|
||||
\t\t\tname = Debug;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectReleaseConfig) /* Release */ = {
|
||||
\t\t\tisa = XCBuildConfiguration;
|
||||
\t\t\tbuildSettings = {
|
||||
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
|
||||
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
|
||||
\t\t\t\tCOPY_PHASE_STRIP = NO;
|
||||
\t\t\t\tDEAD_CODE_STRIPPING = YES;
|
||||
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
\t\t\t\tENABLE_NS_ASSERTIONS = NO;
|
||||
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
|
||||
\t\t\t\tSDKROOT = macosx;
|
||||
\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;
|
||||
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
\t\t\t};
|
||||
\t\t\tname = Release;
|
||||
\t\t};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
\t\t\(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */ = {
|
||||
\t\t\tisa = XCConfigurationList;
|
||||
\t\t\tbuildConfigurations = (
|
||||
\t\t\t\t\(pbxAppDebugConfig) /* Debug */,
|
||||
\t\t\t\t\(pbxAppReleaseConfig) /* Release */,
|
||||
\t\t\t);
|
||||
\t\t\tdefaultConfigurationIsVisible = 0;
|
||||
\t\t\tdefaultConfigurationName = Release;
|
||||
\t\t};
|
||||
\t\t\(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */ = {
|
||||
\t\t\tisa = XCConfigurationList;
|
||||
\t\t\tbuildConfigurations = (
|
||||
\t\t\t\t\(pbxProjectDebugConfig) /* Debug */,
|
||||
\t\t\t\t\(pbxProjectReleaseConfig) /* Release */,
|
||||
\t\t\t);
|
||||
\t\t\tdefaultConfigurationIsVisible = 0;
|
||||
\t\t\tdefaultConfigurationName = Release;
|
||||
\t\t};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
\(lyrebirdRefSection)
|
||||
|
||||
\(shoegazeRefSection)
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
\t\t\(pbxSGMacLyrebirdDep) /* Lyrebird */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */;
|
||||
\t\t\tproductName = Lyrebird;
|
||||
\t\t};
|
||||
\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdUI;
|
||||
\t\t};
|
||||
\t\t\(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdShoeGaze;
|
||||
\t\t};
|
||||
\t\t\(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */ = {
|
||||
\t\t\tisa = XCSwiftPackageProductDependency;
|
||||
\t\t\tpackage = \(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */;
|
||||
\t\t\tproductName = LyrebirdShoeGazeUI;
|
||||
\t\t};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
\t};
|
||||
\trootObject = \(pbxRootObject) /* Project object */;
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - ShoeGaze macOS package reference helpers
|
||||
|
||||
/// pbxproj snippet for the ShoeGaze SPM package reference in the macOS template.
|
||||
/// Uses the macOS-specific `pbxSGMacShoeGazePackageRef` UUID so it doesn't
|
||||
/// collide with the iOS template's `pbxSGShoeGazePackageRef`.
|
||||
static func shoegazeMacOSPackageReferenceSection(shoegazePath: String?) -> String {
|
||||
if let path: String = shoegazePath {
|
||||
let escaped: String = pbxQuoteEscape(path)
|
||||
return """
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
\t\t\(pbxSGMacShoeGazePackageRef) /* XCLocalSwiftPackageReference "shoegaze" */ = {
|
||||
\t\t\tisa = XCLocalSwiftPackageReference;
|
||||
\t\t\trelativePath = "\(escaped)";
|
||||
\t\t};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
"""
|
||||
} else {
|
||||
return """
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
\t\t\(pbxSGMacShoeGazePackageRef) /* XCRemoteSwiftPackageReference "shoegaze" */ = {
|
||||
\t\t\tisa = XCRemoteSwiftPackageReference;
|
||||
\t\t\trepositoryURL = "\(shoegazePackageURL)";
|
||||
\t\t\trequirement = {
|
||||
\t\t\t\tkind = upToNextMajorVersion;
|
||||
\t\t\t\tminimumVersion = \(shoegazeMinimumVersion);
|
||||
\t\t\t};
|
||||
\t\t};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
/// Comment label used in pbxproj for the ShoeGaze package reference (macOS variant).
|
||||
static func shoegazeMacOSPackageReferenceLabel(shoegazePath: String?) -> String {
|
||||
shoegazePath == nil
|
||||
? #"XCRemoteSwiftPackageReference "shoegaze""#
|
||||
: #"XCLocalSwiftPackageReference "shoegaze""#
|
||||
}
|
||||
|
||||
// MARK: - shoegaze macOS PBX UUID constants
|
||||
//
|
||||
// All UUIDs in the `0x03Cxx` range — no collision with ios-ui (`0x02xx`),
|
||||
// macos-ui-xcode (`0x01xx`), auv3 (`0x03Axx`), or shoegaze-ios (`0x03Bxx`).
|
||||
|
||||
/// `<name>App.swift` file reference UUID.
|
||||
static let pbxSGMacAppFileRef: String = "AABB000000000000000003C0"
|
||||
/// `<name>App.swift` build file UUID.
|
||||
static let pbxSGMacAppFileBuild: String = "AABB000000000000000003C1"
|
||||
/// `<name>AppModel.swift` file reference UUID.
|
||||
static let pbxSGMacAppModelRef: String = "AABB000000000000000003C2"
|
||||
/// `<name>AppModel.swift` build file UUID.
|
||||
static let pbxSGMacAppModelBuild: String = "AABB000000000000000003C3"
|
||||
/// Package reference UUID for the ShoeGaze SPM package (macOS variant).
|
||||
static let pbxSGMacShoeGazePackageRef: String = "AABB000000000000000003C4"
|
||||
/// Product dependency UUID for `Lyrebird` (macOS shoegaze needs the core module).
|
||||
static let pbxSGMacLyrebirdDep: String = "AABB000000000000000003C5"
|
||||
/// Build file UUID for `Lyrebird` in Frameworks.
|
||||
static let pbxSGMacLyrebirdBuild: String = "AABB000000000000000003C6"
|
||||
/// Product dependency UUID for `LyrebirdShoeGaze`.
|
||||
static let pbxSGMacShoeGazeDep: String = "AABB000000000000000003C7"
|
||||
/// Build file UUID for `LyrebirdShoeGaze` in Frameworks.
|
||||
static let pbxSGMacShoeGazeBuild: String = "AABB000000000000000003C8"
|
||||
/// Product dependency UUID for `LyrebirdShoeGazeUI`.
|
||||
static let pbxSGMacShoeGazeUIDep: String = "AABB000000000000000003C9"
|
||||
/// Build file UUID for `LyrebirdShoeGazeUI` in Frameworks.
|
||||
static let pbxSGMacShoeGazeUIBuild: String = "AABB000000000000000003CA"
|
||||
}
|
||||
@@ -17,14 +17,6 @@ extension ProjectScaffolder {
|
||||
/// Lower bound on the Lyrebird version range — `upToNextMajorVersion`.
|
||||
public static let lyrebirdMinimumVersion: String = "1.0.0"
|
||||
|
||||
/// SPM URL placeholder for the ShoeGaze package. Substituted into
|
||||
/// generated `Package.swift` when `--shoegaze-path` is omitted.
|
||||
/// Replace with the real published URL once ShoeGaze is released.
|
||||
public static let shoegazePackageURL: String = "https://github.com/realizedsound/LyrebirdShoeGaze"
|
||||
|
||||
/// Lower bound on the ShoeGaze version range — `upToNextMajorVersion`.
|
||||
public static let shoegazeMinimumVersion: String = "1.0.0"
|
||||
|
||||
/// Bundle identifier prefix used in `PRODUCT_BUNDLE_IDENTIFIER`. The
|
||||
/// scaffolded value is `<prefix>.<name>`. Users typically rewrite this
|
||||
/// to their own reverse-DNS before shipping.
|
||||
|
||||
@@ -30,20 +30,6 @@ public enum ProjectTemplate: String, CaseIterable, Equatable {
|
||||
/// AUv3 host `.app` + `aumu` plugin extension wrapping a Lyrebird synth.
|
||||
/// Generates a full `<name>.xcodeproj` with two targets and entitlements files.
|
||||
case auv3 = "auv3"
|
||||
/// macOS guitar-pedalboard starter app built on `LyrebirdShoeGaze`.
|
||||
/// Generates a full `<name>.xcodeproj` with a SwiftUI `@main App` entry
|
||||
/// point, an `@Observable` app model wiring `CoreAudioDriver` + `ShoeGaze`,
|
||||
/// a root `ShoeGazeView`, and an **Audio ▸ Mute ⌘M** menu command.
|
||||
/// Requires `--shoegaze-path` (or a published ShoeGaze URL) in addition to
|
||||
/// the normal `--lyrebird-path`.
|
||||
case shoegaze = "shoegaze"
|
||||
/// iOS guitar-pedalboard starter app built on `LyrebirdShoeGaze`.
|
||||
/// Generates a full `<name>.xcodeproj` with a SwiftUI `@main App` entry
|
||||
/// point, an `@Observable` app model wiring `iOSAudioDriver` +
|
||||
/// `AVAudioSession` + `ShoeGaze`, and a root `ShoeGazeView`.
|
||||
/// Requires `--shoegaze-path` (or a published ShoeGaze URL) in addition to
|
||||
/// the normal `--lyrebird-path`.
|
||||
case shoegazeIOS = "shoegaze-ios"
|
||||
|
||||
/// Case-insensitive init from a raw string. Accepts hyphen-free aliases too.
|
||||
public init?(string: String) {
|
||||
@@ -60,10 +46,6 @@ public enum ProjectTemplate: String, CaseIterable, Equatable {
|
||||
self = .iosUI
|
||||
case "auv3", "au-v3", "au_v3":
|
||||
self = .auv3
|
||||
case "shoegaze", "shoe-gaze", "shoe_gaze":
|
||||
self = .shoegaze
|
||||
case "shoegaze-ios", "shoegazeios", "shoegaze_ios":
|
||||
self = .shoegazeIOS
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
@@ -77,7 +59,7 @@ public enum ProjectTemplate: String, CaseIterable, Equatable {
|
||||
public var shipsXcodeProject: Bool {
|
||||
switch self {
|
||||
case .basic, .demo, .uiDemo, .nrt, .score: return false
|
||||
case .shoegaze, .macosUIXcode, .iosUI, .auv3, .shoegazeIOS: return true
|
||||
case .macosUIXcode, .iosUI, .auv3: return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,16 +153,12 @@ public enum ProjectScaffolder {
|
||||
/// *before* calling this (see `LyrebirdCLI.runNew`), so default
|
||||
/// scaffolds track current `main`; direct library callers get the
|
||||
/// documented `nil` → remote behaviour.
|
||||
/// - shoegazePath: Absolute path to a local ShoeGaze checkout. Only
|
||||
/// consumed by the `shoegaze` template. `nil` → emit a remote-URL
|
||||
/// placeholder in the generated `Package.swift`.
|
||||
/// - Throws: `ProjectScaffolder.Error` on name validation failure or file system errors.
|
||||
public static func scaffold(
|
||||
name: String,
|
||||
template: ProjectTemplate = .basic,
|
||||
in parentDirectory: String = FileManager.default.currentDirectoryPath,
|
||||
lyrebirdPath: String? = nil,
|
||||
shoegazePath: String? = nil
|
||||
lyrebirdPath: String? = nil
|
||||
) throws {
|
||||
try validateName(name)
|
||||
|
||||
@@ -205,14 +183,12 @@ public enum ProjectScaffolder {
|
||||
template: template,
|
||||
projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath,
|
||||
fm: fm)
|
||||
} else {
|
||||
try scaffoldSwiftPackage(name: name,
|
||||
template: template,
|
||||
projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath,
|
||||
fm: fm)
|
||||
}
|
||||
}
|
||||
@@ -224,7 +200,6 @@ public enum ProjectScaffolder {
|
||||
template: ProjectTemplate,
|
||||
projectRoot: String,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String? = nil,
|
||||
fm: FileManager
|
||||
) throws {
|
||||
let sourcesDir: String = (projectRoot as NSString)
|
||||
@@ -252,8 +227,7 @@ public enum ProjectScaffolder {
|
||||
packageManifest(
|
||||
name: name,
|
||||
template: template,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath
|
||||
lyrebirdPath: lyrebirdPath
|
||||
)
|
||||
),
|
||||
(
|
||||
@@ -294,7 +268,6 @@ public enum ProjectScaffolder {
|
||||
template: ProjectTemplate,
|
||||
projectRoot: String,
|
||||
lyrebirdPath: String?,
|
||||
shoegazePath: String? = nil,
|
||||
fm: FileManager
|
||||
) throws {
|
||||
// Every xcode-bearing template ships an `<name>.xcworkspace` that
|
||||
@@ -321,10 +294,6 @@ public enum ProjectScaffolder {
|
||||
fm: fm, projectRoot: projectRoot)
|
||||
|
||||
switch template {
|
||||
case .shoegaze:
|
||||
try writeShoeGazeMacOSFiles(name: name, projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath, fm: fm)
|
||||
case .macosUIXcode:
|
||||
try writeMacOSUIXcodeFiles(name: name, projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath, fm: fm)
|
||||
@@ -334,10 +303,6 @@ public enum ProjectScaffolder {
|
||||
case .auv3:
|
||||
try writeAUv3Files(name: name, projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath, fm: fm)
|
||||
case .shoegazeIOS:
|
||||
try writeShoeGazeIOSFiles(name: name, projectRoot: projectRoot,
|
||||
lyrebirdPath: lyrebirdPath,
|
||||
shoegazePath: shoegazePath, fm: fm)
|
||||
case .basic, .demo, .uiDemo, .nrt, .score:
|
||||
// Unreachable — shipsXcodeProject filters these out at dispatch.
|
||||
try? fm.removeItem(atPath: projectRoot)
|
||||
@@ -399,14 +364,10 @@ public enum ProjectScaffolder {
|
||||
/// nil, falls back to the published Git URL (``lyrebirdPackageURL``).
|
||||
/// Used by `lyrebird new --lyrebird-path` for users who don't yet
|
||||
/// have access to the public repository.
|
||||
/// - shoegazePath: When non-nil and template is `.shoegaze`, the
|
||||
/// ShoeGaze package is declared as a local SPM dependency at this
|
||||
/// absolute path. When nil, a remote-URL placeholder is emitted.
|
||||
public static func packageManifest(
|
||||
name: String,
|
||||
template: ProjectTemplate = .basic,
|
||||
lyrebirdPath: String? = nil,
|
||||
shoegazePath: String? = nil
|
||||
lyrebirdPath: String? = nil
|
||||
) -> String {
|
||||
// byName resolves only when the product name matches the package
|
||||
// name (`Lyrebird`). Sibling products (`LyrebirdUI`) need the
|
||||
@@ -418,7 +379,7 @@ public enum ProjectScaffolder {
|
||||
targetDeps = #""Lyrebird""#
|
||||
case .uiDemo:
|
||||
targetDeps = #""Lyrebird", .product(name: "LyrebirdUI", package: "Lyrebird")"#
|
||||
case .shoegaze, .macosUIXcode, .iosUI, .auv3, .shoegazeIOS:
|
||||
case .macosUIXcode, .iosUI, .auv3:
|
||||
// Xcode-bearing templates don't emit a `Package.swift` — dispatch
|
||||
// never reaches this function for them. Defensive fallthrough.
|
||||
targetDeps = #""Lyrebird", .product(name: "LyrebirdUI", package: "Lyrebird")"#
|
||||
@@ -476,7 +437,7 @@ public enum ProjectScaffolder {
|
||||
case .uiDemo: return mainSwiftUIDemo(name: name)
|
||||
case .nrt: return mainSwiftNRT(name: name)
|
||||
case .score: return mainSwiftScore(name: name)
|
||||
case .shoegaze, .macosUIXcode, .iosUI, .auv3, .shoegazeIOS:
|
||||
case .macosUIXcode, .iosUI, .auv3:
|
||||
// Xcode-bearing templates don't emit a `main.swift` under
|
||||
// `Sources/<name>/`. Dispatch never reaches this function for
|
||||
// them. Defensive fallthrough to the basic skeleton.
|
||||
@@ -806,98 +767,6 @@ public enum ProjectScaffolder {
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: shoegaze
|
||||
|
||||
private static func mainSwiftShoegaze(name: String) -> String {
|
||||
"""
|
||||
// \(name) — ShoeGaze guitar pedalboard
|
||||
import AppKit
|
||||
|
||||
// Program entry runs on the main thread; assert main-actor isolation for the
|
||||
// AppKit bootstrap rather than hopping asynchronously.
|
||||
MainActor.assumeIsolated {
|
||||
let app: NSApplication = NSApplication.shared
|
||||
let delegate: AppDelegate = AppDelegate()
|
||||
app.setActivationPolicy(.regular)
|
||||
app.delegate = delegate
|
||||
app.activate(ignoringOtherApps: true)
|
||||
app.run()
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
/// `AppDelegate.swift` content for a shoegaze project.
|
||||
public static func shoegazeAppDelegateSwift(name: String) -> String {
|
||||
let blockSize: Int = scaffoldDefaultBlockSize
|
||||
let sampleRate: Double = 48_000.0
|
||||
let outputChannels: Int = scaffoldDefaultOutputChannels
|
||||
let inputChannels: Int = 0
|
||||
let windowWidth: Int = 980
|
||||
let windowHeight: Int = 520
|
||||
return """
|
||||
import AppKit
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
import LyrebirdShoeGaze
|
||||
import LyrebirdShoeGazeUI
|
||||
|
||||
/// Application delegate for \(name).
|
||||
///
|
||||
/// Builds a `SynthesisEngine`, a `ShoeGaze` manager, and a default board of
|
||||
/// four pedals (Overdrive → Delay → Reverb → Modulation) fed by the built-in
|
||||
/// test loop, then opens a `LyrebirdWindow` hosting `ShoeGazeView`.
|
||||
@MainActor
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
private let engine: SynthesisEngine
|
||||
private let shoeGaze: ShoeGaze
|
||||
private let window: LyrebirdWindow
|
||||
|
||||
override init() {
|
||||
let engine: SynthesisEngine = SynthesisEngine(
|
||||
blockSize: \(blockSize),
|
||||
sampleRate: \(sampleRate),
|
||||
numOutputChannels: \(outputChannels),
|
||||
numInputChannels: \(inputChannels),
|
||||
driver: CoreAudioDriver()
|
||||
)
|
||||
self.engine = engine
|
||||
self.shoeGaze = ShoeGaze(engine: engine)
|
||||
self.window = LyrebirdWindow(
|
||||
title: "\(name)",
|
||||
width: \(windowWidth),
|
||||
height: \(windowHeight)
|
||||
)
|
||||
super.init()
|
||||
}
|
||||
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try board.add(DelayPedal())
|
||||
try board.add(ReverbPedal())
|
||||
try board.add(ModulationPedal())
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
} catch {
|
||||
print("[\(name)] board build failed: \\(error)")
|
||||
}
|
||||
window.open {
|
||||
ShoeGazeView(shoeGaze: shoeGaze)
|
||||
}
|
||||
}
|
||||
|
||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
true
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ notification: Notification) {
|
||||
engine.stop()
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
// MARK: - ui-demo additional files
|
||||
|
||||
/// `AppDelegate.swift` content for a ui-demo project.
|
||||
|
||||
Vendored
-44
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTD/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Kind</key>
|
||||
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
|
||||
<key>Platforms</key>
|
||||
<array>
|
||||
<string>com.apple.platform.macosx</string>
|
||||
<string>com.apple.platform.iphoneos</string>
|
||||
</array>
|
||||
<key>Description</key>
|
||||
<string>A ShoeGaze guitar pedal subclassing Pedal. Override effect(_:) to build the processed mono signal and effectKnobs to publish its knobs; the base class handles wet/dry mix, click-free bypass, and output level. Add it to a PedalBoard with board.add(_:).</string>
|
||||
<key>Summary</key>
|
||||
<string>ShoeGaze Pedal (Pedal subclass)</string>
|
||||
<key>SortOrder</key>
|
||||
<string>13</string>
|
||||
<key>AllowedTypes</key>
|
||||
<array>
|
||||
<string>public.swift-source</string>
|
||||
</array>
|
||||
<key>DefaultCompletionName</key>
|
||||
<string>MyPedal</string>
|
||||
<key>MainTemplateFile</key>
|
||||
<string>___FILEBASENAME___.swift</string>
|
||||
<key>Options</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>productName</string>
|
||||
<key>Required</key>
|
||||
<true/>
|
||||
<key>Name</key>
|
||||
<string>Pedal name:</string>
|
||||
<key>Description</key>
|
||||
<string>Name of the Pedal subclass (also used as the file name).</string>
|
||||
<key>Type</key>
|
||||
<string>text</string>
|
||||
<key>Default</key>
|
||||
<string>MyPedal</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
//___FILEHEADER___
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
import LyrebirdShoeGaze
|
||||
|
||||
// MARK: - ___FILEBASENAMEASIDENTIFIER___
|
||||
|
||||
/// One-line description of the ___FILEBASENAMEASIDENTIFIER___ pedal.
|
||||
///
|
||||
/// Subclasses `Pedal`: reads a mono dry signal from its input bus, processes it
|
||||
/// in `effect(_:)`, and lets the base class apply the wet/dry `mix`, click-free
|
||||
/// `bypass`, and output `level`. Publish the effect's knobs via `effectKnobs`
|
||||
/// so `PedalView` renders a control for each one.
|
||||
///
|
||||
/// ## Usage
|
||||
/// ```swift
|
||||
/// let board = try shoeGaze.addBoard()
|
||||
/// try board.add(___FILEBASENAMEASIDENTIFIER___())
|
||||
/// try shoeGaze.finalizeBoard(board)
|
||||
/// ```
|
||||
final class ___FILEBASENAMEASIDENTIFIER___: Pedal {
|
||||
|
||||
// MARK: - Parameters
|
||||
|
||||
/// Effect amount. Range [0, 1].
|
||||
@UIParam var amount: Double = 0.5
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
/// Knob range for `amount`.
|
||||
private let amountRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
init(
|
||||
inputBus: Int = 0,
|
||||
outputBus: Int = 0
|
||||
) {
|
||||
super.init(name: "___FILEBASENAMEASIDENTIFIER___", inputBus: inputBus, outputBus: outputBus)
|
||||
}
|
||||
|
||||
// MARK: - Effect
|
||||
|
||||
/// Build and return the processed **mono** signal. Replace the passthrough below.
|
||||
///
|
||||
/// Fold any stereo generator (reverb, chorus) to mono with `SumChannels` before
|
||||
/// returning. Do not pre-blend with the dry signal — the base class `mix` does that.
|
||||
override func effect(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
// TODO: wire your DSP here, e.g.:
|
||||
// return SoftClip.Audio(dry, drive: $amount * 10.0 + 1.0)
|
||||
dry
|
||||
}
|
||||
|
||||
// MARK: - UI knobs
|
||||
|
||||
/// Effect-specific knobs shown by `PedalView` before the common Mix / Level knobs.
|
||||
override var effectKnobs: [PedalKnob] {
|
||||
[
|
||||
PedalKnob(label: "Amount", node: $amount, range: amountRange),
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -47,27 +47,27 @@ struct CLICommandTests {
|
||||
// MARK: - new
|
||||
|
||||
@Test func newSubcommandParsed() {
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth"]) == .new(name: "MySynth", template: .basic, lyrebirdPath: nil, shoegazePath: nil))
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth"]) == .new(name: "MySynth", template: .basic, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithTemplateDemoParsed() {
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth", "--template", "demo"])
|
||||
== .new(name: "MySynth", template: .demo, lyrebirdPath: nil, shoegazePath: nil))
|
||||
== .new(name: "MySynth", template: .demo, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithTemplateUIDemoParsed() {
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth", "--template", "ui-demo"])
|
||||
== .new(name: "MySynth", template: .uiDemo, lyrebirdPath: nil, shoegazePath: nil))
|
||||
== .new(name: "MySynth", template: .uiDemo, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithTemplateNRTParsed() {
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth", "--template", "nrt"])
|
||||
== .new(name: "MySynth", template: .nrt, lyrebirdPath: nil, shoegazePath: nil))
|
||||
== .new(name: "MySynth", template: .nrt, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithUnknownTemplateFallsBackToBasic() {
|
||||
#expect(CLICommand.parse(["lyrebird", "new", "MySynth", "--template", "bogus"])
|
||||
== .new(name: "MySynth", template: .basic, lyrebirdPath: nil, shoegazePath: nil))
|
||||
== .new(name: "MySynth", template: .basic, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithoutNameParsesToHelp() {
|
||||
@@ -89,8 +89,7 @@ struct CLICommandTests {
|
||||
"--lyrebird-path", "/Users/josh/Documents/LyrebirdII"
|
||||
]) == .new(name: "MyPiece",
|
||||
template: .basic,
|
||||
lyrebirdPath: "/Users/josh/Documents/LyrebirdII",
|
||||
shoegazePath: nil))
|
||||
lyrebirdPath: "/Users/josh/Documents/LyrebirdII"))
|
||||
}
|
||||
|
||||
@Test func newWithTemplateAndLyrebirdPathParsed() {
|
||||
@@ -100,70 +99,13 @@ struct CLICommandTests {
|
||||
"--lyrebird-path", "/abs/path"
|
||||
]) == .new(name: "MyApp",
|
||||
template: .macosUIXcode,
|
||||
lyrebirdPath: "/abs/path",
|
||||
shoegazePath: nil))
|
||||
lyrebirdPath: "/abs/path"))
|
||||
}
|
||||
|
||||
@Test func newWithoutLyrebirdPathReportsNil() {
|
||||
#expect(CLICommand.parse([
|
||||
"lyrebird", "new", "MyPiece"
|
||||
]) == .new(name: "MyPiece", template: .basic, lyrebirdPath: nil, shoegazePath: nil))
|
||||
}
|
||||
|
||||
// MARK: - shoegaze template
|
||||
|
||||
@Test func newWithTemplateShoegaze() {
|
||||
let cmd: CLICommand = CLICommand.parse(["lyrebird", "new", "MyRig", "--template", "shoegaze"])
|
||||
#expect(cmd == .new(name: "MyRig", template: .shoegaze, lyrebirdPath: nil, shoegazePath: nil))
|
||||
}
|
||||
|
||||
@Test func newWithShoegazePathParsed() {
|
||||
let cmd: CLICommand = CLICommand.parse([
|
||||
"lyrebird", "new", "MyRig",
|
||||
"--template", "shoegaze",
|
||||
"--lyrebird-path", "/abs/Lyrebird",
|
||||
"--shoegaze-path", "/abs/ShoeGaze",
|
||||
])
|
||||
#expect(cmd == .new(
|
||||
name: "MyRig",
|
||||
template: .shoegaze,
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: "/abs/ShoeGaze"
|
||||
))
|
||||
}
|
||||
|
||||
@Test func newShoegazeWithoutShoegazePathHasNilShoegazePath() {
|
||||
let cmd: CLICommand = CLICommand.parse([
|
||||
"lyrebird", "new", "MyRig",
|
||||
"--template", "shoegaze",
|
||||
"--lyrebird-path", "/abs/Lyrebird",
|
||||
])
|
||||
#expect(cmd == .new(
|
||||
name: "MyRig",
|
||||
template: .shoegaze,
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: nil
|
||||
))
|
||||
}
|
||||
|
||||
@Test func shoegazePathValueNotConsumedWhenFlagToken() {
|
||||
// `--shoegaze-path --lyrebird-path /abs/Lyrebird` — the value slot for
|
||||
// `--shoegaze-path` is `--lyrebird-path` (starts with "-") → shoegazePath = nil.
|
||||
// `firstIndex(of: "--lyrebird-path")` finds the first occurrence (index 6)
|
||||
// whose next token is also "--lyrebird-path" (starts with "-") → lyrebirdPath = nil too.
|
||||
let args: [String] = [
|
||||
"lyrebird", "new", "MyRig",
|
||||
"--template", "shoegaze",
|
||||
"--shoegaze-path", "--lyrebird-path",
|
||||
"--lyrebird-path", "/abs/Lyrebird",
|
||||
]
|
||||
let cmd: CLICommand = CLICommand.parse(args)
|
||||
#expect(cmd == .new(
|
||||
name: "MyRig",
|
||||
template: .shoegaze,
|
||||
lyrebirdPath: nil,
|
||||
shoegazePath: nil
|
||||
))
|
||||
]) == .new(name: "MyPiece", template: .basic, lyrebirdPath: nil))
|
||||
}
|
||||
|
||||
// MARK: - run
|
||||
|
||||
@@ -237,12 +237,6 @@ struct ProjectScaffolderTests {
|
||||
#expect(ProjectTemplate(string: "iosui") == .iosUI)
|
||||
#expect(ProjectTemplate(string: "auv3") == .auv3)
|
||||
#expect(ProjectTemplate(string: "AUV3") == .auv3)
|
||||
#expect(ProjectTemplate(string: "shoegaze") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "shoe-gaze") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "SHOEGAZE") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "shoegaze-ios") == .shoegazeIOS)
|
||||
#expect(ProjectTemplate(string: "shoegazeios") == .shoegazeIOS)
|
||||
#expect(ProjectTemplate(string: "SHOEGAZE-IOS") == .shoegazeIOS)
|
||||
}
|
||||
|
||||
@Test func shipsXcodeProjectClassification() {
|
||||
@@ -251,244 +245,9 @@ struct ProjectScaffolderTests {
|
||||
#expect(ProjectTemplate.uiDemo.shipsXcodeProject == false)
|
||||
#expect(ProjectTemplate.nrt.shipsXcodeProject == false)
|
||||
#expect(ProjectTemplate.score.shipsXcodeProject == false)
|
||||
// shoegaze is now an Xcode-bearing template (macOS .app bundle).
|
||||
#expect(ProjectTemplate.shoegaze.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.macosUIXcode.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.iosUI.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.auv3.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.shoegazeIOS.shipsXcodeProject == true)
|
||||
}
|
||||
|
||||
// MARK: - shoegaze template (macOS Xcode app)
|
||||
|
||||
@Test func shoegazeMacOSScaffoldCreatesAllFiles() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegaze, in: tmp)
|
||||
|
||||
let root: String = (tmp as NSString).appendingPathComponent("MyRig")
|
||||
let expected: [String] = [
|
||||
"MyRig.xcodeproj/project.pbxproj",
|
||||
"MyRig.xcodeproj/xcshareddata/xcschemes/MyRig.xcscheme",
|
||||
"MyRig.xcworkspace/contents.xcworkspacedata",
|
||||
"MyRig/MyRigApp.swift",
|
||||
"MyRig/MyRigAppModel.swift",
|
||||
"MyRig/Info.plist",
|
||||
]
|
||||
for rel: String in expected {
|
||||
let path: String = (root as NSString).appendingPathComponent(rel)
|
||||
#expect(fm.fileExists(atPath: path),
|
||||
"missing shoegaze macOS file: \(rel)")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSWorkspaceReferencesXcodeproj() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegaze, in: tmp)
|
||||
|
||||
let workspacePath: String = (tmp as NSString)
|
||||
.appendingPathComponent("MyRig/MyRig.xcworkspace/contents.xcworkspacedata")
|
||||
let contents: String = try String(contentsOfFile: workspacePath, encoding: .utf8)
|
||||
#expect(contents.contains("group:MyRig.xcodeproj"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppSwiftContainsShoeGazeView() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppSwift(name: "MyRig")
|
||||
#expect(src.contains("ShoeGazeView"))
|
||||
#expect(src.contains("import LyrebirdShoeGazeUI"))
|
||||
#expect(src.contains("@main"))
|
||||
#expect(src.contains("toggleMute"))
|
||||
#expect(src.contains(".keyboardShortcut"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppSwiftSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsApp"))
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppModelContainsEngineAndBoard() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppModelSwift(name: "MyRig")
|
||||
#expect(src.contains("import LyrebirdShoeGaze"))
|
||||
#expect(src.contains("CoreAudioDriver"))
|
||||
#expect(src.contains("ShoeGaze(engine:"))
|
||||
#expect(src.contains("OverdrivePedal"))
|
||||
#expect(src.contains("DelayPedal"))
|
||||
#expect(src.contains("ReverbPedal"))
|
||||
#expect(src.contains("ModulationPedal"))
|
||||
#expect(src.contains("@Observable"))
|
||||
#expect(src.contains("toggleMute"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppModelSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppModelSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
#expect(src.contains("GuitarPedals"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSInfoPlistContainsMicrophoneKey() {
|
||||
let plist: String = ProjectScaffolder.shoegazeMacOSInfoPlist(name: "MyRig")
|
||||
#expect(plist.contains("NSMicrophoneUsageDescription"))
|
||||
#expect(plist.contains("LSMinimumSystemVersion"))
|
||||
#expect(plist.contains("NSHighResolutionCapable"))
|
||||
#expect(plist.contains("public.app-category.music"))
|
||||
#expect(plist.contains("NSPrincipalClass"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjReferencesMacOSXAndShoeGaze() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("SDKROOT = macosx"))
|
||||
#expect(pbx.contains("MACOSX_DEPLOYMENT_TARGET = 15.0"))
|
||||
#expect(pbx.contains("ENABLE_HARDENED_RUNTIME = YES"))
|
||||
#expect(pbx.contains("LyrebirdShoeGaze"))
|
||||
#expect(pbx.contains("LyrebirdShoeGazeUI"))
|
||||
#expect(pbx.contains("LyrebirdUI"))
|
||||
#expect(pbx.contains("Lyrebird"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains("MyRig.app"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjUsesLocalRefsWhenPathsSet() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(
|
||||
name: "MyRig",
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: "/abs/ShoeGaze"
|
||||
)
|
||||
#expect(pbx.contains("XCLocalSwiftPackageReference"))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/ShoeGaze""#))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/Lyrebird""#))
|
||||
#expect(!pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjUsesRemoteRefsWhenPathsNil() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains(ProjectScaffolder.lyrebirdPackageURL))
|
||||
}
|
||||
|
||||
// MARK: - shoegaze-ios template
|
||||
|
||||
@Test func shoegazeIOSScaffoldCreatesAllFiles() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegazeIOS, in: tmp)
|
||||
|
||||
let root: String = (tmp as NSString).appendingPathComponent("MyRig")
|
||||
let expected: [String] = [
|
||||
"MyRig.xcodeproj/project.pbxproj",
|
||||
"MyRig.xcodeproj/xcshareddata/xcschemes/MyRig.xcscheme",
|
||||
"MyRig.xcworkspace/contents.xcworkspacedata",
|
||||
"MyRig/MyRigApp.swift",
|
||||
"MyRig/MyRigAppModel.swift",
|
||||
"MyRig/Info.plist",
|
||||
]
|
||||
for rel: String in expected {
|
||||
let path: String = (root as NSString).appendingPathComponent(rel)
|
||||
#expect(fm.fileExists(atPath: path),
|
||||
"missing shoegaze-ios file: \(rel)")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppSwiftContainsShoeGazeView() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppSwift(name: "MyRig")
|
||||
#expect(src.contains("ShoeGazeView"))
|
||||
#expect(src.contains("import LyrebirdShoeGazeUI"))
|
||||
#expect(src.contains("@main"))
|
||||
#expect(src.contains("NavigationStack"))
|
||||
#expect(src.contains("ScrollView"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppSwiftSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsApp"))
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppModelContainsEngineAndBoard() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppModelSwift(name: "MyRig")
|
||||
#expect(src.contains("import LyrebirdShoeGaze"))
|
||||
#expect(src.contains("iOSAudioDriver"))
|
||||
#expect(src.contains("AVAudioSession"))
|
||||
#expect(src.contains("ShoeGaze(engine:"))
|
||||
#expect(src.contains("OverdrivePedal"))
|
||||
#expect(src.contains("DelayPedal"))
|
||||
#expect(src.contains("ReverbPedal"))
|
||||
#expect(src.contains("ModulationPedal"))
|
||||
#expect(src.contains("@Observable"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppModelSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppModelSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
#expect(src.contains("GuitarPedals"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjReferencesIPhoneOSAndShoeGaze() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("SDKROOT = iphoneos"))
|
||||
#expect(pbx.contains("IPHONEOS_DEPLOYMENT_TARGET = 18.0"))
|
||||
#expect(pbx.contains("TARGETED_DEVICE_FAMILY"))
|
||||
#expect(pbx.contains("LyrebirdShoeGaze"))
|
||||
#expect(pbx.contains("LyrebirdShoeGazeUI"))
|
||||
#expect(pbx.contains("LyrebirdUI"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains("MyRig.app"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjUsesLocalShoegazeRefWhenPathSet() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(
|
||||
name: "MyRig",
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: "/abs/ShoeGaze"
|
||||
)
|
||||
#expect(pbx.contains("XCLocalSwiftPackageReference"))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/ShoeGaze""#))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/Lyrebird""#))
|
||||
#expect(!pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjUsesRemoteRefWhenPathsNil() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains(ProjectScaffolder.lyrebirdPackageURL))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSWorkspaceReferencesXcodeproj() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegazeIOS, in: tmp)
|
||||
|
||||
let workspacePath: String = (tmp as NSString)
|
||||
.appendingPathComponent("MyRig/MyRig.xcworkspace/contents.xcworkspacedata")
|
||||
let contents: String = try String(contentsOfFile: workspacePath, encoding: .utf8)
|
||||
#expect(contents.contains("group:MyRig.xcodeproj"))
|
||||
}
|
||||
|
||||
// MARK: - Xcode-bearing templates: structure
|
||||
|
||||
@@ -37,13 +37,6 @@ struct TemplateInstallerTests {
|
||||
#expect(names.contains("LyrebirdGenerator.xctemplate"))
|
||||
}
|
||||
|
||||
@Test func availableTemplatesIncludesShoeGazePedal() throws {
|
||||
let names: [String] = try TemplateInstaller.availableTemplates()
|
||||
// The ShoeGaze Pedal template scaffolds a `Pedal` subclass for the
|
||||
// guitar-pedalboard sample project.
|
||||
#expect(names.contains("LyrebirdShoeGazePedal.xctemplate"))
|
||||
}
|
||||
|
||||
// MARK: - Destination URL
|
||||
|
||||
@Test func destinationURLIsInHomeLibrary() {
|
||||
|
||||
@@ -185,28 +185,4 @@ struct WorkflowIntegrationTests {
|
||||
#expect(try parseCheck(source: source, fileName: "main.swift"),
|
||||
"nrt template main.swift must pass swiftc -parse")
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppSwiftIsValidSwiftSyntax() throws {
|
||||
let source: String = ProjectScaffolder.shoegazeIOSAppSwift(name: "MyRig")
|
||||
#expect(try parseCheck(source: source, fileName: "MyRigApp.swift"),
|
||||
"shoegaze-ios App.swift must pass swiftc -parse")
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppModelSwiftIsValidSwiftSyntax() throws {
|
||||
let source: String = ProjectScaffolder.shoegazeIOSAppModelSwift(name: "MyRig")
|
||||
#expect(try parseCheck(source: source, fileName: "MyRigAppModel.swift"),
|
||||
"shoegaze-ios AppModel.swift must pass swiftc -parse")
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppSwiftIsValidSwiftSyntax() throws {
|
||||
let source: String = ProjectScaffolder.shoegazeMacOSAppSwift(name: "MyRig")
|
||||
#expect(try parseCheck(source: source, fileName: "MyRigApp.swift"),
|
||||
"shoegaze macOS App.swift must pass swiftc -parse")
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppModelSwiftIsValidSwiftSyntax() throws {
|
||||
let source: String = ProjectScaffolder.shoegazeMacOSAppModelSwift(name: "MyRig")
|
||||
#expect(try parseCheck(source: source, fileName: "MyRigAppModel.swift"),
|
||||
"shoegaze macOS AppModel.swift must pass swiftc -parse")
|
||||
}
|
||||
}
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# prepare_release.sh — replicate the Lyrebird dev repo's committed tree into the
|
||||
# public LyrebirdRelease (mooo) repo, minus the maintainer-only paths that never ship.
|
||||
#
|
||||
# Replaces the manual "export → hand-copy in Finder" step. Works from a clean
|
||||
# `git archive HEAD` of the dev repo (so untracked build junk and Finder " 2"/" 3"
|
||||
# duplicate cruft never leak in), strips the intentional exclusions, then rsyncs the
|
||||
# result over the release working tree with --delete (cleaning stale files) while
|
||||
# preserving the release repo's own .git and local .build.
|
||||
#
|
||||
# Dry-run by default. Pass --apply to actually modify the release working tree.
|
||||
#
|
||||
# Usage:
|
||||
# prepare_release.sh [--dev PATH] [--release PATH] [--apply] [--allow-dirty]
|
||||
#
|
||||
# Defaults:
|
||||
# --dev ~/Documents/src/Lyrebird
|
||||
# --release ~/Documents/src/LyrebirdRelease
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DEV="${HOME}/Documents/src/Lyrebird"
|
||||
RELEASE="${HOME}/Documents/src/LyrebirdRelease"
|
||||
APPLY=0
|
||||
ALLOW_DIRTY=0
|
||||
|
||||
# Paths that are git-tracked in dev but must NOT ship in the public release.
|
||||
# (Verified: these exactly account for the dev↔release tracked-file delta.)
|
||||
EXCLUSIONS=(
|
||||
"legacy"
|
||||
"PLAN.md"
|
||||
".claude"
|
||||
".githooks"
|
||||
".swiftpm"
|
||||
)
|
||||
|
||||
# Regex the release repo's origin URL must match — a guard so --apply can never
|
||||
# nuke the wrong directory. Requires the mooo host AND the `Lyrebird` repo path
|
||||
# (so a sibling mooo repo like ShoeGaze can't be mistaken for the release repo).
|
||||
RELEASE_REMOTE_REGEX='realizedsound\.mooo\.com.*/Lyrebird(\.git)?/?$'
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dev) DEV="$2"; shift 2 ;;
|
||||
--release) RELEASE="$2"; shift 2 ;;
|
||||
--apply) APPLY=1; shift ;;
|
||||
--allow-dirty) ALLOW_DIRTY=1; shift ;;
|
||||
-h|--help)
|
||||
tail -n +2 "$0" | grep '^#' | sed 's/^# \{0,1\}//'
|
||||
exit 0 ;;
|
||||
*) echo "ERROR: unknown argument '$1'" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
fail() { echo "ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# --- Validate repos ---------------------------------------------------------
|
||||
[ -d "$DEV/.git" ] || fail "dev repo not a git repo: $DEV"
|
||||
[ -d "$RELEASE/.git" ] || fail "release repo not a git repo: $RELEASE"
|
||||
|
||||
RELEASE_URL="$(git -C "$RELEASE" remote get-url origin 2>/dev/null || echo "")"
|
||||
if [[ ! "$RELEASE_URL" =~ $RELEASE_REMOTE_REGEX ]]; then
|
||||
fail "release origin ('$RELEASE_URL') is not the Lyrebird mooo release repo (must match /$RELEASE_REMOTE_REGEX/) — refusing to sync. Wrong --release path?"
|
||||
fi
|
||||
|
||||
# --- Guard: dev working tree should be committed (we archive HEAD) -----------
|
||||
if [ -n "$(git -C "$DEV" status --porcelain)" ]; then
|
||||
if [ "$ALLOW_DIRTY" -eq 1 ]; then
|
||||
echo "WARNING: dev repo has uncommitted changes — they will NOT ship (archiving HEAD). Continuing (--allow-dirty)."
|
||||
else
|
||||
fail "dev repo ($DEV) has uncommitted changes. Commit them first (only HEAD ships), or pass --allow-dirty to archive HEAD anyway."
|
||||
fi
|
||||
fi
|
||||
|
||||
DEV_HEAD="$(git -C "$DEV" rev-parse --short HEAD)"
|
||||
echo "Dev HEAD: $DEV_HEAD ($(git -C "$DEV" log -1 --format=%s))"
|
||||
echo "Release repo: $RELEASE (origin: $RELEASE_URL)"
|
||||
echo "Mode: $([ "$APPLY" -eq 1 ] && echo APPLY || echo DRY-RUN)"
|
||||
echo
|
||||
|
||||
# --- Stage a pristine tree from git archive ---------------------------------
|
||||
STAGING="$(mktemp -d "${TMPDIR:-/tmp}/lyrebird-release-prep.XXXXXX")"
|
||||
trap 'rm -rf "$STAGING"' EXIT
|
||||
|
||||
git -C "$DEV" archive --format=tar HEAD | tar -x -C "$STAGING"
|
||||
|
||||
# Strip the intentional exclusions from the staged tree.
|
||||
echo "Excluding (maintainer-only, never shipped):"
|
||||
for p in "${EXCLUSIONS[@]}"; do
|
||||
if [ -e "$STAGING/$p" ]; then
|
||||
echo " - $p"
|
||||
rm -rf "$STAGING/$p"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
# --- Sync staging → release -------------------------------------------------
|
||||
# --delete removes release files not present in the staged tree (clears stale
|
||||
# files + accumulated Finder duplicates). Excludes protect the release repo's own
|
||||
# .git and local, non-shipped build/editor state from both transfer and deletion.
|
||||
RSYNC_ARGS=(
|
||||
-a -c --delete --itemize-changes
|
||||
--exclude='.git/'
|
||||
--exclude='.build/'
|
||||
--exclude='.swiftpm/'
|
||||
--exclude='.DS_Store'
|
||||
--exclude='xcuserdata/'
|
||||
--exclude='*.xcuserstate'
|
||||
)
|
||||
[ "$APPLY" -eq 1 ] || RSYNC_ARGS+=(--dry-run)
|
||||
|
||||
# Capture itemized output; filter to meaningful lines for display. rsync itemize
|
||||
# codes: leading '>' = content transfer, 'c' = created dir/file, '*deleting' =
|
||||
# removal. Leading '.' = metadata-only (mtime/perms) churn — harmless (git ignores
|
||||
# it), so suppress it from the summary. Content is authoritative via -c (checksum).
|
||||
ITEMS="$(rsync "${RSYNC_ARGS[@]}" "$STAGING/" "$RELEASE/")"
|
||||
MEANINGFUL="$(printf '%s\n' "$ITEMS" | grep -E '^(\*deleting|[>c])' || true)"
|
||||
|
||||
echo "Content changes + deletions ($([ "$APPLY" -eq 1 ] && echo applied || echo would apply)):"
|
||||
if [ -n "$MEANINGFUL" ]; then
|
||||
printf '%s\n' "$MEANINGFUL" | sed 's/^/ /'
|
||||
else
|
||||
echo " (none — release tree already matches dev content)"
|
||||
fi
|
||||
META_COUNT="$(printf '%s\n' "$ITEMS" | grep -cE '^\.' || true)"
|
||||
echo " [$META_COUNT files: mtime/perms normalized only — no content change, git-invisible]"
|
||||
echo
|
||||
|
||||
if [ "$APPLY" -eq 1 ]; then
|
||||
echo "Sync complete. Release working tree now mirrors dev HEAD ($DEV_HEAD) minus exclusions."
|
||||
echo
|
||||
echo "Release git status:"
|
||||
git -C "$RELEASE" status --short | sed 's/^/ /'
|
||||
echo
|
||||
echo "Next (run in $RELEASE — pushes need your key/touch):"
|
||||
echo " git -C \"$RELEASE\" add -A"
|
||||
echo " git -C \"$RELEASE\" commit -m \"<release message>\""
|
||||
echo " git -C \"$RELEASE\" tag -a vX.Y.Z -m \"vX.Y.Z: <summary>\""
|
||||
echo " git -C \"$RELEASE\" push origin main && git -C \"$RELEASE\" push origin vX.Y.Z"
|
||||
else
|
||||
echo "Dry-run only. Re-run with --apply to modify the release working tree."
|
||||
fi
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
name: lyrebird_release_prep
|
||||
description: Prepare the public LyrebirdRelease (mooo) repo from the Lyrebird dev repo, replacing the manual "export → hand-copy in Finder" step. Syncs the dev repo's committed tree into the release working tree, excluding maintainer-only paths that never ship (legacy/, PLAN.md, .claude/, .githooks/, .swiftpm/) and cleaning accumulated Finder duplicate cruft. Dry-run first, then apply, then guides commit + tag + push to mooo. Use when cutting a new Lyrebird release (e.g. bumping to a new vX.Y.Z tag).
|
||||
---
|
||||
|
||||
# Lyrebird Release Prep
|
||||
|
||||
Replicates the Lyrebird **dev** repo (`~/Documents/src/Lyrebird`, origin = bitbucket) into
|
||||
the public **release** repo (`~/Documents/src/LyrebirdRelease`, origin = `realizedsound.mooo.com`)
|
||||
that SwiftPM consumers resolve from — without the manual Finder export/hand-copy.
|
||||
|
||||
## What it does (and why it's safe)
|
||||
|
||||
Works from a clean `git archive HEAD` of the dev repo, so:
|
||||
- only **committed, tracked** files ship (no `.build`, no editor state),
|
||||
- accumulated Finder duplicate cruft (` 2`/` 3` suffixed dirs) never leaks in, and
|
||||
- the release's own `.git` and local `.build` are preserved.
|
||||
|
||||
Then it strips the maintainer-only paths that are tracked in dev but must **not** ship
|
||||
(verified to exactly account for the dev↔release tracked-file delta):
|
||||
|
||||
| Excluded | Why |
|
||||
|---|---|
|
||||
| `legacy/` | old pre-modernization reference code |
|
||||
| `PLAN.md` | private planning doc |
|
||||
| `.claude/` | agent working-copy mirror (release ships `claude/` installer source only) |
|
||||
| `.githooks/` | dev-only pre-commit hooks |
|
||||
| `.swiftpm/` | local Xcode package state |
|
||||
|
||||
The sync uses `rsync -a -c --delete` (checksum-based, so only real content differences
|
||||
transfer; `--delete` clears stale files + Finder cruft on the release side). A moo-URL guard
|
||||
on the release remote prevents `--apply` from ever touching the wrong directory.
|
||||
|
||||
`docs/` (including `00-working-order.md` / `01-completed-working-order.md`) **does** ship —
|
||||
only top-level `PLAN.md` is excluded from the planning material.
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Pre-flight
|
||||
|
||||
Confirm the dev repo has the release commit already made (the script archives `HEAD` — uncommitted changes do **not** ship):
|
||||
|
||||
```bash
|
||||
git -C ~/Documents/src/Lyrebird status --short # should be clean
|
||||
git -C ~/Documents/src/Lyrebird log -1 --oneline
|
||||
```
|
||||
|
||||
If dirty, commit first (or the maintainer may pass `--allow-dirty` to archive HEAD anyway).
|
||||
|
||||
### 2. Dry run
|
||||
|
||||
```bash
|
||||
~/.claude/skills/lyrebird_release_prep/prepare_release.sh
|
||||
```
|
||||
|
||||
Read the summary: it lists the excluded paths, the deletions (Finder cruft cleanup), and the
|
||||
**content changes** (should match exactly the files changed since the last release). Metadata-
|
||||
only (mtime/perms) churn is reported as a count and is git-invisible.
|
||||
|
||||
Stop and investigate if the content-change list contains anything unexpected.
|
||||
|
||||
### 3. Apply
|
||||
|
||||
```bash
|
||||
~/.claude/skills/lyrebird_release_prep/prepare_release.sh --apply
|
||||
```
|
||||
|
||||
This mirrors the dev tree into the release working tree. It prints the release repo's
|
||||
`git status --short` afterward — this is the authoritative content diff.
|
||||
|
||||
### 4. Commit, tag, push (maintainer runs — push needs your key/touch)
|
||||
|
||||
The script prints these; fill in the version and message:
|
||||
|
||||
```bash
|
||||
R=~/Documents/src/LyrebirdRelease
|
||||
git -C "$R" add -A
|
||||
git -C "$R" commit -m "vX.Y.Z release: <summary>"
|
||||
git -C "$R" tag -a vX.Y.Z -m "vX.Y.Z: <summary>"
|
||||
git -C "$R" push origin main && git -C "$R" push origin vX.Y.Z
|
||||
```
|
||||
|
||||
Verify the tag landed:
|
||||
|
||||
```bash
|
||||
git -C "$R" ls-remote --tags origin | grep vX.Y.Z
|
||||
```
|
||||
|
||||
### 5. Point consumers at the new tag
|
||||
|
||||
For a downstream package pinned to a local `swift package edit` override during development
|
||||
(e.g. ShoeGaze), drop the override and bump the dependency once the tag is live:
|
||||
|
||||
```bash
|
||||
cd <consumer-pkg>
|
||||
swift package unedit Lyrebird
|
||||
swift package update Lyrebird # resolves to the new tag if Package.swift `from:` allows it
|
||||
swift build && swift test
|
||||
```
|
||||
|
||||
## Flags
|
||||
|
||||
- `--dev PATH` / `--release PATH` — override the default repo locations.
|
||||
- `--apply` — actually modify the release working tree (default is dry-run).
|
||||
- `--allow-dirty` — proceed even if the dev repo has uncommitted changes (still archives HEAD).
|
||||
|
||||
## Maintaining the exclusion list
|
||||
|
||||
If a new maintainer-only top-level path is added to the dev repo, add it to the `EXCLUSIONS`
|
||||
array in `prepare_release.sh`. Sanity check: after a dry run, the release tracked-file count
|
||||
plus the excluded tracked-file counts should equal the dev tracked-file count
|
||||
(`git ls-files | wc -l` in each; `git ls-files <path> | wc -l` per exclusion).
|
||||
@@ -1,366 +0,0 @@
|
||||
# ShoeGaze — Guitar Pedalboard Framework
|
||||
|
||||
ShoeGaze is a nested SwiftPM sub-package (`ShoeGaze/`) that models a guitar-effect signal chain as a sequence of `Pedal` objects managed by a `PedalBoard`, all hosted by a `ShoeGaze` manager that owns the `SynthesisEngine`.
|
||||
|
||||
---
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### `Pedal`
|
||||
|
||||
A `Pedal` is a `SynthesizerBase` subclass that reads a mono signal from its input bus, runs it through a subclass-supplied `effect(_:)` stage, blends wet/dry with an equal-power crossfade (`mix`), applies a click-free `bypass` crossfade, scales by `level`, and writes to its output bus. Each pedal exposes its knobs as `@UIParam` properties and publishes a `knobs: [PedalKnob]` list so `PedalView` (from `LyrebirdShoeGazeUI`) renders a control per parameter.
|
||||
|
||||
Eight built-in pedals (the signal chain is mono; stereo-native effects fold to mono internally):
|
||||
|
||||
| Type | Effect |
|
||||
|---|---|
|
||||
| `OverdrivePedal` | Soft-clip saturation → RBJ low-pass tone. Knobs: `drive`, `tone` |
|
||||
| `DelayPedal` | Feedback delay line. Knobs: `time`, `feedback` |
|
||||
| `ReverbPedal` | Freeverb (stereo, summed to mono). Knobs: `roomSize`, `damping` |
|
||||
| `ModulationPedal` | Chorus (stereo, summed to mono). Knobs: `rate`, `depth` |
|
||||
| `FuzzPedal` | High-gain `tanh` saturation (drive → square-up) → RBJ low-pass tone. Knobs: `fuzz`, `tone` |
|
||||
| `TremoloPedal` | Unipolar sine LFO amplitude modulation. Knobs: `rate`, `depth` |
|
||||
| `PhaserPedal` | Cascaded all-pass stages swept by a sine LFO. Knobs: `rate`, `feedback` |
|
||||
| `CompressorPedal` | Feed-forward dynamic range compressor. Knobs: `threshold`, `ratio` |
|
||||
|
||||
Every pedal also inherits the common `mix`, `bypass`, and `level` controls from `Pedal`.
|
||||
|
||||
Write a custom pedal by subclassing `Pedal`, overriding `effect(_:)` to return a mono processed signal, and overriding `effectKnobs` to publish its `@UIParam` knobs. The base class handles wet/dry mixing, bypass, and output gain.
|
||||
|
||||
### `PedalBoard`
|
||||
|
||||
A `PedalBoard` is an ordered collection of pedals. Pedals are appended in signal-flow order with `board.add(pedal)`. A board must be finalised with `shoeGaze.finalizeBoard(board)` before audio flows through it — finalisation wires the signal chain and adds all pedals to the engine.
|
||||
|
||||
### `ShoeGaze`
|
||||
|
||||
`ShoeGaze` owns the `SynthesisEngine` and manages one or more `PedalBoard` instances. The engine lifecycle is caller-owned: `ShoeGaze` itself has no `start()` / `stop()` methods. `ShoeGazeView` provides Start/Stop transport buttons that call `engine.start()` / `engine.stop()`, or the app can drive the engine directly.
|
||||
|
||||
```swift
|
||||
let shoeGaze = ShoeGaze(engine: engine)
|
||||
let board = try shoeGaze.addBoard()
|
||||
try board.add(OverdrivePedal())
|
||||
try board.add(DelayPedal())
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
```
|
||||
|
||||
### Input sources
|
||||
|
||||
Every `PedalBoard` has an `InputSource` that determines what feeds the first pedal in the chain:
|
||||
|
||||
| Source | Description |
|
||||
|---|---|
|
||||
| `.testLoop` (default) | Built-in synthesized test signal — no audio hardware input needed |
|
||||
| `.liveInput(channel:)` | Routes a hardware input channel (zero-based; bus `numOutputChannels + channel`) from the microphone / audio interface |
|
||||
|
||||
The source is set on the `ShoeGaze` manager at init; every board it creates uses it:
|
||||
|
||||
```swift
|
||||
let shoeGaze = ShoeGaze(engine: engine, inputSource: .liveInput(channel: 0))
|
||||
let board = try shoeGaze.addBoard()
|
||||
```
|
||||
|
||||
`liveInput` requires `numInputChannels > 0` in the `SynthesisEngine` init and the appropriate OS permission (microphone entitlement on macOS, `NSMicrophoneUsageDescription` in Info.plist for iOS).
|
||||
|
||||
### Recording
|
||||
|
||||
`ShoeGaze` can record the raw **input** and the overall **output** to timestamped WAV
|
||||
files (via core `DiskOut.Audio`):
|
||||
|
||||
- `ShoeGaze.recordingFolder: URL?` — destination folder (set from the UI's folder picker).
|
||||
- `ShoeGaze.startRecording() throws` — writes `output-<yyyyMMdd-HHmmss>.wav` (stereo hardware
|
||||
output) and `input-<…>.wav` (the raw input: the hardware input channel for `.liveInput`,
|
||||
or the first board's head bus for `.testLoop`). Throws `ShoeGazeError.recordingFolderNotSet`
|
||||
if no folder is set; creates the folder if missing.
|
||||
- `ShoeGaze.stopRecording()` — removes the taps and flushes/closes the files.
|
||||
- `ShoeGaze.isRecording: Bool`.
|
||||
|
||||
The record taps are inserted `.after(engine.mainGroup)` so they capture each block's fully
|
||||
processed bus values. `ShoeGazeView` provides a **Choose Folder…** button and a **Record/Stop**
|
||||
button (disabled until a folder is chosen). For the cleanest tail of the file, stop the engine
|
||||
before `stopRecording()` (engine node removal is asynchronous, so the last block or two may be
|
||||
dropped otherwise).
|
||||
|
||||
### Board selection & crossfade
|
||||
|
||||
By default every board's output sums to the hardware output. To make only one board
|
||||
audible at a time — switching between them without clicks — use:
|
||||
|
||||
- `ShoeGaze.selectBoard(_ board:, crossfadeSeconds:)` — solo `board`, crossfading the others out.
|
||||
- `ShoeGaze.selectAllBoards(crossfadeSeconds:)` — restore the summed (all-audible) state.
|
||||
- `ShoeGaze.activeBoardIndex: Int?` — the soloed board index, or `nil` when all are audible.
|
||||
|
||||
Each board's output master carries a lagged board-select gain (separate from the master
|
||||
volume knob); `crossfadeSeconds` sets the lag time, so a switch is a click-free crossfade
|
||||
of that duration (`0` = instant). `ShoeGazeView` exposes an "Active" board picker plus a
|
||||
crossfade-seconds field driving these calls.
|
||||
|
||||
---
|
||||
|
||||
## Parallel routing (split / merge)
|
||||
|
||||
Two routing primitives let a signal fan out to two parallel paths and recombine:
|
||||
|
||||
- **`Splitter`** — one input bus → two branch buses, each gated by a click-free, lagged enable (`@UIParam branchAEnabled` / `branchBEnabled`). The `mode: SplitMode` convenience selects `.a` (branch A only), `.b` (branch B only), or `.both` (parallel). A/B switching is click-free.
|
||||
- **`Merger`** — two branch buses → one output bus, each scaled by `@UIParam levelA` / `levelB`, summed.
|
||||
|
||||
Both are `SynthesizerBase` routing nodes (not `Pedal`s — multi-bus, no wet/dry). They power two layers:
|
||||
|
||||
### Intra-board: a parallel section inside one board
|
||||
|
||||
`PedalBoard.split()` inserts a splitter at the current chain tail and returns a `ParallelSection` with two `BranchChain`s; populate each branch, then `PedalBoard.merge(_:)` sums them back into the chain. Series pedals before and after compose normally.
|
||||
|
||||
```swift
|
||||
let board = try shoeGaze.addBoard()
|
||||
try board.add(OverdrivePedal()) // series pre
|
||||
let section = try board.split() // → splitter
|
||||
try section.branchA.add(DelayPedal()) // branch A
|
||||
try section.branchB.add(FuzzPedal()) // branch B
|
||||
try board.merge(section) // → merger
|
||||
try board.add(ReverbPedal()) // series post
|
||||
try shoeGaze.finalizeBoard(board)
|
||||
section.splitter.mode = .both // run both branches
|
||||
```
|
||||
|
||||
Branches use independent buses; the merge node is inserted after both branches so they evaluate first. Node-tree order: `pre → splitter → branch pedals → merger → post`.
|
||||
|
||||
### Inter-board: an A/B chain router
|
||||
|
||||
`ShoeGaze.makeChainRouter()` returns a `ChainRouter` that feeds one shared input through a splitter to **two whole boards** (`boardA` / `boardB`), then a merger + master to the hardware output. `router.mode` toggles which chain is audible (or both).
|
||||
|
||||
```swift
|
||||
let router = try shoeGaze.makeChainRouter()
|
||||
try router.boardA.add(OverdrivePedal())
|
||||
try router.boardA.add(DelayPedal())
|
||||
try router.boardB.add(FuzzPedal())
|
||||
try router.boardB.add(ReverbPedal())
|
||||
try router.finalize()
|
||||
router.mode = .a // chain A live; toggle to .b / .both
|
||||
```
|
||||
|
||||
The router owns its source, splitter, merger, and master (it does not use the per-board source/master of `addBoard`/`finalizeBoard`). `ChainRouter.teardown()` removes all nodes before releasing buses; `ShoeGaze.teardown()` tears down routers too.
|
||||
|
||||
---
|
||||
|
||||
## SwiftUI — `LyrebirdShoeGazeUI`
|
||||
|
||||
`LyrebirdShoeGazeUI` provides ready-made SwiftUI views:
|
||||
|
||||
| View | Description |
|
||||
|---|---|
|
||||
| `ShoeGazeView(shoeGaze:)` | Top-level view: transport controls + all boards |
|
||||
| `PedalBoardView(board:)` | Horizontal scroll of `PedalView` tiles for one board |
|
||||
| `PedalView(pedal:)` | Single pedal tile: bypass toggle + one knob per entry in `pedal.knobs` |
|
||||
| `SplitterView(splitter:)` | 3-way A / B / Both mode selector + per-branch enable LEDs |
|
||||
| `MergerView(merger:)` | Branch A / B level knobs |
|
||||
| `ParallelSectionView(section:)` | Splitter + the two branch pedal rows for an intra-board section |
|
||||
| `ChainRouterView(router:)` | Splitter + master knob, boards A/B, and the merger for an A/B chain router |
|
||||
| `BoardEditorView(shoeGaze:boardIndex:versionStore:)` | Auto-laid-out board editor: wrap-to-fit pedal grid + save/load version toolbar |
|
||||
| `FlowLayout` | A `Layout` that wraps subviews left-to-right to fit the available width (used by the editor) |
|
||||
|
||||
`PedalView` renders the descriptors a pedal publishes via its `knobs: [PedalKnob]` list (effect knobs, then the common `mix` and `level`). A custom pedal gets knobs by overriding `effectKnobs` — no view code is required.
|
||||
|
||||
---
|
||||
|
||||
## Board versions & auto-layout editor
|
||||
|
||||
`BoardEditorView(shoeGaze:boardIndex:versionStore:)` visualizes one board: its pedals are arranged by `FlowLayout`, a SwiftUI `Layout` that flows pedals left-to-right and wraps to the next row to fit the window width (a real pedalboard look). A toolbar saves and recalls **versions** of the board.
|
||||
|
||||
Backend:
|
||||
- `PedalBoard.captureState() -> BoardState` snapshots a board (label + each pedal's type + knob/bypass values).
|
||||
- `ShoeGaze.rebuildBoard(_:from:) throws -> PedalBoard` tears the board down and recreates it from a `BoardState` — recreating pedals via `PedalRegistry` and restoring knob values — **at the same index** in `boards` (unknown pedal types are skipped). Call with the engine stopped (same async-removal caveat as `teardown`).
|
||||
- `BoardVersionStore` (`@Observable`) holds named `BoardVersion`s (`id`, `name`, `savedAt`, `state`) in memory and persists them as JSON:
|
||||
- `capture(board, name:)` snapshots the current board.
|
||||
- `writeAllToDisk(in:)` / `loadAllFromDisk(in:)` round-trip versions to a directory (`BoardVersionStore.defaultDirectory()` = `<Application Support>/LyrebirdShoeGaze/ShoeGazeVersions/`).
|
||||
|
||||
```swift
|
||||
let store = BoardVersionStore()
|
||||
store.capture(board, name: "Crunch rhythm") // snapshot current knobs
|
||||
try store.writeAllToDisk(in: BoardVersionStore.defaultDirectory())
|
||||
// later — recall, rebuilding the board from the saved version:
|
||||
_ = try shoeGaze.rebuildBoard(board, from: store.versions[0].state)
|
||||
```
|
||||
|
||||
In the UI, "Save Version" snapshots the live board, the Versions menu loads one (rebuilding in place), and Save/Load-to-disk persist the set. Because `ShoeGaze` and `BoardVersionStore` are `@Observable`, the editor re-renders automatically after a capture or rebuild.
|
||||
|
||||
---
|
||||
|
||||
## Sharing — the `.shoegaze` document type
|
||||
|
||||
Exporting and sharing use a single registered document type: **`.shoegaze`** (UTType `net.realizedsound.shoegaze`, conforming to `public.json`, so the file stays text-readable). The two builder apps (macOS `ShoeGazeBuilder`, iPad `ShoeGazeBuilderiOS`) declare it (`CFBundleDocumentTypes` + `UTExportedTypeDeclarations`) and implement opening (`application(_:open:)` / `.onOpenURL` → import into the library), so the system associates `.shoegaze` files with them for Open and Share. The minimal player demos do not claim the type — they have no library or share UI.
|
||||
|
||||
- `ShoeGazeDocument` (in `LyrebirdShoeGaze`) is a versioned envelope around one of two payloads: `.rigs(RigArchive)` (one or many rigs — a single shared rig is a one-rig archive) or `.board(BoardVersion)` (a single board). `data()` encodes pretty-printed JSON; `ShoeGazeDocument.decoded(from:)` reads it back and also accepts the two legacy shapes (a bare `RigArchive`, a bare `ShoeGazeState`).
|
||||
- `RigLibraryStore.exportDocumentData()` writes the whole library as a `.shoegaze` document; `importArchive(from:)` accepts `.shoegaze`, bare `RigArchive`, and legacy single-rig JSON (internal per-rig library files stay plain `.json`).
|
||||
- The rig-library sidebar (`Share…` per rig) and the board editor's Versions menu (`Share…` per version) present the OS share sheet via SwiftUI `ShareLink`, backed by the `Transferable` wrappers `RigShareItem` / `BoardShareItem` (in `LyrebirdShoeGazeUI`). No backend — share targets are AirDrop, Mail, Messages, and Files.
|
||||
|
||||
```swift
|
||||
// Export the library to a .shoegaze file:
|
||||
let data = try library.exportDocumentData()
|
||||
// Import a received .shoegaze (or legacy) file:
|
||||
let added = try library.importArchive(from: receivedData)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Demo apps
|
||||
|
||||
The package ships two in-repo demo apps in the workspace — a macOS app and an iOS app.
|
||||
Both live under `ShoeGaze/Demo/` and share the same workspace:
|
||||
|
||||
```sh
|
||||
open ShoeGaze/ShoeGaze.xcworkspace
|
||||
```
|
||||
|
||||
The workspace contains three entries: the `ShoeGaze` SwiftPM package (library targets),
|
||||
`Demo/ShoeGazeDemo.xcodeproj` (macOS), and `Demo/ShoeGazeiOSDemo.xcodeproj` (iOS). Xcode
|
||||
resolves the two local package references (`..` for `LyrebirdShoeGaze`/`LyrebirdShoeGazeUI`,
|
||||
`../..` for `Lyrebird`/`LyrebirdUI`) automatically when you first open the workspace.
|
||||
|
||||
### `ShoeGazeDemo` (macOS)
|
||||
|
||||
Showcases every feature via a mode picker (Boards / Editor / Parallel / Router), an input
|
||||
dropdown, transport, and the board selector + crossfade. Build & Run produces `ShoeGazeDemo.app`
|
||||
with a full menu bar — **Quit ⌘Q**, **Audio ▸ Mute ⌘M** (checkmark while muted):
|
||||
|
||||
```sh
|
||||
open ShoeGaze/ShoeGaze.xcworkspace # select the "ShoeGazeDemo" scheme → Run
|
||||
```
|
||||
|
||||
### `ShoeGazeiOSDemo` (iPhone + iPad)
|
||||
|
||||
A minimal iOS app wrapping `ShoeGazeView` in a `NavigationStack` + `ScrollView` so the
|
||||
pedalboard scrolls on compact screens. Shows a default board (Overdrive → Delay → Reverb →
|
||||
Modulation) fed by the built-in `.testLoop` source — no microphone permission required.
|
||||
|
||||
To run:
|
||||
|
||||
1. Open `ShoeGaze/ShoeGaze.xcworkspace` in Xcode.
|
||||
2. Select the **ShoeGazeiOSDemo** scheme.
|
||||
3. Pick an iPhone or iPad simulator (or a physical device with a provisioning profile).
|
||||
4. Click **Run**.
|
||||
|
||||
The app uses `AVAudioSession` to read the hardware sample rate at launch, so pitch and timing
|
||||
are accurate on all devices. To switch to live microphone input: set
|
||||
`numInputChannels: 1` and `.playAndRecord` in `ShoeGazeiOSDemoAppModel.swift`, then pass
|
||||
`.liveInput(channel: 0)` to the `ShoeGaze` init.
|
||||
|
||||
Note: the CLI `lyrebird new --template shoegaze` / `--template shoegaze-ios` (below) is still
|
||||
the way to scaffold your OWN app project. The demo apps are in-repo only.
|
||||
|
||||
---
|
||||
|
||||
## `lyrebird new --template shoegaze` Workflow (macOS Xcode app)
|
||||
|
||||
```sh
|
||||
lyrebird new MyRig --template shoegaze \
|
||||
--lyrebird-path /path/to/LyrebirdII \
|
||||
--shoegaze-path /path/to/LyrebirdII/ShoeGaze
|
||||
```
|
||||
|
||||
Generates a full `.xcodeproj` macOS application (macOS 15+):
|
||||
|
||||
```
|
||||
MyRig/
|
||||
├── MyRig.xcodeproj/
|
||||
│ ├── project.pbxproj
|
||||
│ └── xcshareddata/xcschemes/MyRig.xcscheme
|
||||
├── MyRig.xcworkspace/
|
||||
│ └── contents.xcworkspacedata (references MyRig.xcodeproj)
|
||||
└── MyRig/
|
||||
├── Info.plist (NSMicrophoneUsageDescription pre-wired)
|
||||
├── MyRigApp.swift (@main SwiftUI App — ShoeGazeView root + Mute menu)
|
||||
└── MyRigAppModel.swift (@Observable model — engine + ShoeGaze)
|
||||
```
|
||||
|
||||
Open `MyRig.xcworkspace` in Xcode and run. The generated app:
|
||||
|
||||
- Wires `CoreAudioDriver` at 48 000 Hz with 256 audio buses.
|
||||
- Builds a default board (Overdrive → Delay → Reverb → Modulation) with the `.testLoop` input source.
|
||||
- Exposes an **Audio ▸ Mute ⌘M** command (stops/starts the engine).
|
||||
- Ships `NSMicrophoneUsageDescription` in `Info.plist` so switching to `.liveInput` doesn't require an extra plist edit.
|
||||
- `ShoeGazeView` already provides Choose Folder / Record / Stop recording controls.
|
||||
|
||||
Key differences between the macOS and iOS shoegaze templates:
|
||||
|
||||
| | `shoegaze` (macOS Xcode) | `shoegaze-ios` (iOS Xcode) |
|
||||
|---|---|---|
|
||||
| Project type | `.xcodeproj` app bundle | `.xcodeproj` app bundle |
|
||||
| Driver | `CoreAudioDriver` | `iOSAudioDriver` |
|
||||
| Session | — | `AVAudioSession(.playback)` |
|
||||
| Entry point | SwiftUI `@main App` | SwiftUI `@main App` |
|
||||
| Window sizing | `.frame(minWidth:minHeight:)` | device-fill, no min size |
|
||||
| Menu | Audio ▸ Mute ⌘M | — |
|
||||
|
||||
### `--shoegaze-path`
|
||||
|
||||
ShoeGaze is not yet published at a stable remote URL. Passing `--shoegaze-path <abs path to ShoeGaze/>` wires it as an `XCLocalSwiftPackageReference` in the generated `.xcodeproj`. If you omit the flag, the pbxproj uses a placeholder URL (`https://github.com/realizedsound/LyrebirdShoeGaze`) — edit `project.pbxproj` or re-generate once ShoeGaze is published.
|
||||
|
||||
The placeholder URL is stored in `ProjectScaffolder.shoegazePackageURL`.
|
||||
|
||||
### Live audio input on macOS
|
||||
|
||||
The generated template uses `.testLoop` and `numInputChannels: 0`. To switch to microphone or audio interface input:
|
||||
|
||||
1. Change `numInputChannels: 0` to the desired channel count in `MyRigAppModel.swift`.
|
||||
2. Change `ShoeGaze(engine: eng)` to `ShoeGaze(engine: eng, inputSource: .liveInput(channel: 0))`.
|
||||
3. `NSMicrophoneUsageDescription` is already in `Info.plist` — update the string to describe your use case.
|
||||
4. If running under App Sandbox, add `com.apple.security.device.audio-input` to the `.entitlements` file. The `shoegaze` template is unsandboxed by default (Hardened Runtime without sandbox), so no entitlement file is needed in the common development workflow.
|
||||
|
||||
---
|
||||
|
||||
## `lyrebird new --template shoegaze-ios` Workflow (iOS)
|
||||
|
||||
```sh
|
||||
lyrebird new MyRig --template shoegaze-ios \
|
||||
--lyrebird-path /path/to/LyrebirdII \
|
||||
--shoegaze-path /path/to/LyrebirdII/ShoeGaze
|
||||
```
|
||||
|
||||
Generates a full `.xcodeproj` iOS application (iPhone + iPad, iOS 18+):
|
||||
|
||||
```
|
||||
MyRig/
|
||||
├── MyRig.xcodeproj/
|
||||
│ ├── project.pbxproj
|
||||
│ └── xcshareddata/xcschemes/MyRig.xcscheme
|
||||
├── MyRig.xcworkspace/
|
||||
│ └── contents.xcworkspacedata (references MyRig.xcodeproj)
|
||||
└── MyRig/
|
||||
├── Info.plist
|
||||
├── MyRigApp.swift (@main SwiftUI App — ShoeGazeView root)
|
||||
└── MyRigAppModel.swift (@Observable model — engine + ShoeGaze)
|
||||
```
|
||||
|
||||
Open `MyRig.xcworkspace` in Xcode, select an iPhone/iPad simulator or device, and run. The generated app:
|
||||
|
||||
- Activates `AVAudioSession(.playback)` and queries the hardware sample rate at init so pitch and timing are accurate on all devices.
|
||||
- Builds a default board (Overdrive → Delay → Reverb → Modulation) with the `.testLoop` input source.
|
||||
- Wraps `ShoeGazeView` in a `NavigationStack` + `ScrollView` for compact-screen compatibility.
|
||||
|
||||
Key differences from the macOS `shoegaze` template:
|
||||
|
||||
| | `shoegaze` (macOS Xcode) | `shoegaze-ios` (iOS Xcode) |
|
||||
|---|---|---|
|
||||
| Project type | `.xcodeproj` app bundle | `.xcodeproj` app bundle |
|
||||
| Driver | `CoreAudioDriver` | `iOSAudioDriver` |
|
||||
| Session | — | `AVAudioSession(.playback)` |
|
||||
| Entry point | SwiftUI `@main App` | SwiftUI `@main App` |
|
||||
| Window sizing | `.frame(minWidth:minHeight:)` | device-fill, no min size |
|
||||
| Menu | Audio ▸ Mute ⌘M | — |
|
||||
|
||||
### Live audio input on iOS
|
||||
|
||||
The generated template uses `.testLoop` and `numInputChannels: 0`. To switch to microphone input:
|
||||
|
||||
1. Change `numInputChannels: 0` to `numInputChannels: 1` in `MyRigAppModel.swift`.
|
||||
2. Change `.playback` to `.playAndRecord` (mode: `.default`, options: `[.defaultToSpeaker]`) in the `AVAudioSession` setup.
|
||||
3. Add `NSMicrophoneUsageDescription` to `Info.plist` (required for App Store submission and the system permission prompt).
|
||||
4. Change `ShoeGaze(engine: eng)` to `ShoeGaze(engine: eng, inputSource: .liveInput(channel: 0))`.
|
||||
|
||||
---
|
||||
|
||||
## Extending the starter app
|
||||
|
||||
- Add more pedals in `applicationDidFinishLaunching` with additional `board.add(...)` calls.
|
||||
- Create a second board with `shoeGaze.addBoard()` — `ShoeGazeView` shows all boards.
|
||||
- Write a custom pedal: subclass `Pedal`, override `effect(_:)` (return a mono signal) and `effectKnobs`. The base class handles wet/dry, bypass, and level; `PedalView` picks up the knobs automatically.
|
||||
- Switch to live audio: construct `ShoeGaze(engine:, inputSource: .liveInput(channel: 0))` and set `numInputChannels` ≥ 1 in the engine init (plus the microphone entitlement / `NSMicrophoneUsageDescription`).
|
||||
@@ -85,16 +85,12 @@ lyrebird new 1stPiece # error: not a valid Swift module name
|
||||
**Templates** — `--template <name>`:
|
||||
|
||||
- SPM-only (open `Package.swift` in Xcode): `basic` (default), `demo`, `ui-demo`, `nrt`, `score`
|
||||
- Xcode-project (ships `.xcodeproj` + `.xcworkspace`, builds to `.app` or `.appex`): `shoegaze`, `shoegaze-ios`, `macos-ui-xcode`, `ios-ui`, `auv3`
|
||||
- Xcode-project (ships `.xcodeproj` + `.xcworkspace`, builds to `.app` or `.appex`): `macos-ui-xcode`, `ios-ui`, `auv3`
|
||||
|
||||
```sh
|
||||
lyrebird new MyApp --template macos-ui-xcode # macOS .app
|
||||
lyrebird new MyApp --template ios-ui # iOS .app
|
||||
lyrebird new MyPlugin --template auv3 # AUv3 host + .appex
|
||||
lyrebird new MyRig --template shoegaze \
|
||||
--shoegaze-path /path/to/ShoeGaze # macOS guitar pedalboard (.xcodeproj, .app)
|
||||
lyrebird new MyRig --template shoegaze-ios \
|
||||
--shoegaze-path /path/to/ShoeGaze # iOS guitar pedalboard (.xcodeproj, .app)
|
||||
```
|
||||
|
||||
**Local Lyrebird checkout** — `--lyrebird-path <abs-path>` makes the generated project depend on a local Lyrebird checkout (via `.package(name: "Lyrebird", path: ...)` in `Package.swift`, `XCLocalSwiftPackageReference` in `<name>.xcodeproj`). Use while the published repo URL isn't yet accessible:
|
||||
@@ -104,15 +100,7 @@ lyrebird new MyApp --template macos-ui-xcode \
|
||||
--lyrebird-path /Users/me/Documents/LyrebirdII
|
||||
```
|
||||
|
||||
**Local ShoeGaze checkout** — `--shoegaze-path <abs-path>` (shoegaze / shoegaze-ios templates) wires the `LyrebirdShoeGaze` package as a local SPM dependency. Omitting this flag emits a placeholder remote URL in the generated project; edit it or re-run with `--shoegaze-path` once ShoeGaze is published. The placeholder URL is `ProjectScaffolder.shoegazePackageURL`.
|
||||
|
||||
```sh
|
||||
lyrebird new MyRig --template shoegaze-ios \
|
||||
--lyrebird-path /Users/me/Documents/LyrebirdII \
|
||||
--shoegaze-path /Users/me/Documents/LyrebirdII/ShoeGaze
|
||||
```
|
||||
|
||||
See `docs/tooling/project-system.md` for the layout each template emits. See `docs/stdlib/shoegaze.md` for the ShoeGaze package concepts and workflow.
|
||||
See `docs/tooling/project-system.md` for the layout each template emits. Guitar-pedalboard app scaffolding lives in the standalone ShoeGaze repo, which depends on Lyrebird.
|
||||
|
||||
If the directory already exists, the command fails cleanly and leaves the filesystem unchanged.
|
||||
|
||||
|
||||
@@ -48,11 +48,9 @@ Xcode-project templates (ship a real `.xcodeproj` for deliverables SwiftPM can't
|
||||
|
||||
| Template | Command | Description |
|
||||
|---|---|---|
|
||||
| `shoegaze` | `lyrebird new MyRig --template shoegaze --shoegaze-path <path>` | macOS guitar-pedalboard `.app` (Xcode, SwiftUI `@main`). Generates a full `.xcodeproj` with a `ShoeGazeView` root view, an `@Observable` app model wiring `CoreAudioDriver` + `ShoeGaze`, and an **Audio ▸ Mute ⌘M** menu command. `NSMicrophoneUsageDescription` pre-wired for `.liveInput`. Default board: Overdrive→Delay→Reverb→Modulation fed by the built-in test loop. Requires `--shoegaze-path` until `LyrebirdShoeGaze` is published |
|
||||
| `macos-ui-xcode` | `lyrebird new MyApp --template macos-ui-xcode` | macOS `.app` (AppKit + SwiftUI), `@UIParam` synth, hardened runtime |
|
||||
| `ios-ui` | `lyrebird new MyApp --template ios-ui` | iOS `.app` (SwiftUI + `iOSAudioDriver`), `AVAudioSession` activation, iPhone + iPad device family |
|
||||
| `auv3` | `lyrebird new MyPlugin --template auv3` | AUv3 host `.app` + `aumu` `.appex` subclassing `LyrebirdAudioUnit`. Entitlements for both. Subtype + manufacturer pre-filled (manufacturer = `LYRB` placeholder — rewrite for distribution) |
|
||||
| `shoegaze-ios` | `lyrebird new MyRig --template shoegaze-ios --shoegaze-path <path>` | iOS guitar-pedalboard `.app` (SwiftUI + `iOSAudioDriver`). Generates a full `.xcodeproj` with a `ShoeGazeView` root view and an `@Observable` app model wiring `AVAudioSession` + `ShoeGaze`. Default board: Overdrive→Delay→Reverb→Modulation fed by the built-in test loop. Adds `LyrebirdShoeGaze` + `LyrebirdShoeGazeUI` to the project's SPM deps. Requires `--shoegaze-path` until `LyrebirdShoeGaze` is published |
|
||||
|
||||
Each Xcode-project template lays out:
|
||||
|
||||
|
||||
@@ -108,17 +108,6 @@ All six Tier 3 templates compile in projects depending on Lyrebird as a Swift
|
||||
Package and are reported as `OK (external)` by the validator. None require
|
||||
LyrebirdUI.
|
||||
|
||||
### Tier 4 — sample-project templates (ShoeGaze)
|
||||
|
||||
| Template | Generates | Use when |
|
||||
|---|---|---|
|
||||
| **ShoeGaze Pedal** | `final class <Name>: Pedal` with an `@UIParam` knob, a stubbed `effect(_:)` returning the processed mono signal, and an `effectKnobs` override publishing its knobs | Adding a new guitar pedal to a project using the ShoeGaze sample package. The base `Pedal` handles wet/dry `mix`, click-free `bypass`, and `level`; `PedalView` renders the published knobs. |
|
||||
|
||||
The ShoeGaze Pedal template requires the **LyrebirdShoeGaze** package (it imports
|
||||
`LyrebirdShoeGaze` and `LyrebirdUI`), not just core Lyrebird. Use it inside a
|
||||
project scaffolded with `lyrebird new --template shoegaze`, or any target that
|
||||
depends on the ShoeGaze package. See [`../stdlib/shoegaze.md`](../stdlib/shoegaze.md).
|
||||
|
||||
Each template prompts for a name in Xcode's dialog. The name becomes both the file
|
||||
name and the top-level identifier inside the file.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user