v1.2.3 release: remove ShoeGaze CLI scaffolding (ShoeGaze now standalone)

This commit is contained in:
2026-07-04 22:48:23 -07:00
parent 8a2eb191a2
commit c058493a98
21 changed files with 284 additions and 2183 deletions
+2 -16
View File
@@ -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":
+4 -31
View File
@@ -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.
+6 -137
View File
@@ -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.
@@ -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>
@@ -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),
]
}
}