Fix plist copyright; move macOS Save/Load to the menu bar

- Info.plists: "Realized Sound" -> "realizedsound" in the copyright string
  (all four demo apps).
- macOS: Save/Load now live in a File menu (Save Rig… ⌘S, Load Rig… ⌘O)
  and a Board menu (Add Board ⌘B, Start ⌘R, Stop ⌘.) in the app shell's
  AppDelegate; the in-view Save…/Load… buttons and their NSPanel code are
  now iOS-only (#if !os(macOS)), with iOS keeping fileExporter/Importer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 09:39:06 -07:00
parent 6c1859c59d
commit 8ffc1caa42
6 changed files with 116 additions and 30 deletions
+100
View File
@@ -6,6 +6,7 @@
#if os(macOS)
import AppKit
import UniformTypeIdentifiers
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
@@ -50,6 +51,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
private let shoeGaze: ShoeGaze
private let window: LyrebirdWindow
/// Transport menu items, retained so `validateMenuItem(_:)` can enable/disable them.
private var startMenuItem: NSMenuItem?
private var stopMenuItem: NSMenuItem?
/// Default file name offered by the Save panel.
private static let defaultRigFileName: String = "ShoeGazeRig"
// MARK: - Init
override init() {
@@ -152,7 +160,99 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
keyEquivalent: "q"
)
// File menu — rig save / load.
let fileMenuItem: NSMenuItem = NSMenuItem()
mainMenu.addItem(fileMenuItem)
let fileMenu: NSMenu = NSMenu(title: "File")
fileMenuItem.submenu = fileMenu
addItem(to: fileMenu, title: "Save Rig…", action: #selector(saveRigAction(_:)), key: "s")
addItem(to: fileMenu, title: "Load Rig…", action: #selector(loadRigAction(_:)), key: "o")
// Board menu — add board + transport.
let boardMenuItem: NSMenuItem = NSMenuItem()
mainMenu.addItem(boardMenuItem)
let boardMenu: NSMenu = NSMenu(title: "Board")
boardMenuItem.submenu = boardMenu
addItem(to: boardMenu, title: "Add Board", action: #selector(addBoardAction(_:)), key: "b")
boardMenu.addItem(NSMenuItem.separator())
startMenuItem = addItem(to: boardMenu, title: "Start", action: #selector(startAction(_:)), key: "r")
stopMenuItem = addItem(to: boardMenu, title: "Stop", action: #selector(stopAction(_:)), key: ".")
NSApplication.shared.mainMenu = mainMenu
}
/// Adds a menu item targeting this delegate and returns it.
@discardableResult
private func addItem(
to menu: NSMenu,
title: String,
action: Selector,
key: String
) -> NSMenuItem {
let item: NSMenuItem = NSMenuItem(title: title, action: action, keyEquivalent: key)
item.target = self
menu.addItem(item)
return item
}
// MARK: - Menu actions
@objc private func saveRigAction(_ sender: Any?) {
let panel: NSSavePanel = NSSavePanel()
panel.allowedContentTypes = [.json]
panel.nameFieldStringValue = "\(AppDelegate.defaultRigFileName).json"
panel.canCreateDirectories = true
let session: ShoeGaze = shoeGaze
panel.begin { response in
guard response == .OK, let url: URL = panel.url else { return }
do { try session.saveRig(to: url) }
catch { print("[ShoeGazeBuilder] saveRig failed: \(error)") }
}
}
@objc private func loadRigAction(_ sender: Any?) {
let panel: NSOpenPanel = NSOpenPanel()
panel.allowedContentTypes = [.json]
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
let session: ShoeGaze = shoeGaze
let activeEngine: SynthesisEngine = engine
panel.begin { response in
guard response == .OK, let url: URL = panel.url else { return }
// loadRig rebuilds the graph; stop the engine around it and restart if it was running.
let wasRunning: Bool = activeEngine.isRunning
if wasRunning { activeEngine.stop() }
do { try session.loadRig(from: url) }
catch { print("[ShoeGazeBuilder] loadRig failed: \(error)") }
if wasRunning { try? activeEngine.start() }
}
}
@objc private func addBoardAction(_ sender: Any?) {
var created: PedalBoard?
do {
let board: PedalBoard = try shoeGaze.addBoard()
created = board
try shoeGaze.finalizeBoard(board)
} catch {
if let board: PedalBoard = created { shoeGaze.removeBoard(board) }
print("[ShoeGazeBuilder] addBoard failed: \(error)")
}
}
@objc private func startAction(_ sender: Any?) {
do { try engine.start() }
catch { print("[ShoeGazeBuilder] engine.start() failed: \(error)") }
}
@objc private func stopAction(_ sender: Any?) {
engine.stop()
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if menuItem == startMenuItem { return !engine.isRunning }
if menuItem == stopMenuItem { return engine.isRunning }
return true
}
}
#endif
+1 -1
View File
@@ -23,7 +23,7 @@
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Realized Sound. All rights reserved.</string>
<string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key>
<string>ShoeGaze Builder can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
<key>NSPrincipalClass</key>
+1 -1
View File
@@ -19,7 +19,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Realized Sound. All rights reserved.</string>
<string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key>
<string>ShoeGaze Builder can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
<key>UIApplicationSceneManifest</key>
+1 -1
View File
@@ -23,7 +23,7 @@
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Realized Sound. All rights reserved.</string>
<string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key>
<string>ShoeGazeDemo can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
<key>NSPrincipalClass</key>
+1 -1
View File
@@ -19,7 +19,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Realized Sound. All rights reserved.</string>
<string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key>
<string>ShoeGazeiOSDemo can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
<key>UIApplicationSceneManifest</key>