diff --git a/Demos/LyrebirdScratch/LyrebirdScratch.xcodeproj/project.pbxproj b/Demos/LyrebirdScratch/LyrebirdScratch.xcodeproj/project.pbxproj
index 738b907..44bc1da 100644
--- a/Demos/LyrebirdScratch/LyrebirdScratch.xcodeproj/project.pbxproj
+++ b/Demos/LyrebirdScratch/LyrebirdScratch.xcodeproj/project.pbxproj
@@ -144,6 +144,17 @@
};
/* End PBXProject section */
+/* Begin PBXResourcesBuildPhase section */
+ C8D00000000000000000013 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C8D00000000000000000041 /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
/* Begin PBXShellScriptBuildPhase section */
C8D00000000000000000042 /* Bundle Lyrebird swiftmodules */ = {
isa = PBXShellScriptBuildPhase;
@@ -162,17 +173,6 @@
};
/* End PBXShellScriptBuildPhase section */
-/* Begin PBXResourcesBuildPhase section */
- C8D00000000000000000013 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- C8D00000000000000000041 /* Assets.xcassets in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
/* Begin PBXSourcesBuildPhase section */
C8D00000000000000000011 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -189,14 +189,14 @@
C8D00000000000000000016 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
AUTOMATION_APPLE_EVENTS = NO;
CODE_SIGN_ENTITLEMENTS = LyrebirdScratch/LyrebirdScratch.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
+ CURRENT_PROJECT_VERSION = 2;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_HARDENED_RUNTIME = YES;
@@ -206,12 +206,14 @@
ENABLE_RESOURCE_ACCESS_CONTACTS = NO;
ENABLE_RESOURCE_ACCESS_LOCATION = NO;
ENABLE_RESOURCE_ACCESS_PHOTO_LIBRARY = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = LyrebirdScratch/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
+ MARKETING_VERSION = 1.6.2;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.LyrebirdScratch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -229,14 +231,14 @@
C8D00000000000000000017 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
AUTOMATION_APPLE_EVENTS = NO;
CODE_SIGN_ENTITLEMENTS = LyrebirdScratch/LyrebirdScratch.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
+ CURRENT_PROJECT_VERSION = 2;
DEAD_CODE_STRIPPING = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_RESOURCE_ACCESS_AUDIO_INPUT = YES;
@@ -245,12 +247,14 @@
ENABLE_RESOURCE_ACCESS_CONTACTS = NO;
ENABLE_RESOURCE_ACCESS_LOCATION = NO;
ENABLE_RESOURCE_ACCESS_PHOTO_LIBRARY = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = LyrebirdScratch/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
+ MARKETING_VERSION = 1.6.2;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.LyrebirdScratch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/Demos/LyrebirdScratch/LyrebirdScratch/Info.plist b/Demos/LyrebirdScratch/LyrebirdScratch/Info.plist
index ebda081..ca565b0 100644
--- a/Demos/LyrebirdScratch/LyrebirdScratch/Info.plist
+++ b/Demos/LyrebirdScratch/LyrebirdScratch/Info.plist
@@ -13,9 +13,9 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.1
+ 1.6.3
CFBundleVersion
- 1
+ 3
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
NSHumanReadableCopyright
diff --git a/RELEASES.md b/RELEASES.md
index 0eb2e21..b1f04e3 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -7,6 +7,36 @@ functionality in a backward-compatible way.
---
+## 1.6.3 — Notarization-ready `macos-ui-xcode` template
+
+A patch release. Project-scaffolding fixes; no library API changes.
+
+The `macos-ui-xcode` template (`lyrebird new MyApp --template macos-ui-xcode`)
+now scaffolds a distributable, notarization-ready macOS performance app out of
+the box:
+
+- **Entitlements shipped and wired** — `.entitlements` grants
+ `com.apple.security.device.audio-input` (wired via `CODE_SIGN_ENTITLEMENTS`
+ in both build configs), plus `NSMicrophoneUsageDescription` in `Info.plist`.
+ Under the Hardened Runtime (already enabled) the OS hard-kills the process the
+ moment the AUHAL input bus opens without these. They are harmless for
+ output-only synths — no permission prompt fires until input is actually used.
+ The app is deliberately **unsandboxed**: a live-performance app needs
+ unrestricted audio-device / file / MIDI / OSC access the App Sandbox gates.
+
+- **Compiles under Swift 6** — fixed a latent actor-isolation error that kept
+ the generated project from building: `NoteController` (calls the engine's
+ `@MainActor add(_:)`) and `AppDelegate` (constructs the main-actor controller
+ and synth) are now `@MainActor`. Xcode app templates are excluded from the
+ `swift build` CI matrix, so this had never been compile-checked; it is now
+ verified end-to-end with `xcodebuild`.
+
+A normal Lyrebird app needs no module-bundling: Lyrebird is statically linked
+from SPM source. (The swiftmodule / `LyrebirdC` bundling in `LyrebirdScratch`,
+added in 1.6.2, is unique to its runtime `swiftc` scratchpad.)
+
+---
+
## 1.6.2 — Live Scratch: distributable / notarized app
A patch release. Live Scratch packaging only; no library API changes.
diff --git a/Sources/LyrebirdCLI/ProjectScaffolder+MacOSUIXcode.swift b/Sources/LyrebirdCLI/ProjectScaffolder+MacOSUIXcode.swift
index e54811b..5648920 100644
--- a/Sources/LyrebirdCLI/ProjectScaffolder+MacOSUIXcode.swift
+++ b/Sources/LyrebirdCLI/ProjectScaffolder+MacOSUIXcode.swift
@@ -41,6 +41,7 @@ extension ProjectScaffolder {
/* 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 = ""; };
+ \t\t\(pbxAppEntitlementsRef) /* \(name).entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = \(name).entitlements; sourceTree = ""; };
\t\t\(pbxMainSwiftRef) /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; };
\t\t\(pbxAppDelegateRef) /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
\t\t\(pbxSynthRef) /* \(name)Synth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)Synth.swift; sourceTree = ""; };
@@ -85,6 +86,7 @@ extension ProjectScaffolder {
\t\t\t\t\(pbxNoteControllerRef) /* NoteController.swift */,
\t\t\t\t\(pbxViewRef) /* \(name)View.swift */,
\t\t\t\t\(pbxInfoPlistRef) /* Info.plist */,
+ \t\t\t\t\(pbxAppEntitlementsRef) /* \(name).entitlements */,
\t\t\t);
\t\t\tpath = \(name);
\t\t\tsourceTree = "";
@@ -177,6 +179,7 @@ extension ProjectScaffolder {
\t\t\(pbxAppDebugConfig) /* Debug */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
+ \t\t\t\tCODE_SIGN_ENTITLEMENTS = \(name)/\(name).entitlements;
\t\t\t\tCODE_SIGN_STYLE = Automatic;
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
@@ -197,6 +200,7 @@ extension ProjectScaffolder {
\t\t\(pbxAppReleaseConfig) /* Release */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
+ \t\t\t\tCODE_SIGN_ENTITLEMENTS = \(name)/\(name).entitlements;
\t\t\t\tCODE_SIGN_STYLE = Automatic;
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
diff --git a/Sources/LyrebirdCLI/ProjectScaffolder+XcodeTemplates.swift b/Sources/LyrebirdCLI/ProjectScaffolder+XcodeTemplates.swift
index 44b0bb7..c37bbcf 100644
--- a/Sources/LyrebirdCLI/ProjectScaffolder+XcodeTemplates.swift
+++ b/Sources/LyrebirdCLI/ProjectScaffolder+XcodeTemplates.swift
@@ -122,6 +122,8 @@ extension ProjectScaffolder {
let files: [(String, String)] = [
((appGroupDir as NSString).appendingPathComponent("Info.plist"),
macOSAppInfoPlist(name: name)),
+ ((appGroupDir as NSString).appendingPathComponent("\(name).entitlements"),
+ macOSAppEntitlements()),
((appGroupDir as NSString).appendingPathComponent("main.swift"),
macOSAppMainSwift(name: name)),
((appGroupDir as NSString).appendingPathComponent("AppDelegate.swift"),
@@ -146,6 +148,35 @@ extension ProjectScaffolder {
appInfoPlist(name: name, platform: .macOS)
}
+ /// Entitlements for the standalone macOS performance app.
+ ///
+ /// Not sandboxed — a live-performance app needs unrestricted access to
+ /// audio devices, files (buffer load/render), MIDI, and OSC networking,
+ /// which the App Sandbox would gate. The one entitlement granted is
+ /// microphone / line-in: under the Hardened Runtime (enabled in the
+ /// pbxproj, and required for notarization) the OS hard-kills the process
+ /// the moment the AUHAL input bus opens unless this is present. It only
+ /// prompts the user when input is actually opened
+ /// (`numInputChannels > 0`), so it is harmless for output-only synths.
+ ///
+ /// If a project needs to load dynamic libraries signed by a different
+ /// team (e.g. a bundled `.dylib`), add
+ /// `com.apple.security.cs.disable-library-validation`. If it must ship on
+ /// the Mac App Store, add `com.apple.security.app-sandbox` and the
+ /// specific resource entitlements the piece uses instead.
+ static func macOSAppEntitlements() -> String {
+ """
+
+
+
+
+ com.apple.security.device.audio-input
+
+
+
+ """
+ }
+
static func macOSAppMainSwift(name: String) -> String {
"""
// \(name) — entry point
@@ -178,6 +209,9 @@ extension ProjectScaffolder {
import LyrebirdSynth
import LyrebirdUI
+ /// `@MainActor`: constructs the main-actor `NoteController` and synth,
+ /// and `NSApplicationDelegate` callbacks already run on the main actor.
+ @MainActor
final class AppDelegate: NSObject, NSApplicationDelegate {
let engine: SynthesisEngine
let controller: NoteController
@@ -246,6 +280,11 @@ extension ProjectScaffolder {
/// Owns engine + synth + scope; mediates start/stop from the UI so the
/// engine isn't kicked until user is ready (avoids first-block dropouts).
+ ///
+ /// `@MainActor`: this drives SwiftUI and calls the engine's
+ /// main-actor-isolated `add(_:)`, so the whole controller lives on the
+ /// main actor.
+ @MainActor
@Observable
final class NoteController {
@@ -385,9 +424,15 @@ extension ProjectScaffolder {
case .macOS:
minOSKey = "LSMinimumSystemVersion"
minOSValue = "$(MACOSX_DEPLOYMENT_TARGET)"
+ // The mic usage string is required whenever the app opens the
+ // AUHAL input bus: macOS crashes a Hardened-Runtime process on
+ // audio-input access if this key is absent. Harmless for
+ // output-only synths (no prompt fires until input opens).
extras = """
NSPrincipalClass
NSApplication
+ NSMicrophoneUsageDescription
+ \(name) uses audio input for live signal processing.
"""
case .iOS:
minOSKey = "MinimumOSVersion"
diff --git a/Tests/LyrebirdCLITests/ProjectScaffolderTests.swift b/Tests/LyrebirdCLITests/ProjectScaffolderTests.swift
index 9b9319e..c459bb4 100644
--- a/Tests/LyrebirdCLITests/ProjectScaffolderTests.swift
+++ b/Tests/LyrebirdCLITests/ProjectScaffolderTests.swift
@@ -280,6 +280,7 @@ struct ProjectScaffolderTests {
"MyMac/NoteController.swift",
"MyMac/MyMacView.swift",
"MyMac/Info.plist",
+ "MyMac/MyMac.entitlements",
]
for rel: String in expected {
let path: String = (root as NSString).appendingPathComponent(rel)
@@ -299,6 +300,15 @@ struct ProjectScaffolderTests {
#expect(src.contains("engine.remove(synth)"))
}
+ @Test func macOSAppControllerAndDelegateAreMainActor() {
+ // Both call the engine's @MainActor `add(_:)` / a main-actor synth
+ // init; without @MainActor the template fails to compile under Swift 6.
+ let controller: String = ProjectScaffolder.macOSAppNoteControllerSwift(name: "Foo")
+ #expect(controller.contains("@MainActor"))
+ let delegate: String = ProjectScaffolder.macOSAppDelegateSwift(name: "Foo")
+ #expect(delegate.contains("@MainActor"))
+ }
+
@Test func macOSAppViewHasStartStopButtons() {
let src: String = ProjectScaffolder.macOSAppViewSwift(name: "Foo")
#expect(src.contains("Start Engine"))
@@ -576,6 +586,29 @@ struct ProjectScaffolderTests {
#expect(pbx.contains("/local/Lyrebird"))
}
+ @Test func macOSAppPBXProjWiresEntitlementsAndHardenedRuntime() {
+ let pbx: String = ProjectScaffolder.macOSAppPBXProj(name: "Perf")
+ // Hardened Runtime + entitlements are both required for a notarized,
+ // distributable performance app that opens the AUHAL input bus.
+ #expect(pbx.contains("ENABLE_HARDENED_RUNTIME = YES"))
+ #expect(pbx.contains("CODE_SIGN_ENTITLEMENTS = Perf/Perf.entitlements;"))
+ #expect(pbx.contains("Perf.entitlements */ = {isa = PBXFileReference"))
+ }
+
+ @Test func macOSAppEntitlementsGrantAudioInputAndAreNotSandboxed() {
+ let ent: String = ProjectScaffolder.macOSAppEntitlements()
+ #expect(ent.contains("com.apple.security.device.audio-input"))
+ // A live-performance app must not be sandboxed — it needs free file /
+ // device / MIDI / OSC access the sandbox would gate.
+ #expect(!ent.contains("com.apple.security.app-sandbox"))
+ }
+
+ @Test func macOSAppInfoPlistHasMicrophoneUsageDescription() {
+ let plist: String = ProjectScaffolder.macOSAppInfoPlist(name: "Perf")
+ // Absent, a Hardened-Runtime process crashes on audio-input access.
+ #expect(plist.contains("NSMicrophoneUsageDescription"))
+ }
+
@Test func iOSAppPBXProjReferencesIPhoneOS() {
let pbx: String = ProjectScaffolder.iOSAppPBXProj(name: "Foo")
#expect(pbx.contains("SDKROOT = iphoneos"))
diff --git a/docs/tooling/project-system.md b/docs/tooling/project-system.md
index 73ed0f7..37f6a92 100644
--- a/docs/tooling/project-system.md
+++ b/docs/tooling/project-system.md
@@ -49,7 +49,7 @@ Xcode-project templates (ship a real `.xcodeproj` for deliverables SwiftPM can't
| Template | Command | Description |
|---|---|---|
-| `macos-ui-xcode` | `lyrebird new MyApp --template macos-ui-xcode` | macOS `.app` (AppKit + SwiftUI), `@UIParam` synth, hardened runtime |
+| `macos-ui-xcode` | `lyrebird new MyApp --template macos-ui-xcode` | macOS `.app` (AppKit + SwiftUI), `@UIParam` synth. Notarization-ready: hardened runtime + `.entitlements` (audio-input) + mic usage string, unsandboxed for performance |
| `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) |
@@ -62,7 +62,7 @@ Each Xcode-project template lays out:
│ └── xcshareddata/xcschemes/.xcscheme
├── .xcworkspace/
│ └── contents.xcworkspacedata (references .xcodeproj)
-├── / (app target sources + Info.plist [+ entitlements for auv3])
+├── / (app target sources + Info.plist [+ .entitlements for macos-ui-xcode / auv3])
│ └── ...
└── Extension/ (auv3 only — extension target + Info.plist + .entitlements)
└── ...
@@ -70,20 +70,26 @@ Each Xcode-project template lays out:
Lyrebird is pulled in via a remote SPM dependency on `https://realizedsound.mooo.com/josh/Lyrebird` (configurable via `ProjectScaffolder.lyrebirdPackageURL`). The scaffolded project lives anywhere on disk and does not need a local checkout.
-### Microphone input — not pre-wired in any template
+### Distribution & microphone input
-No template adds `NSMicrophoneUsageDescription` to the generated `Info.plist`, no template adds the hardened-runtime / sandbox audio-input capability, and the `ios-ui` template's `AVAudioSession` category is `.playback` (output only). Most pieces don't read live input, so the templates default to "no mic capability" rather than triggering a permission prompt on every first run.
+The `macos-ui-xcode` template is **notarization-ready and distributable for performance out of the box**. It ships:
+- **Hardened Runtime** enabled (required for Developer-ID notarization), and
+- `.entitlements` granting `com.apple.security.device.audio-input`, plus `NSMicrophoneUsageDescription` in `Info.plist`.
-If a piece needs live input (e.g. tapping the engine input bus into `ScopeCapture` or routing `In.Audio(bus: numOutputChannels)` through the graph), the project owner must add these themselves:
+The app is deliberately **not sandboxed** — a live-performance app needs unrestricted audio-device / file / MIDI / OSC access that the App Sandbox would gate. Nothing else is required to move the signed `.app` to another machine and run it: Lyrebird is statically linked (compiled from the SPM source), so there is no external module to bundle. (The bundled-swiftmodule dance in `LyrebirdScratch` is unique to its *runtime* `swiftc` scratchpad and does not apply to a normal Lyrebird app.)
-**Engine init** — set `numInputChannels > 0` and pass a non-nil `inputDeviceID` (macOS) when constructing `SynthesisEngine` / starting the driver.
+The audio-input entitlement + usage string are **harmless for output-only synths**: no permission prompt fires until the AUHAL input bus actually opens (`numInputChannels > 0`). They exist so a piece that *does* take live input works without the OS hard-killing the Hardened-Runtime process on first input access.
-**macOS** (`macos-ui-xcode`, `ui-demo` opened in Xcode, any AppKit/SwiftUI app):
-- Add `NSMicrophoneUsageDescription` (string explaining the use) to the target's `Info.plist`. Required since macOS 10.14 — without it the OS silently denies input access and `CoreAudioDriver` reads zeros.
-- If the app is sandboxed: add `com.apple.security.device.audio-input` to the `.entitlements` file. The `macos-ui-xcode` template ships unsandboxed; the `auv3` host app is sandboxed and will need the entitlement before the host can read mic in addition to hosting the plugin.
+If a piece needs live input (e.g. tapping the engine input bus into `ScopeCapture` or routing `In.Audio(bus: numOutputChannels)` through the graph):
+
+**Engine init** — set `numInputChannels > 0` and pass a non-nil `inputDeviceID` (macOS) when constructing `SynthesisEngine` / starting the driver. On `macos-ui-xcode` the mic entitlement + usage string are already present, so the first `start()` after that triggers the permission prompt directly.
+
+**Other knobs:**
+- **Mac App Store** target: add `com.apple.security.app-sandbox` to `.entitlements` plus the specific resource entitlements the piece uses. (Sandboxing is off by default precisely because most performance work is Developer-ID / direct-distribution, not App Store.)
+- **Loading a differently-signed dynamic library** (a bundled `.dylib`): add `com.apple.security.cs.disable-library-validation`.
**iOS** (`ios-ui`):
-- Add `NSMicrophoneUsageDescription` to the app `Info.plist`.
+- Add `NSMicrophoneUsageDescription` to the app `Info.plist` (not pre-wired — the iOS template is output-only by default).
- Change the `AVAudioSession` category in the generated `AppDelegate` / `App` activation block from `.playback` to `.playAndRecord` (typically `mode: .default` or `.measurement`, options `[.defaultToSpeaker, .allowBluetooth]` depending on routing needs). `.playback` is output-only and will return zero-filled input buffers regardless of the engine's `numInputChannels`.
The first `start()` call after these are in place triggers the system permission prompt. Until the user grants, input frames remain zero — a scope tap on input buses will draw a flat line.