25 Commits

Author SHA1 Message Date
josh 2c2ce06797 plist updates 2026-07-05 22:42:00 -07:00
josh 8b72957502 Update RELEASES.md 2026-07-05 20:48:01 +00:00
josh e051521c04 Release 2.0.0: metronome, rig mute + shortcuts, set-list ordering, per-rig persistence
- Visual metronome tempo indicator (pendulum playhead) replacing the flashing LED
- Rig Mute (Cmd-Z) hard-silence, distinct from Bypass Rig; wired to header, board menu, MIDI
- Keyboard shortcuts: Cmd-1..9 board switch, Cmd-Shift-1..0 set-list rig load, Cmd-Z mute
  (macOS native menus + iOS/iPadOS hardware keyboards)
- Rig set-list ordering: drag or Move Up/Down in the picker; order saved and archive-portable
- Persist tempo, input selection, and engine I/O with a rig (I/O applied via opt-in
  applyChannelLayout, not forced on load)
- Fix archive import colliding set-list positions with existing rigs
- Remove ShoeGazeDemo / ShoeGazeiOSDemo apps and projects; keep the two Builder apps
- Bump marketing version to 2.0.0 on both Builder projects; pin Lyrebird 1.2.3
- Add CHANGELOG.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 12:30:45 -07:00
josh 4b0cf65a2b v1.5.0 release: Looper pedal, iPad/iOS layout rework, Lyrebird 1.2.3
- New multitrack Looper pedal (catalog now 36): smart Loop footswitch,
  4 tracks with per-track mute, undo/reverse/timeline, beat-quantized
  Sync/Free transport, MIDI-mappable transport + track taps + Sync,
  stomp-style Reset, RT-safe.
- iPad/iOS canvas-first compact layout with composition panels in sheets;
  header compaction; scrollable Add-Pedal sheet; compact-sheet fixes.
- Bump Lyrebird dependency to 1.2.3.
- Fixes: transport-only Start no longer reverts Settings; drop stale
  doc + dead looperTimeline property.
- Bump app MARKETING_VERSION to 1.5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 23:00:28 -07:00
josh 0bfc25ace6 Address external review: transport-only Start must not revert Settings config
Review found a blocking bug: the compact header's transportOnly EngineConfigView
and the Settings-sheet EngineConfigView each own independent @State pending
config. reconfigureEngine mutates the engine in place, so the header instance's
.task(id: engine identity) never re-syncs — pressing Start there re-applied its
stale pending values, reverting rate/channel edits made in Settings. In
transportOnly mode, skip the reconfigure and just start the already-configured
engine.

Also: remove the unused isNarrow / horizontalSizeClass (dead code), and honor
showsFilterMenu in PedalPaletteView.horizontalBody (was only gated in vertical).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 22:13:33 -07:00
josh 426a288002 iPad portrait: give the scope strip its natural height so the legend doesn't overlap
The header scope was clamped to the compact inline height (76pt) in both
orientations; in the portrait full-width strip that clamp made the taller scope
(legend + 120pt lanes) overflow upward into the Rigs/Pedals/Settings row. Clamp
the height only for the inline landscape strip; portrait uses the natural height.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 22:05:18 -07:00
josh 12e83bd172 iPad: drop the header scope to a full-width strip below the rows in portrait
On narrower portrait widths (smaller iPads / split view) the inline scope overlaid
and clipped the header. Detect portrait by actual size (iPad is .regular in both
orientations) and, in portrait, move the scope to a full-width strip beneath the
control rows — using the ample portrait vertical space. Landscape keeps it inline
beside the transport. Header control rows + transport factored into shared
subviews.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:56:07 -07:00
josh bf1e09ede3 iPad header: close the gap between rows 1 and 2
The tall scope lived inside row 1, so it set row 1's height and left a gap above
the Tempo/Tuner row. Put the three left rows in their own VStack (tight
rowSpacing) with scope + transport as a right column spanning them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:46:03 -07:00
josh cd3aeb771b iPad header: three rows — rig controls inline, Tempo/Tuner own row
Split the header into the requested three rows:
  Row 1: ShoeGaze title · [Bypass · Mute · Help · MIDI filling to the scope] · scope · Start/Record
  Row 2: Tempo · Tuner
  Row 3: Rigs · Pedals · Settings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:40:23 -07:00
josh e75b50b157 iPad header: place performance controls inline, right of the title
Move the performance row (Tempo / Tuner / Bypass / Mute / Help / MIDI) up onto the
title row, filling the space between the title and the scope. As a horizontal
scroll view it flexes to the available gap — shows in full in landscape, scrolls
when tight in portrait — and no longer sits beneath the scope. The composition
sheet-openers (Rigs / Pedals / Settings) remain on the row beneath.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:28:18 -07:00
josh 6a3c4fdca9 iPad header: stop Mute toggle expanding; fix mixer overflow into CPU meters
- The switch Toggle filled the row, pushing Bypass / Mute / Help / MIDI far right
  under the scope. fixedSize keeps them contiguous next to Tempo/Tuner under the
  title.
- BoardBarView's control column (segmented picker + two sliders + bordered mute)
  is taller than 92pt with iOS control metrics and overflowed into the CPU meters;
  raise barHeight to 110.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:21:44 -07:00
josh 22ae022143 iPad header: group rig controls with Tempo/Tuner; rename title to "ShoeGaze"
Move the rig-wide controls (Bypass / Mute rig / Help / MIDI) off the composition
row and onto a performance row alongside Tempo/Tuner, under the title — separating
performance controls from the composition sheet-openers (Rigs / Pedals /
Settings), which now get their own row. Both rows are full-width so nothing clips
in portrait.

Rename the header title from "ShoeGaze Builder" to "ShoeGaze" — it's an app now,
not a template placeholder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:12:54 -07:00
josh 722c8d9069 iPad: move header panel row to full width so it isn't clipped in portrait
The panel/toggle row (Rigs / Pedals / Settings / Bypass / Mute rig / help / MIDI)
sat in the header's left column beside the wide scope, so in the narrower
portrait width its right end (Mute rig, help, MIDI) was cut off. Move it to a
full-width row beneath the title + scope + transport; it now fits portrait and
still scrolls on very narrow (split-view) widths. Tempo/Tuner stay under the
title.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 21:02:29 -07:00
josh 1c9979af52 iOS Demo: pin host fill frame to topLeading
Belt-and-suspenders: the host fill frame used the default center alignment, so if
the builder ever reported intrinsic height the window would center it (the portrait
symptom). Pin the host frame to .topLeading.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 20:21:27 -07:00
josh 36202a5e95 iOS Demo: host the builder directly, filled (fix portrait centering)
ShoeGazeBuilderiOSApp wrapped the builder in a NavigationStack with its own
title, duplicating the builder's header and leaving the content vertically
centered in portrait. Host ShoeGazeBuilderView directly with a fill frame and no
NavigationStack/title — the builder provides its own chrome and scroll regions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 19:44:02 -07:00
josh 19feb03fe8 Add-Pedal sheet: scrollable list, fixed header with type filter, stable size
The sheet couldn't scroll — PedalPaletteView doesn't self-wrap in a ScrollView
(the host must) and the sheet had none, so the list overflowed and drags just
resized the detent. Rework:

- Wrap the palette in a ScrollView; single fixed detent (fraction 0.82) so the
  sheet no longer resizes, and presentationContentInteraction(.scrolls) so drags
  scroll the list.
- Fixed header with the "Add Pedal" title, the type-filter menu, and Done —
  PedalPaletteView gains an external filter binding + showsFilterMenu flag so the
  filter can be hoisted out of the scrolling content.
- PedalCategory made public (+ Sendable) so the filter binding can cross the
  public palette init.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 17:21:49 -07:00
josh f97ba90ea6 iPad: compact the header, fill portrait, fix palette scroll + sheet padding
- Header: the panel-toggle row and Tempo/Tuner move into the left column under
  the title (beside the scope + transport), filling the dead vertical space; the
  top strip is now just the board mixer + CPU meters.
- Portrait: the root fills the window and pins top-leading so content is no
  longer vertically centered with large blank margins.
- Add-Pedal sheet: content scrolls instead of resizing the detent
  (presentationContentInteraction), and a visible toolbar background stops the
  title drawing over the first rows.
- Rigs sheet: add top padding so the "Rigs" title isn't flush to the edge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 15:54:56 -07:00
josh 67744ec89d iPad: move the scope into the header beside the transport
Reclaim the header's dead space: a narrow scope now sits left of a Start/Record
transport cluster in the compact header. The scope is removed from the top strip
(CPU meters stay), and the Record button moves up next to Start. The recording-
folder chooser (set-and-forget) moves into the Settings sheet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 15:00:55 -07:00
josh ba80573213 iPad polish: fix Tempo/Tuner truncation, sheet title overlap, cramped strip
- TempoView/TunerView toggles size to content (fixedSize) instead of a fixed
  96pt width that truncated "Tempo: On" to "Tempo:…" at iOS font sizes.
- Add-Pedal sheet uses an inline navigation title so the large title no longer
  draws over the palette list.
- Settings sheet lays the engine controls out in a plain scroll (not a Form),
  so the Start button isn't compressed to "S…"; input picker on its own row.
- Compact top strip separates Tempo/Tuner, the board mixer, and the scope with
  dividers and section spacing so they stop visually colliding.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:58:10 -07:00
josh efa193ea37 Fix compact sheets not presenting (one sheet per view node)
The Rigs / Pedals / Settings sheets were stacked as additional .sheet modifiers
on the main view node, which already hosts the MIDI and Help sheets. SwiftUI
presents at most one sheet per node, so the new ones silently never appeared.
Move each onto its own Color.clear anchor node (the pattern already used for the
board-manager sheet and the file importers/exporter).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:51:12 -07:00
josh 45b18b5ea8 iPad: use the sheet-based layout at every size; drop forced min width
The docked layout clipped on iPad even at iPad-Pro (regular) width because a
large macOS min-width hint forced content wider than the screen and the header
did not reflow. iPhone is not a target, so gate purely by platform: every iPad
size uses the canvas-first / sheet layout, macOS keeps the docked layout. Drop
the min-width/min-height frame on iOS so nothing is forced past the screen.

Add an isNarrow (horizontalSizeClass == .compact) hook reserved for
size-specific tuning of the smaller iPads / split view.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:44:53 -07:00
josh 5b343a2cce iOS compact layout: canvas-first with composition panels in sheets
On narrow widths (iPhone, iPad portrait / split view) the docked desktop layout
overflowed and left the board canvas cramped. Add a size-class-gated compact
layout; regular widths (macOS, wide iPad) are unchanged.

Compact:
- Root drops the always-docked rig sidebar; it opens from a "Rigs" sheet button.
- Header keeps performance controls on screen (title, Start/Stop, Record badge,
  Bypass, Mute rig) with a scrollable row of panel toggles.
- Composition panels move to bottom sheets: Pedals (palette + routing),
  Settings (sample rate / channel counts / input source), Rigs (library).
- Board mixer, scope, CPU meters, and Tempo/Tuner stay docked above the
  full-bleed board canvas.

EngineConfigView gains a transportOnly mode (Start/Stop button only) so the
transport stays in the compact header while the config controls live in the
Settings sheet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:33:19 -07:00
josh d07247e40e Address review: drop stale doc + dead looperTimeline property
- LooperPedal.widthUnits doc updated "double-width" -> triple-width.
- Remove the now-unreachable looperTimeline property (LooperTimelineView is
  rendered from looperColumnarContent; the columnar branch always intercepts
  the looper before defaultContent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 13:11:12 -07:00
josh bdfbe04713 Looper: wide 3-column layout to fit tall pedal without scrolling
The looper stacked too many sections to fit the board canvas. Render it (only)
in a wide, three-column layout at widthUnits = 3:

- Left column: loop timeline, Free/Sync switch, Reset footswitch.
- Centre column: the four effect knobs (2×2) over a Level + Bypass footer, with
  the Mix slot reserved empty so Bypass stays horizontally centred like a normal
  pedal.
- Right column: transport footswitches in a 2×2 grid — Record / Reverse over
  Stop / Cue Stop (ordered by label).

Every other pedal keeps the default single-column section stack (extracted into
PedalView.defaultContent, no behaviour change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 13:05:57 -07:00
josh 5090a9255f Looper reverse fix + header layout compaction + tempo toggle
Looper:
- Reverse now continues from the current play-head instead of jumping to
  duration-minus-position; anchor-based position tracking survives direction
  changes. Sync mode defers the flip to the next beat; Free applies immediately.
- Sync switch relabeled "Sync to Tempo".

Tempo/Tuner:
- Add a Tempo on/off toggle (ShoeGaze.setTempoEnabled) that hides the indicator
  and forces every tempo-dependent pedal switch (PedalSwitch.tempoDependent) off;
  PedalSwitchView disables such switches via the shoeGazeTempoEnabled environment.
- Tuner readout laid out inline; Tempo/Tuner pinned to fixed heights so toggling
  state no longer shifts surrounding layout.

Header:
- Collapsed to two rows: title + Tempo/Tuner (left, stacked) and engine options
  over input controls (right, trailing-aligned). TAP is a standard-height button.
- Removed the redundant Boards button; moved Clear into the board bar.
- Fixed the rig mute glyph size so toggling mute doesn't shift the volume row.

Help: added a Looper section documenting transport, Free/Sync, knobs, tracks,
and MIDI-assignable actions.

Tests: TempoEnableTests + looper reverse/deferral coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 12:31:11 -07:00
70 changed files with 2176 additions and 2414 deletions
+92
View File
@@ -0,0 +1,92 @@
# Changelog
All notable changes to ShoeGaze are recorded here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
[semantic versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] — 2026-07-05
Major release. Performance-focused: a visual metronome, a real rig mute with
keyboard control, and rigs that remember their tempo, input, and I/O — plus a
saveable set-list order for hands-free switching between rigs live. The version
jumps to 2.0.0 to align ShoeGaze's numbering with the wider project family.
### Added
- **Visual metronome tempo indicator.** A horizontal playhead sweeps wall-to-wall
once per beat with pendulum easing (it slows into each beat so you can anticipate
it), fades toward center, and flashes a glow on the downbeat. Replaces the single
flashing LED.
- **Rig Mute (⌘Z).** A hard gate that silences the entire rig output — distinct from
Bypass Rig, which passes your dry signal through. Reachable from the header, the
per-board volume row, the macOS Board menu, and MIDI.
- **Keyboard shortcuts** (macOS native menus + iOS/iPadOS hardware keyboards):
- `⌘1`–`⌘9` — switch to / solo boards 1–9.
- `⌘⇧1`–`⌘⇧9` and `⌘⇧0` — load set-list rigs 1–10 in library order.
- `⌘Z` — toggle rig mute.
All are listed in the in-app Help.
- **macOS menus.** Board ▸ Mute Rig and Board ▸ Bypass Rig (with live state), and a
Rigs ▸ Set List submenu whose ten slots map to `⌘⇧1`–`⌘⇧0` and track the current
library order.
- **Set-list ordering.** Reorder rigs in the picker by dragging a row or via each
rig's Move Up / Move Down menu. The order is saved and travels with an exported
archive; the top ten map to the `⌘⇧` shortcuts.
- **Per-rig persistence.** A saved rig now also stores its tempo (BPM + enabled
state) and input selection. Engine input/output channel counts are saved too, and
applied on demand via `applyChannelLayout(from:)` rather than forced on every load.
### Changed
- The header "Mute rig" toggle — which actually only set the tuner-mutes-rig
preference — is now a real rig-mute button. The tuner preference is relabeled
**"Mute while tuning"**.
- The rig library now honors a manual set-list order instead of sorting by name/date.
New rigs append to the end; renaming a rig keeps its position.
### Fixed
- Importing a rig archive into a non-empty library no longer collides set-list
positions with existing rigs — imported rigs append in archive order.
### Removed
- The **ShoeGazeDemo** (macOS) and **ShoeGazeiOSDemo** (iOS) minimal-player apps and
their Xcode projects. Only the full **ShoeGazeBuilder** (macOS) and
**ShoeGazeBuilderiOS** (iPad) apps remain.
### Compatibility
- Despite the major-version bump, rig persistence is backward-compatible: the new
tempo / input / I/O / set-list fields are additive and optional. Rigs saved by
earlier versions load unchanged (missing fields are ignored), and rigs saved by
2.0.0 still open in older builds (the new keys are ignored there). The 2.0.0 bump
reflects the scope of new features and version alignment, not a format break.
## [1.5.0] — 2026-07-04
- Looper pedal, iPad/iOS layout rework, Lyrebird 1.2.3.
## [1.4.0] — 2026-07-01
- Maintenance and refinements.
## [1.3.0] — 2026-06-28
- Rig / board sharing via the `.shoegaze` document type.
## [1.2.0] — 2026-06-28
- Ten new pedals, iCloud rig library, builder UI rework.
## [1.1.1] — 2026-06-26
- Info-button placement and region-lane drag-drop fix.
## [1.1.0] — 2026-06-26
- Refinements over the initial release.
## [1.0.0] — 2026-06-24
- Initial ShoeGaze release.
@@ -163,7 +163,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 8;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = HE5VJFE9E4; DEVELOPMENT_TEAM = HE5VJFE9E4;
@@ -176,7 +176,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.4.0; MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -194,7 +194,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 8;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = HE5VJFE9E4; DEVELOPMENT_TEAM = HE5VJFE9E4;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -206,7 +206,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.4.0; MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
+118 -1
View File
@@ -20,7 +20,7 @@ import LyrebirdShoeGazeUI
/// The engine is **not** started automatically; the user clicks Start in the builder's toolbar. /// The engine is **not** started automatically; the user clicks Start in the builder's toolbar.
/// On termination the engine is stopped to release Core Audio resources cleanly. /// On termination the engine is stopped to release Core Audio resources cleanly.
@MainActor @MainActor
final class AppDelegate: NSObject, NSApplicationDelegate { final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
// MARK: - Engine configuration constants // MARK: - Engine configuration constants
@@ -65,6 +65,26 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
/// Record toggle item, retained so `validateMenuItem(_:)` can flip its title + enabled state. /// Record toggle item, retained so `validateMenuItem(_:)` can flip its title + enabled state.
private var recordMenuItem: NSMenuItem? private var recordMenuItem: NSMenuItem?
/// Rig-mute toggle item, retained so `validateMenuItem(_:)` can flip its title + checkmark to
/// match the current mute state (which may also change from the UI, MIDI, or the tuner).
private var muteMenuItem: NSMenuItem?
/// Rig-bypass toggle item, retained so `validateMenuItem(_:)` can flip its title + checkmark to
/// match the current bypass state (which may also change from the UI or MIDI).
private var bypassMenuItem: NSMenuItem?
/// The Rigs ▸ Set List submenu, retained so its item titles can be refreshed to the current
/// library order each time it opens (via `menuNeedsUpdate(_:)`).
private var setListMenu: NSMenu?
/// The ten fixed ⌘⇧1…⌘⇧0 set-list items (tags 0…9). Their key equivalents fire whether or not
/// the menu is open; `validateMenuItem(_:)` disables slots with no rig, and `menuNeedsUpdate`
/// refreshes their titles to the rig names.
private var setListMenuItems: [NSMenuItem] = []
/// Number of set-list slots exposed as ⌘⇧1…⌘⇧0.
private static let setListSlotCount: Int = 10
/// The Help window, created lazily on first open and reused thereafter. /// The Help window, created lazily on first open and reused thereafter.
private var helpWindow: LyrebirdWindow? private var helpWindow: LyrebirdWindow?
@@ -283,6 +303,51 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
// Engine start/stop lives in the in-window EngineConfigView (with sample-rate/channel // Engine start/stop lives in the in-window EngineConfigView (with sample-rate/channel
// config and the mismatch alert), so the Board menu only adds boards. // config and the mismatch alert), so the Board menu only adds boards.
addItem(to: boardMenu, title: "Add Board", action: #selector(addBoardAction(_:)), key: "b") addItem(to: boardMenu, title: "Add Board", action: #selector(addBoardAction(_:)), key: "b")
boardMenu.addItem(NSMenuItem.separator())
// ⌘Z toggles rig mute (a hard silence of all output; distinct from Bypass Rig's dry
// passthrough). Owns the ⌘Z key equivalent on macOS; the in-window view binds it on iOS.
self.muteMenuItem = addItem(
to: boardMenu,
title: "Mute Rig",
action: #selector(toggleMuteAction(_:)),
key: "z"
)
// Bypass Rig routes every board to its dry input (pedals skipped) — distinct from Mute's
// hard silence. No key equivalent: ⌘B is Add Board, and Bypass has a prominent on-screen button.
self.bypassMenuItem = addItem(
to: boardMenu,
title: "Bypass Rig",
action: #selector(toggleBypassAction(_:)),
key: ""
)
// Rigs menu — a Set List of the top ten library rigs, each on ⌘⇧1…⌘⇧0. The items are
// fixed; their titles refresh to the current library order on open, and their key
// equivalents fire whether or not the menu is showing.
let rigsMenuItem: NSMenuItem = NSMenuItem()
mainMenu.addItem(rigsMenuItem)
let rigsMenu: NSMenu = NSMenu(title: "Rigs")
rigsMenuItem.submenu = rigsMenu
let setListItem: NSMenuItem = NSMenuItem(title: "Set List", action: nil, keyEquivalent: "")
rigsMenu.addItem(setListItem)
let setListSubmenu: NSMenu = NSMenu(title: "Set List")
setListSubmenu.delegate = self
setListItem.submenu = setListSubmenu
for slot: Int in 0 ..< AppDelegate.setListSlotCount {
// Slots 0…8 → ⌘⇧1…⌘⇧9; slot 9 → ⌘⇧0 (matches the physical number row).
let key: String = slot < 9 ? "\(slot + 1)" : "0"
let item: NSMenuItem = NSMenuItem(
title: "\(slot + 1). —",
action: #selector(loadRigSlotAction(_:)),
keyEquivalent: key
)
item.keyEquivalentModifierMask = [.command, .shift]
item.target = self
item.tag = slot
setListSubmenu.addItem(item)
setListMenuItems.append(item)
}
self.setListMenu = setListSubmenu
// Record menu — choose an output folder, then toggle recording. // Record menu — choose an output folder, then toggle recording.
let recordMenuItem: NSMenuItem = NSMenuItem() let recordMenuItem: NSMenuItem = NSMenuItem()
@@ -382,6 +447,25 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
} }
} }
@objc private func toggleMuteAction(_ sender: Any?) {
shoeGaze.toggleRigMuted()
// Reflect the new state immediately, not only on the next menu-open validation.
muteMenuItem?.title = shoeGaze.rigMuted ? "Unmute Rig" : "Mute Rig"
muteMenuItem?.state = shoeGaze.rigMuted ? .on : .off
}
@objc private func toggleBypassAction(_ sender: Any?) {
shoeGaze.toggleRigBypassed()
bypassMenuItem?.title = shoeGaze.rigBypassed ? "Re-engage Rig" : "Bypass Rig"
bypassMenuItem?.state = shoeGaze.rigBypassed ? .on : .off
}
/// Loads the set-list rig at the sender's slot tag. Forwards to the in-window builder (which
/// owns the current-rig state, the unsaved-changes prompt, and engine lifecycle) via notification.
@objc private func loadRigSlotAction(_ sender: NSMenuItem) {
NotificationCenter.default.post(name: .shoeGazeLoadRigSlot, object: sender.tag)
}
@objc private func addBoardAction(_ sender: Any?) { @objc private func addBoardAction(_ sender: Any?) {
var created: PedalBoard? var created: PedalBoard?
do { do {
@@ -421,12 +505,45 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
recordMenuItem?.title = shoeGaze.isRecording ? "Stop Recording" : "Start Recording" recordMenuItem?.title = shoeGaze.isRecording ? "Stop Recording" : "Start Recording"
} }
// MARK: - NSMenuDelegate
/// Refreshes the Set List item titles to the current library order each time the submenu opens.
/// Key equivalents fire independently of this (see `setListMenuItems`); this is display only.
func menuNeedsUpdate(_ menu: NSMenu) {
guard menu === setListMenu else { return }
let entries: [RigEntry] = library.entries
for item: NSMenuItem in setListMenuItems {
let slot: Int = item.tag
if slot < entries.count {
item.title = "\(slot + 1). \(entries[slot].name)"
} else {
item.title = "\(slot + 1). —"
}
}
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if menuItem == recordMenuItem { if menuItem == recordMenuItem {
menuItem.title = shoeGaze.isRecording ? "Stop Recording" : "Start Recording" menuItem.title = shoeGaze.isRecording ? "Stop Recording" : "Start Recording"
// Can always stop; can only start once a folder has been chosen. // Can always stop; can only start once a folder has been chosen.
return shoeGaze.isRecording || shoeGaze.recordingFolder != nil return shoeGaze.isRecording || shoeGaze.recordingFolder != nil
} }
if menuItem == muteMenuItem {
// Mute may have changed from the UI, MIDI, or the tuner — resync title + checkmark.
menuItem.title = shoeGaze.rigMuted ? "Unmute Rig" : "Mute Rig"
menuItem.state = shoeGaze.rigMuted ? .on : .off
return true
}
if menuItem == bypassMenuItem {
// Bypass may have changed from the UI or MIDI — resync title + checkmark.
menuItem.title = shoeGaze.rigBypassed ? "Re-engage Rig" : "Bypass Rig"
menuItem.state = shoeGaze.rigBypassed ? .on : .off
return true
}
if setListMenuItems.contains(menuItem) {
// A slot is live only when the library actually holds a rig at that position.
return menuItem.tag < library.entries.count
}
return true return true
} }
} }
+21 -21
View File
@@ -2,6 +2,21 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ShoeGaze Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>net.realizedsound.shoegaze</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@@ -13,9 +28,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.4.0</string> <string>2.0.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>7</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.music</string> <string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
@@ -40,32 +55,17 @@
<string>Any</string> <string>Any</string>
</dict> </dict>
</dict> </dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ShoeGaze Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>net.realizedsound.shoegaze</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <array>
<dict> <dict>
<key>UTTypeIdentifier</key>
<string>net.realizedsound.shoegaze</string>
<key>UTTypeDescription</key>
<string>ShoeGaze Document</string>
<key>UTTypeConformsTo</key> <key>UTTypeConformsTo</key>
<array> <array>
<string>public.json</string> <string>public.json</string>
</array> </array>
<key>UTTypeDescription</key>
<string>ShoeGaze Document</string>
<key>UTTypeIdentifier</key>
<string>net.realizedsound.shoegaze</string>
<key>UTTypeTagSpecification</key> <key>UTTypeTagSpecification</key>
<dict> <dict>
<key>public.filename-extension</key> <key>public.filename-extension</key>
@@ -161,7 +161,7 @@
CODE_SIGNING_REQUIRED = NO; CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements; CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = HE5VJFE9E4; DEVELOPMENT_TEAM = HE5VJFE9E4;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
@@ -172,7 +172,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.3; MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos; SDKROOT = iphoneos;
@@ -191,7 +191,7 @@
CODE_SIGNING_REQUIRED = NO; CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements; CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = HE5VJFE9E4; DEVELOPMENT_TEAM = HE5VJFE9E4;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze; INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze;
@@ -201,7 +201,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.3; MARKETING_VERSION = 2.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos; SDKROOT = iphoneos;
+32 -31
View File
@@ -2,6 +2,21 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ShoeGaze Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>net.realizedsound.shoegaze</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@@ -22,6 +37,18 @@
<string>Copyright © 2026 realizedsound. All rights reserved.</string> <string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>ShoeGaze Builder can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string> <string>ShoeGaze Builder can route a hardware input channel through your pedalboard. Enable microphone access to use Live Input mode.</string>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.net.realizedsound.ShoeGazeData</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>ShoeGaze</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
<key>UIApplicationSceneManifest</key> <key>UIApplicationSceneManifest</key>
<dict> <dict>
<key>UIApplicationSupportsMultipleScenes</key> <key>UIApplicationSupportsMultipleScenes</key>
@@ -40,45 +67,19 @@
<array> <array>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> <string>UIInterfaceOrientationPortrait</string>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.net.realizedsound.ShoeGazeData</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>ShoeGaze</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ShoeGaze Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>net.realizedsound.shoegaze</string>
</array>
</dict>
</array> </array>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <array>
<dict> <dict>
<key>UTTypeIdentifier</key>
<string>net.realizedsound.shoegaze</string>
<key>UTTypeDescription</key>
<string>ShoeGaze Document</string>
<key>UTTypeConformsTo</key> <key>UTTypeConformsTo</key>
<array> <array>
<string>public.json</string> <string>public.json</string>
</array> </array>
<key>UTTypeDescription</key>
<string>ShoeGaze Document</string>
<key>UTTypeIdentifier</key>
<string>net.realizedsound.shoegaze</string>
<key>UTTypeTagSpecification</key> <key>UTTypeTagSpecification</key>
<dict> <dict>
<key>public.filename-extension</key> <key>public.filename-extension</key>
@@ -13,8 +13,9 @@ import LyrebirdShoeGazeUI
/// lifetime of the app. The audio engine is **not** started automatically — the user presses /// lifetime of the app. The audio engine is **not** started automatically — the user presses
/// Start in ``ShoeGazeBuilderView``. The engine is stopped when the view disappears. /// Start in ``ShoeGazeBuilderView``. The engine is stopped when the view disappears.
/// ///
/// ``ShoeGazeBuilderView`` manages its own scroll regions (palette + builder), so it is hosted /// ``ShoeGazeBuilderView`` draws its own header/title and manages its own scroll regions (palette
/// directly rather than wrapped in an outer `ScrollView`. /// + board canvas), so it is hosted directly — no `NavigationStack`, title, or outer `ScrollView`.
/// A fill frame keeps it pinned to the full window so portrait isn't vertically centered.
@main @main
struct ShoeGazeBuilderiOSApp: App { struct ShoeGazeBuilderiOSApp: App {
@@ -23,7 +24,6 @@ struct ShoeGazeBuilderiOSApp: App {
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
NavigationStack {
ShoeGazeBuilderView( ShoeGazeBuilderView(
shoeGaze: model.shoeGaze, shoeGaze: model.shoeGaze,
library: model.library, library: model.library,
@@ -31,10 +31,8 @@ struct ShoeGazeBuilderiOSApp: App {
onEnableLiveInput: { model.enableLiveInput() }, onEnableLiveInput: { model.enableLiveInput() },
midi: model.midi midi: model.midi
) )
.navigationTitle("ShoeGaze Builder") .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.navigationBarTitleDisplayMode(.inline)
.task { await model.startLibrary() } .task { await model.startLibrary() }
}
.onDisappear { model.stop() } .onDisappear { model.stop() }
.onOpenURL { url in model.importDocument(at: url) } .onOpenURL { url in model.importDocument(at: url) }
} }
-397
View File
@@ -1,397 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objects = {
/* Begin PBXBuildFile section */
C3B000000000000000000020 /* LyrebirdShoeGaze in Frameworks */ = {isa = PBXBuildFile; productRef = C3B00000000000000000001E /* LyrebirdShoeGaze */; };
C3B000000000000000000021 /* LyrebirdShoeGazeUI in Frameworks */ = {isa = PBXBuildFile; productRef = C3B00000000000000000001F /* LyrebirdShoeGazeUI */; };
C3B000000000000000000022 /* Lyrebird in Frameworks */ = {isa = PBXBuildFile; productRef = C3B000000000000000000023 /* Lyrebird */; };
C3B000000000000000000024 /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = C3B000000000000000000025 /* LyrebirdUI */; };
C3B000000000000000000031 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3B000000000000000000030 /* Assets.xcassets */; };
C3B0000000000000000000C /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B000000000000000000007 /* main.swift */; };
C3B0000000000000000000D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B000000000000000000008 /* AppDelegate.swift */; };
C3B0000000000000000000E /* DemoRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B000000000000000000009 /* DemoRootView.swift */; };
C3B0000000000000000000F /* ShoeGazeDemoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B00000000000000000000A /* ShoeGazeDemoController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
C3B000000000000000000004 /* ShoeGazeDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ShoeGazeDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
C3B000000000000000000006 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C3B000000000000000000007 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
C3B000000000000000000008 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C3B000000000000000000009 /* DemoRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoRootView.swift; sourceTree = "<group>"; };
C3B00000000000000000000A /* ShoeGazeDemoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoeGazeDemoController.swift; sourceTree = "<group>"; };
C3B000000000000000000030 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
C3B000000000000000000012 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C3B000000000000000000020 /* LyrebirdShoeGaze in Frameworks */,
C3B000000000000000000021 /* LyrebirdShoeGazeUI in Frameworks */,
C3B000000000000000000022 /* Lyrebird in Frameworks */,
C3B000000000000000000024 /* LyrebirdUI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
C3B000000000000000000002 = {
isa = PBXGroup;
children = (
C3B000000000000000000005 /* ShoeGazeDemo */,
C3B000000000000000000003 /* Products */,
);
sourceTree = "<group>";
};
C3B000000000000000000003 /* Products */ = {
isa = PBXGroup;
children = (
C3B000000000000000000004 /* ShoeGazeDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
C3B000000000000000000005 /* ShoeGazeDemo */ = {
isa = PBXGroup;
children = (
C3B000000000000000000007 /* main.swift */,
C3B000000000000000000008 /* AppDelegate.swift */,
C3B000000000000000000009 /* DemoRootView.swift */,
C3B00000000000000000000A /* ShoeGazeDemoController.swift */,
C3B000000000000000000030 /* Assets.xcassets */,
C3B000000000000000000006 /* Info.plist */,
);
path = ShoeGazeDemo;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C3B000000000000000000014 /* ShoeGazeDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = C3B000000000000000000015 /* Build configuration list for PBXNativeTarget "ShoeGazeDemo" */;
buildPhases = (
C3B000000000000000000011 /* Sources */,
C3B000000000000000000012 /* Frameworks */,
C3B000000000000000000013 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ShoeGazeDemo;
packageProductDependencies = (
C3B00000000000000000001E /* LyrebirdShoeGaze */,
C3B00000000000000000001F /* LyrebirdShoeGazeUI */,
C3B000000000000000000023 /* Lyrebird */,
C3B000000000000000000025 /* LyrebirdUI */,
);
productName = ShoeGazeDemo;
productReference = C3B000000000000000000004 /* ShoeGazeDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
C3B000000000000000000001 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1600;
LastUpgradeCheck = 2620;
TargetAttributes = {
C3B000000000000000000014 = {
CreatedOnToolsVersion = 16.0;
};
};
};
buildConfigurationList = C3B000000000000000000018 /* Build configuration list for PBXProject "ShoeGazeDemo" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C3B000000000000000000002;
packageReferences = (
C3B00000000000000000001B /* XCLocalSwiftPackageReference ".." */,
C3B00000000000000000001C /* XCRemoteSwiftPackageReference "Lyrebird" */,
);
productRefGroup = C3B000000000000000000003 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
C3B000000000000000000014 /* ShoeGazeDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
C3B000000000000000000013 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3B000000000000000000031 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C3B000000000000000000011 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3B0000000000000000000C /* main.swift in Sources */,
C3B0000000000000000000D /* AppDelegate.swift in Sources */,
C3B0000000000000000000E /* DemoRootView.swift in Sources */,
C3B0000000000000000000F /* ShoeGazeDemoController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
C3B000000000000000000016 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeDemo/ShoeGazeDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = HE5VJFE9E4;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = ShoeGazeDemo/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
C3B000000000000000000017 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeDemo/ShoeGazeDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = HE5VJFE9E4;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = ShoeGazeDemo/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
C3B000000000000000000019 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
C3B00000000000000000001A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C3B000000000000000000015 /* Build configuration list for PBXNativeTarget "ShoeGazeDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C3B000000000000000000016 /* Debug */,
C3B000000000000000000017 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C3B000000000000000000018 /* Build configuration list for PBXProject "ShoeGazeDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C3B000000000000000000019 /* Debug */,
C3B00000000000000000001A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
C3B00000000000000000001B /* XCLocalSwiftPackageReference ".." */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ..;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCRemoteSwiftPackageReference section */
C3B00000000000000000001C /* XCRemoteSwiftPackageReference "Lyrebird" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://realizedsound.mooo.com/josh/Lyrebird";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
C3B00000000000000000001E /* LyrebirdShoeGaze */ = {
isa = XCSwiftPackageProductDependency;
package = C3B00000000000000000001B /* XCLocalSwiftPackageReference ".." */;
productName = LyrebirdShoeGaze;
};
C3B00000000000000000001F /* LyrebirdShoeGazeUI */ = {
isa = XCSwiftPackageProductDependency;
package = C3B00000000000000000001B /* XCLocalSwiftPackageReference ".." */;
productName = LyrebirdShoeGazeUI;
};
C3B000000000000000000023 /* Lyrebird */ = {
isa = XCSwiftPackageProductDependency;
package = C3B00000000000000000001C /* XCRemoteSwiftPackageReference "Lyrebird" */;
productName = Lyrebird;
};
C3B000000000000000000025 /* LyrebirdUI */ = {
isa = XCSwiftPackageProductDependency;
package = C3B00000000000000000001C /* XCRemoteSwiftPackageReference "Lyrebird" */;
productName = LyrebirdUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = C3B000000000000000000001 /* Project object */;
}
@@ -1,33 +0,0 @@
{
"originHash" : "cfdd71f4b32d744c862bbe26a8265d75aa9e906275b0fb1b63575b7d68be1b6a",
"pins" : [
{
"identity" : "linenoise-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/andybest/linenoise-swift",
"state" : {
"revision" : "afc897c02b030af7333105c4fedcd843a8339238",
"version" : "0.0.3"
}
},
{
"identity" : "lyrebird",
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "032b7c39d351eba4029e8399e1ab1ee201e8bb5c",
"version" : "1.2.0"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble.git",
"state" : {
"revision" : "e9d769113660769a4d9dd3afb855562c0b7ae7b0",
"version" : "7.3.4"
}
}
],
"version" : 3
}
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3B000000000000000000014"
BuildableName = "ShoeGazeDemo.app"
BlueprintName = "ShoeGazeDemo"
ReferencedContainer = "container:ShoeGazeDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3B000000000000000000014"
BuildableName = "ShoeGazeDemo.app"
BlueprintName = "ShoeGazeDemo"
ReferencedContainer = "container:ShoeGazeDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3B000000000000000000014"
BuildableName = "ShoeGazeDemo.app"
BlueprintName = "ShoeGazeDemo"
ReferencedContainer = "container:ShoeGazeDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
-153
View File
@@ -1,153 +0,0 @@
// AppDelegate.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS)
import AppKit
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdShoeGazeUI
/// Application delegate for the ShoeGaze demo.
///
/// Creates a `SynthesisEngine`, a `ShoeGazeDemoController` (which builds the default
/// `.boards` showcase automatically), and opens a `LyrebirdWindow` hosting `DemoRootView`.
///
/// The engine is **not** started automatically. The user clicks Start in `DemoRootView`'s
/// toolbar (or presses Stop to halt audio). On application termination, `stop()` is called
/// to release Core Audio resources cleanly.
@MainActor
final class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: - Engine configuration constants
private static let blockSize: Int = 512
private static let sampleRate: Double = 48_000.0
private static let outputChannels: Int = 2
// Built-in mics are mono; default to one input channel so live input works out of the box
// (CoreAudio can't satisfy more input channels than the device provides). Raise in the UI.
private static let inputChannels: Int = 1
private static let numAudioBuses: Int = 256
// MARK: - Window geometry constants
private static let windowWidth: CGFloat = 1_100
private static let windowHeight: CGFloat = 640
// MARK: - Owned objects
private let coreDriver: CoreAudioDriver
private let controller: ShoeGazeDemoController
private let window: LyrebirdWindow
/// The Mute menu item, retained so `validateMenuItem(_:)` can update its checkmark.
private var muteMenuItem: NSMenuItem?
// MARK: - Init
override init() {
let coreDriver: CoreAudioDriver = CoreAudioDriver()
let engine: SynthesisEngine = SynthesisEngine(
blockSize: AppDelegate.blockSize,
sampleRate: AppDelegate.sampleRate,
numOutputChannels: AppDelegate.outputChannels,
numInputChannels: AppDelegate.inputChannels,
numAudioBuses: AppDelegate.numAudioBuses,
driver: coreDriver
)
self.coreDriver = coreDriver
self.controller = ShoeGazeDemoController(engine: engine)
self.window = LyrebirdWindow(
title: "ShoeGaze — Lyrebird Guitar Pedalboard",
width: AppDelegate.windowWidth,
height: AppDelegate.windowHeight
)
super.init()
}
// MARK: - NSApplicationDelegate
func applicationDidFinishLaunching(_ notification: Notification) {
installMainMenu()
let demoController: ShoeGazeDemoController = controller
let driver: CoreAudioDriver = coreDriver
window.open {
DemoRootView(controller: demoController, hardwareSampleRate: { driver.deviceSampleRate })
}
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
true
}
func applicationWillTerminate(_ notification: Notification) {
controller.stop()
}
// MARK: - Main menu
/// Builds the app's menu bar: an application menu (About / Hide / Quit ⌘Q) and an
/// Audio menu (Mute ⌘M). Standard items route through the responder chain to
/// `NSApplication`; Mute targets this delegate.
private func installMainMenu() {
let appName: String = ProcessInfo.processInfo.processName
let mainMenu: NSMenu = NSMenu()
// Application menu.
let appMenuItem: NSMenuItem = NSMenuItem()
mainMenu.addItem(appMenuItem)
let appMenu: NSMenu = NSMenu()
appMenuItem.submenu = appMenu
appMenu.addItem(
withTitle: "About \(appName)",
action: #selector(NSApplication.orderFrontStandardAboutPanel(_:)),
keyEquivalent: ""
)
appMenu.addItem(NSMenuItem.separator())
appMenu.addItem(
withTitle: "Hide \(appName)",
action: #selector(NSApplication.hide(_:)),
keyEquivalent: "h"
)
appMenu.addItem(NSMenuItem.separator())
appMenu.addItem(
withTitle: "Quit \(appName)",
action: #selector(NSApplication.terminate(_:)),
keyEquivalent: "q"
)
// Audio menu.
let audioMenuItem: NSMenuItem = NSMenuItem()
mainMenu.addItem(audioMenuItem)
let audioMenu: NSMenu = NSMenu(title: "Audio")
audioMenuItem.submenu = audioMenu
let mute: NSMenuItem = NSMenuItem(
title: "Mute",
action: #selector(toggleMute(_:)),
keyEquivalent: "m"
)
mute.target = self
audioMenu.addItem(mute)
muteMenuItem = mute
NSApplication.shared.mainMenu = mainMenu
}
/// Toggles audio output (mute). Bound to the Audio ▸ Mute menu item (⌘M).
@objc private func toggleMute(_ sender: Any?) {
controller.toggleMute()
}
/// Shows a checkmark on the Mute item while audio is silenced (engine not running).
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
if menuItem == muteMenuItem {
menuItem.state = controller.isRunning ? .off : .on
}
return true
}
}
#endif
@@ -1,15 +0,0 @@
{
"images" : [
{"size":"16x16","idiom":"mac","filename":"icon_16x16.png","scale":"1x"},
{"size":"16x16","idiom":"mac","filename":"icon_16x16@2x.png","scale":"2x"},
{"size":"32x32","idiom":"mac","filename":"icon_32x32.png","scale":"1x"},
{"size":"32x32","idiom":"mac","filename":"icon_32x32@2x.png","scale":"2x"},
{"size":"128x128","idiom":"mac","filename":"icon_128x128.png","scale":"1x"},
{"size":"128x128","idiom":"mac","filename":"icon_128x128@2x.png","scale":"2x"},
{"size":"256x256","idiom":"mac","filename":"icon_256x256.png","scale":"1x"},
{"size":"256x256","idiom":"mac","filename":"icon_256x256@2x.png","scale":"2x"},
{"size":"512x512","idiom":"mac","filename":"icon_512x512.png","scale":"1x"},
{"size":"512x512","idiom":"mac","filename":"icon_512x512@2x.png","scale":"2x"}
],
"info" : {"author":"xcode","version":1}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

@@ -1 +0,0 @@
{ "info" : {"author":"xcode","version":1} }
-303
View File
@@ -1,303 +0,0 @@
// DemoRootView.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS)
import SwiftUI
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdShoeGazeUI
/// Root view for the ShoeGaze demo window.
///
/// Presents a top toolbar with a mode picker, an input-source toggle, and a Start/Stop
/// transport button, followed by a content area that switches between four showcase
/// modes as the user selects them.
///
/// Because `ShoeGazeDemoController` is `@Observable`, SwiftUI re-renders this view and
/// all its children whenever `controller.mode`, `controller.shoeGaze.boards`,
/// `controller.router`, `controller.parallelSection`, or `controller.isRunning` change —
/// including after a ``ShoeGazeDemoController/rebuild()`` that replaces `shoeGaze`.
///
/// ## Mode showcases
///
/// - `.boards` → `ShoeGazeView` — two boards, eight pedals, master gain per board.
/// - `.editor` → `BoardEditorView` — board + FlowLayout pedal area + version snapshots.
/// - `.parallel` → `ParallelSectionView` — splitter, two branch rows, merger (via board).
/// - `.router` → `ChainRouterView` — dual-board chain router with splitter + master.
/// - `.stereo` → `StereoSplitSectionView` — stereo split with the four route modes.
struct DemoRootView: View {
// MARK: - Layout constants
private static let toolbarSpacing: CGFloat = 10
private static let toolbarPadding: CGFloat = 12
private static let contentPadding: CGFloat = 16
private static let windowMinWidth: CGFloat = 1_100
private static let windowMinHeight: CGFloat = 640
/// Dark stage-floor background (warm almost-black).
private static let backgroundRed: Double = 0.08
private static let backgroundGreen: Double = 0.07
private static let backgroundBlue: Double = 0.06
private static let dividerOpacity: Double = 0.15
// MARK: - Properties
private let controller: ShoeGazeDemoController
private let hardwareSampleRate: () -> Double?
/// Bumped on each transport press so the buttons re-read `controller.isRunning`
/// (which derives from the non-observable engine).
@State private var transportTick: Bool = false
// MARK: - Init
/// Creates the root demo view bound to the given controller.
///
/// - Parameters:
/// - controller: The `ShoeGazeDemoController` that owns the engine, active `ShoeGaze`
/// session, and current mode. All toolbar actions dispatch through this.
/// - hardwareSampleRate: Returns the actual hardware sample rate (or `nil`), for the engine-
/// config mismatch warning. Defaults to `nil`.
init(
controller: ShoeGazeDemoController,
hardwareSampleRate: @escaping () -> Double? = { nil }
) {
self.controller = controller
self.hardwareSampleRate = hardwareSampleRate
}
// MARK: - Body
var body: some View {
VStack(spacing: 0) {
toolbar
Divider()
.overlay(Color.white.opacity(DemoRootView.dividerOpacity))
contentArea
.padding(DemoRootView.contentPadding)
Divider()
.overlay(Color.white.opacity(DemoRootView.dividerOpacity))
ShoeGazeScopeView(shoeGaze: controller.shoeGaze)
.padding(DemoRootView.contentPadding)
}
.frame(
minWidth: DemoRootView.windowMinWidth,
minHeight: DemoRootView.windowMinHeight
)
.background(
Color(
red: DemoRootView.backgroundRed,
green: DemoRootView.backgroundGreen,
blue: DemoRootView.backgroundBlue
)
)
.alert(
"Microphone Access Needed",
isPresented: Binding(
get: { controller.microphoneAccessDenied },
set: { controller.microphoneAccessDenied = $0 }
)
) {
Button("OK", role: .cancel) { }
} message: {
Text("Live input needs microphone access. Enable it in System Settings › Privacy & "
+ "Security › Microphone, then select the input again.")
}
}
// MARK: - Toolbar
/// Top toolbar: mode picker, input-source picker, transport, and CPU meter.
private var toolbar: some View {
HStack(spacing: DemoRootView.toolbarSpacing) {
modePicker
Spacer()
inputSourcePicker
// In Boards mode the pedalboard view (`ShoeGazeView`) supplies its own
// Start/Stop, so the board starts only when its own button is pressed. The
// other modes have no in-content transport, so show it here for them.
if controller.mode != .boards {
transportButtons
}
}
.padding(DemoRootView.toolbarPadding)
}
/// Segmented picker for `DemoMode`.
///
/// The selection binding's setter delegates to `controller.select(_:)` rather than
/// writing a `@State` directly, so the controller handles the mode switch and rebuild.
private var modePicker: some View {
let modeBinding: Binding<DemoMode> = Binding(
get: { controller.mode },
set: { controller.select($0) }
)
return Picker("Mode", selection: modeBinding) {
ForEach(DemoMode.allCases) { demoMode in
Text(demoMode.title).tag(demoMode)
}
}
.pickerStyle(.segmented)
.frame(maxWidth: 380)
.foregroundStyle(Color.white)
}
/// A `Binding<Int>` mapping the input Picker tag to `InputSource`.
///
/// Tag `-1` = `.testLoop`; tags `0 ..< numInputChannels` = `.liveInput(channel:)`.
/// Setting the binding calls `controller.setInputSource(_:)`.
private var inputSourceBinding: Binding<Int> {
Binding(
get: {
switch controller.inputSource {
case .testLoop:
return -1
case .liveInput(let channel):
return channel
}
},
set: { newValue in
if newValue == -1 {
controller.setInputSource(.testLoop)
} else {
controller.setInputSource(.liveInput(channel: newValue))
}
}
)
}
/// Picker listing "Test Loop" and one option per available hardware input channel.
///
/// When `engine.numInputChannels == 0` only "Test Loop" is shown; the live options
/// are omitted so the picker never offers channels that do not exist.
private var inputSourcePicker: some View {
HStack(spacing: DemoRootView.toolbarSpacing) {
Text("Input:")
.font(.subheadline)
.foregroundStyle(Color.white.opacity(0.65))
Picker("Input", selection: inputSourceBinding) {
Text("Test Loop").tag(-1)
ForEach(Array(0..<max(0, controller.engine.numInputChannels)), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
}
.pickerStyle(.menu)
.foregroundStyle(Color.white)
}
}
/// Engine configuration + transport (sample rate, ins/outs, Start/Stop, mismatch alert).
private var transportButtons: some View {
EngineConfigView(
shoeGaze: controller.shoeGaze,
hardwareSampleRate: hardwareSampleRate,
applyConfig: { rate, inputs, outputs in
try controller.reconfigure(
sampleRate: rate,
inputChannels: inputs,
outputChannels: outputs
)
},
onConfigApplied: { transportTick.toggle() }
)
}
// MARK: - Content area
/// The main content area switches view based on the active mode.
@ViewBuilder
private var contentArea: some View {
switch controller.mode {
case .boards:
ShoeGazeView(shoeGaze: controller.shoeGaze, hardwareSampleRate: hardwareSampleRate)
case .editor:
editorContent
case .parallel:
parallelContent
case .router:
routerContent
case .stereo:
stereoContent
}
}
/// `.editor` content: `BoardEditorView` bound to the first board in the session.
///
/// Shows a placeholder when the board list is unexpectedly empty (e.g. if
/// `buildEditor()` failed silently).
@ViewBuilder
private var editorContent: some View {
if controller.shoeGaze.boards.isEmpty {
Text("No editor board available.")
.foregroundStyle(Color.white.opacity(0.55))
} else {
BoardEditorView(
shoeGaze: controller.shoeGaze,
boardIndex: 0,
versionStore: controller.versionStore
)
}
}
/// `.parallel` content: the full board view (shows pre/post-split pedals) stacked
/// above `ParallelSectionView` which exposes the splitter mode picker and branch rows.
@ViewBuilder
private var parallelContent: some View {
if let section: ParallelSection = controller.parallelSection,
!controller.shoeGaze.boards.isEmpty {
let board: PedalBoard = controller.shoeGaze.boards[0]
ScrollView(.vertical, showsIndicators: true) {
VStack(alignment: .leading, spacing: 20) {
PedalBoardView(board: board)
ParallelSectionView(section: section)
}
}
} else {
Text("Parallel section unavailable.")
.foregroundStyle(Color.white.opacity(0.55))
}
}
/// `.stereo` content: the full board view (shows the pre-split pedal) stacked above a
/// width badge and `StereoSplitSectionView` (route picker + L/R branch rows).
@ViewBuilder
private var stereoContent: some View {
if let section: StereoSplitSection = controller.stereoSection,
let board: PedalBoard = controller.shoeGaze.boards.first {
ScrollView(.vertical, showsIndicators: true) {
VStack(alignment: .leading, spacing: 20) {
HStack(spacing: 10) {
PedalBoardView(board: board)
StereoWidthBadge(width: board.width)
}
StereoSplitSectionView(section: section)
}
}
} else {
Text("Stereo split unavailable.")
.foregroundStyle(Color.white.opacity(0.55))
}
}
/// `.router` content: `ChainRouterView` bound to the live `ChainRouter`.
@ViewBuilder
private var routerContent: some View {
if let chainRouter: ChainRouter = controller.router {
ScrollView(.vertical, showsIndicators: true) {
ChainRouterView(router: chainRouter)
}
} else {
Text("Chain router unavailable.")
.foregroundStyle(Color.white.opacity(0.55))
}
}
}
#endif
-32
View File
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<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>
<string>NSApplication</string>
</dict>
</plist>
@@ -1,8 +0,0 @@
<?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>com.apple.security.device.audio-input</key>
<true/>
</dict>
</plist>
@@ -1,371 +0,0 @@
// ShoeGazeDemoController.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS)
import Observation
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
// MARK: - DemoMode
/// The active showcase mode displayed in the demo window.
///
/// Each case corresponds to one full-window showcase of a distinct ShoeGaze feature.
/// Switching modes tears down the current audio graph and rebuilds it fresh.
enum DemoMode: String, CaseIterable, Identifiable {
/// Two full boards, each with four pedals (Board 1: Overdrive → Delay → Reverb → Modulation;
/// Board 2: Fuzz → Tremolo → Phaser → Compressor).
case boards = "Boards"
/// A single board inside `BoardEditorView` with preset version snapshots pre-populated.
case editor = "Editor"
/// A single board with a ``ParallelSection`` (Overdrive → split → Delay|Fuzz → merge → Reverb).
case parallel = "Parallel"
/// A ``ChainRouter`` that splits one input across two independent boards (A: Overdrive + Delay;
/// B: Fuzz + Reverb) and recombines them through a shared master stage.
case router = "Router"
/// A board with a ``StereoSplitSection`` (Overdrive → splitStereo(Delay | PingPong) →
/// collectStereo) showcasing the four ``StereoRoute`` modes and stereo output.
case stereo = "Stereo"
var id: String { rawValue }
/// Short human-readable title used in the mode picker.
var title: String {
switch self {
case .boards: return "Boards"
case .editor: return "Editor"
case .parallel: return "Parallel"
case .router: return "Router"
case .stereo: return "Stereo"
}
}
}
// MARK: - ShoeGazeDemoController
/// Main-actor observable controller that owns the engine and active ShoeGaze session.
///
/// A single `ShoeGaze` instance plus optional `router` / `parallelSection` hold the
/// current showcase. Switching modes via ``select(_:)`` or changing the input source via
/// ``setInputSource(_:)`` calls ``rebuild()`` which:
///
/// 1. Stops the engine if it is running.
/// 2. Calls `shoeGaze.teardown()` to remove all nodes and release all buses.
/// 3. Replaces `shoeGaze` with a fresh instance.
/// 4. Builds the new mode-specific graph.
/// 5. Restarts the engine if it was running before the rebuild.
///
/// This guarantees the engine never holds stale references across mode switches.
@MainActor
@Observable
final class ShoeGazeDemoController {
// MARK: - Public state
/// The synthesis engine. Callers must not call `engine.start()` or `engine.stop()`
/// directly — use ``start()`` and ``stop()`` so `isRunning` stays consistent.
let engine: SynthesisEngine
/// The active ShoeGaze session. Replaced on every ``rebuild()`` call.
private(set) var shoeGaze: ShoeGaze
/// Non-nil only in `.router` mode, after ``buildRouter()`` succeeds.
private(set) var router: ChainRouter?
/// Non-nil only in `.parallel` mode, after ``buildParallel()`` succeeds.
private(set) var parallelSection: ParallelSection?
/// Non-nil only in `.stereo` mode, after ``buildStereo()`` succeeds.
private(set) var stereoSection: StereoSplitSection?
/// Stores named board snapshots for the `.editor` showcase.
let versionStore: BoardVersionStore = BoardVersionStore()
/// Currently selected showcase mode.
private(set) var mode: DemoMode = .boards
/// Current input source policy.
private(set) var inputSource: InputSource = .testLoop
/// `true` while the engine is running. Derived from the engine (the single source
/// of truth) so it stays correct regardless of which control starts/stops it.
var isRunning: Bool { engine.isRunning }
// MARK: - Init
/// Creates a controller, builds the default `.boards` showcase, and does NOT start the engine.
///
/// - Parameter engine: A pre-configured `SynthesisEngine` owned by the caller. The
/// engine must not be running when this initialiser is called.
init(engine: SynthesisEngine) {
self.engine = engine
self.shoeGaze = ShoeGaze(engine: engine, inputSource: .testLoop)
buildBoards()
}
// MARK: - Mode selection
/// Switches to the given mode if different from the current one, triggering a full rebuild.
///
/// - Parameter newMode: The showcase to activate.
func select(_ newMode: DemoMode) {
guard newMode != mode else { return }
mode = newMode
rebuild()
}
// MARK: - Input source
/// Changes the input source policy and triggers a full rebuild.
///
/// Live input requires microphone authorisation first — without it macOS feeds the AUHAL input
/// silent zeros. The request is asynchronous, so `.liveInput` is applied only once the grant
/// resolves; a denial falls back to the test loop.
///
/// - Parameter source: `.testLoop` for the built-in test signal or `.liveInput(channel:)`
/// for hardware microphone/instrument input on the given channel.
func setInputSource(_ source: InputSource) {
guard case .liveInput = source else {
applyInputSource(source)
return
}
MicrophonePermission.request { [weak self] granted in
if !granted { self?.microphoneAccessDenied = true }
self?.applyInputSource(granted ? source : .testLoop)
}
}
/// Set when live input is requested but microphone access is denied/restricted. The UI observes
/// this and presents an alert, then clears it.
var microphoneAccessDenied: Bool = false
/// Applies an input-source change and triggers a full rebuild.
private func applyInputSource(_ source: InputSource) {
inputSource = source
rebuild()
}
// MARK: - Transport
/// Starts the engine. Updates ``isRunning`` on success; prints on failure.
func start() {
do {
try engine.start()
} catch {
print("[ShoeGazeDemoController] engine.start() failed: \(error)")
}
}
/// Stops the engine and updates ``isRunning``.
func stop() {
engine.stop()
}
/// Toggles audio output on/off (mute). Muting silences output by stopping the engine;
/// unmuting restarts it. `isRunning == false` is the "muted" (silent) state.
func toggleMute() {
if isRunning {
stop()
} else {
start()
}
}
// MARK: - Engine reconfiguration
/// Applies new engine settings (while stopped) and rebuilds the current mode so the showcase
/// is reconstructed at the new sample rate / channel counts. Used by the engine-config UI.
///
/// Tears the session down BEFORE reconfiguring — changing channel counts re-partitions the bus
/// allocator, which would invalidate rig buses still allocated under the old layout.
///
/// - Throws: `SynthesisEngineConfigError` if the engine is running or a value is invalid.
func reconfigure(sampleRate: Double, inputChannels: Int, outputChannels: Int) throws {
let wasRunning: Bool = isRunning
if wasRunning { stop() }
tearDownSession()
try engine.setSampleRate(sampleRate)
try engine.setNumOutputChannels(outputChannels)
try engine.setNumInputChannels(inputChannels)
// A live-input source past the new channel count would make rebuild fail; fall back.
if case .liveInput(let channel) = inputSource, channel >= inputChannels {
inputSource = .testLoop
}
buildSession()
// `buildSession()` creates a fresh `ShoeGaze`, whose `init` installs the scope tap for the
// new channel layout — no explicit `installScopeTap()` needed here.
if wasRunning { start() }
}
// MARK: - Rebuild
/// Tears down the current session and rebuilds the active mode.
///
/// The engine is stopped before teardown and restarted afterward if it was running,
/// satisfying the remove-before-release invariant documented on `ShoeGaze.teardown()`.
private func rebuild() {
let wasRunning: Bool = isRunning
if wasRunning { stop() }
tearDownSession()
buildSession()
if wasRunning { start() }
}
/// Removes the current session's nodes and clears split/router references.
private func tearDownSession() {
shoeGaze.teardown()
router = nil
parallelSection = nil
stereoSection = nil
}
/// Creates a fresh session and builds the active mode's graph.
private func buildSession() {
shoeGaze = ShoeGaze(engine: engine, inputSource: inputSource)
switch mode {
case .boards: buildBoards()
case .editor: buildEditor()
case .parallel: buildParallel()
case .router: buildRouter()
case .stereo: buildStereo()
}
}
// MARK: - Mode builders
/// `.boards` — three full boards covering all twelve pedal types.
///
/// Board 1: Overdrive → Delay → Reverb → Modulation
/// Board 2: Fuzz → Tremolo → Phaser → Compressor
/// Board 3: Mutant → Auto-Wah → Feedback Delay → Multi-Tap Delay
private func buildBoards() {
do {
let board1: PedalBoard = try shoeGaze.addBoard()
board1.label = "Board 1"
try board1.add(OverdrivePedal())
try board1.add(DelayPedal())
try board1.add(ReverbPedal())
try board1.add(ModulationPedal())
try shoeGaze.finalizeBoard(board1)
let board2: PedalBoard = try shoeGaze.addBoard()
board2.label = "Board 2"
try board2.add(FuzzPedal())
try board2.add(TremoloPedal())
try board2.add(PhaserPedal())
try board2.add(CompressorPedal())
try shoeGaze.finalizeBoard(board2)
let board3: PedalBoard = try shoeGaze.addBoard()
board3.label = "Board 3"
try board3.add(MutantPedal())
try board3.add(AutoWahPedal())
try board3.add(FeedbackDelayPedal())
try board3.add(MultiTapDelayPedal())
try shoeGaze.finalizeBoard(board3)
} catch {
print("[ShoeGazeDemoController] buildBoards failed: \(error)")
}
}
/// `.editor` — one board inside `BoardEditorView` with two pre-captured versions.
///
/// The pre-populated version entries ("Crunch" and "Clean Shimmer") ensure the
/// Versions menu is not empty when the showcase first appears.
private func buildEditor() {
do {
let board: PedalBoard = try shoeGaze.addBoard()
board.label = "Editor Board"
try board.add(OverdrivePedal())
try board.add(FuzzPedal())
try board.add(DelayPedal())
try board.add(ReverbPedal())
try shoeGaze.finalizeBoard(board)
// Pre-populate two named snapshots so the Versions menu is immediately useful.
versionStore.capture(board, name: "Crunch")
versionStore.capture(board, name: "Clean Shimmer")
} catch {
print("[ShoeGazeDemoController] buildEditor failed: \(error)")
}
}
/// `.parallel` — Overdrive → split(Delay | Fuzz) → merge → Reverb.
///
/// Stores the `ParallelSection` in `parallelSection` so `DemoRootView` can display
/// `ParallelSectionView`.
private func buildParallel() {
do {
let board: PedalBoard = try shoeGaze.addBoard()
board.label = "Parallel Board"
try board.add(OverdrivePedal())
let section: ParallelSection = try board.split()
try section.branchA.add(DelayPedal())
try section.branchB.add(FuzzPedal())
try board.merge(section)
try board.add(ReverbPedal())
try shoeGaze.finalizeBoard(board)
parallelSection = section
} catch {
print("[ShoeGazeDemoController] buildParallel failed: \(error)")
}
}
/// `.router` — ChainRouter with two independent chains: A (Overdrive + Delay),
/// B (Fuzz + Reverb), merged through a shared master stage.
///
/// Stores the `ChainRouter` in `router` so `DemoRootView` can display
/// `ChainRouterView`.
private func buildRouter() {
do {
let r: ChainRouter = try shoeGaze.makeChainRouter()
try r.addToA(OverdrivePedal())
try r.addToA(DelayPedal())
try r.addToB(FuzzPedal())
try r.addToB(ReverbPedal())
try r.finalize()
router = r
} catch {
print("[ShoeGazeDemoController] buildRouter failed: \(error)")
}
}
/// `.stereo` — Overdrive → splitStereo(left: Delay | right: Ping-Pong) → collectStereo.
///
/// Demonstrates the stereo split mechanism: a mono signal fanned into two independently
/// authored chains that become the left and right output channels, with the four
/// ``StereoRoute`` modes (stereo / left / right / bypass) selectable live. Stores the
/// `StereoSplitSection` so `DemoRootView` can display `StereoSplitSectionView`.
private func buildStereo() {
do {
let board: PedalBoard = try shoeGaze.addBoard()
board.label = "Stereo Board"
try board.add(OverdrivePedal())
let section: StereoSplitSection = try board.splitStereo()
try section.left.add(DelayPedal())
try section.right.add(PingPongDelayPedal())
try board.collectStereo(section)
try shoeGaze.finalizeBoard(board)
stereoSection = section
} catch {
print("[ShoeGazeDemoController] buildStereo failed: \(error)")
}
}
}
#endif
-24
View File
@@ -1,24 +0,0 @@
// main.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS)
import AppKit
// Program entry runs on the main thread; assert main-actor isolation for the
// AppKit bootstrap rather than hopping asynchronously. `AppDelegate.init` builds
// `@MainActor` synthesizers and UI.
MainActor.assumeIsolated {
let app: NSApplication = NSApplication.shared
let delegate: AppDelegate = AppDelegate()
app.setActivationPolicy(.regular)
app.delegate = delegate
app.activate(ignoringOtherApps: true)
app.run()
}
#else
// The ShoeGaze demo is a macOS AppKit application and has no iOS entry point.
print("ShoeGazeDemo runs on macOS only.")
#endif
@@ -1,387 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objects = {
/* Begin PBXBuildFile section */
C3C000000000000000000009 /* ShoeGazeiOSDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C000000000000000000007 /* ShoeGazeiOSDemoApp.swift */; };
C3C00000000000000000000A /* ShoeGazeiOSDemoAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C000000000000000000008 /* ShoeGazeiOSDemoAppModel.swift */; };
C3C00000000000000000000B /* LyrebirdShoeGaze in Frameworks */ = {isa = PBXBuildFile; productRef = C3C00000000000000000001A /* LyrebirdShoeGaze */; };
C3C00000000000000000000C /* LyrebirdShoeGazeUI in Frameworks */ = {isa = PBXBuildFile; productRef = C3C00000000000000000001B /* LyrebirdShoeGazeUI */; };
C3C00000000000000000000D /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = C3C00000000000000000001C /* LyrebirdUI */; };
C3C00000000000000000001D /* Lyrebird in Frameworks */ = {isa = PBXBuildFile; productRef = C3C00000000000000000001E /* Lyrebird */; };
C3C000000000000000000031 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3C000000000000000000030 /* Assets.xcassets */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
C3C000000000000000000004 /* ShoeGazeiOSDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ShoeGazeiOSDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
C3C000000000000000000006 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C3C000000000000000000007 /* ShoeGazeiOSDemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoeGazeiOSDemoApp.swift; sourceTree = "<group>"; };
C3C000000000000000000008 /* ShoeGazeiOSDemoAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoeGazeiOSDemoAppModel.swift; sourceTree = "<group>"; };
C3C000000000000000000030 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
C3C00000000000000000000F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C3C00000000000000000000B /* LyrebirdShoeGaze in Frameworks */,
C3C00000000000000000000C /* LyrebirdShoeGazeUI in Frameworks */,
C3C00000000000000000000D /* LyrebirdUI in Frameworks */,
C3C00000000000000000001D /* Lyrebird in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
C3C000000000000000000002 = {
isa = PBXGroup;
children = (
C3C000000000000000000005 /* ShoeGazeiOSDemo */,
C3C000000000000000000003 /* Products */,
);
sourceTree = "<group>";
};
C3C000000000000000000003 /* Products */ = {
isa = PBXGroup;
children = (
C3C000000000000000000004 /* ShoeGazeiOSDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
C3C000000000000000000005 /* ShoeGazeiOSDemo */ = {
isa = PBXGroup;
children = (
C3C000000000000000000007 /* ShoeGazeiOSDemoApp.swift */,
C3C000000000000000000008 /* ShoeGazeiOSDemoAppModel.swift */,
C3C000000000000000000030 /* Assets.xcassets */,
C3C000000000000000000006 /* Info.plist */,
);
path = ShoeGazeiOSDemo;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C3C000000000000000000011 /* ShoeGazeiOSDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = C3C000000000000000000012 /* Build configuration list for PBXNativeTarget "ShoeGazeiOSDemo" */;
buildPhases = (
C3C00000000000000000000E /* Sources */,
C3C00000000000000000000F /* Frameworks */,
C3C000000000000000000010 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ShoeGazeiOSDemo;
packageProductDependencies = (
C3C00000000000000000001A /* LyrebirdShoeGaze */,
C3C00000000000000000001B /* LyrebirdShoeGazeUI */,
C3C00000000000000000001C /* LyrebirdUI */,
C3C00000000000000000001E /* Lyrebird */,
);
productName = ShoeGazeiOSDemo;
productReference = C3C000000000000000000004 /* ShoeGazeiOSDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
C3C000000000000000000001 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1600;
LastUpgradeCheck = 2620;
TargetAttributes = {
C3C000000000000000000011 = {
CreatedOnToolsVersion = 16.0;
};
};
};
buildConfigurationList = C3C000000000000000000015 /* Build configuration list for PBXProject "ShoeGazeiOSDemo" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C3C000000000000000000002;
packageReferences = (
C3C000000000000000000018 /* XCLocalSwiftPackageReference ".." */,
C3C000000000000000000019 /* XCRemoteSwiftPackageReference "Lyrebird" */,
);
productRefGroup = C3C000000000000000000003 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
C3C000000000000000000011 /* ShoeGazeiOSDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
C3C000000000000000000010 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3C000000000000000000031 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C3C00000000000000000000E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3C000000000000000000009 /* ShoeGazeiOSDemoApp.swift in Sources */,
C3C00000000000000000000A /* ShoeGazeiOSDemoAppModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
C3C000000000000000000013 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = HE5VJFE9E4;
INFOPLIST_FILE = ShoeGazeiOSDemo/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeiOSDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 2;
};
name = Debug;
};
C3C000000000000000000014 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = HE5VJFE9E4;
INFOPLIST_FILE = ShoeGazeiOSDemo/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeiOSDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 2;
};
name = Release;
};
C3C000000000000000000016 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
C3C000000000000000000017 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C3C000000000000000000012 /* Build configuration list for PBXNativeTarget "ShoeGazeiOSDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C3C000000000000000000013 /* Debug */,
C3C000000000000000000014 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C3C000000000000000000015 /* Build configuration list for PBXProject "ShoeGazeiOSDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C3C000000000000000000016 /* Debug */,
C3C000000000000000000017 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
C3C000000000000000000018 /* XCLocalSwiftPackageReference ".." */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ..;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCRemoteSwiftPackageReference section */
C3C000000000000000000019 /* XCRemoteSwiftPackageReference "Lyrebird" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://realizedsound.mooo.com/josh/Lyrebird";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
C3C00000000000000000001A /* LyrebirdShoeGaze */ = {
isa = XCSwiftPackageProductDependency;
package = C3C000000000000000000018 /* XCLocalSwiftPackageReference ".." */;
productName = LyrebirdShoeGaze;
};
C3C00000000000000000001B /* LyrebirdShoeGazeUI */ = {
isa = XCSwiftPackageProductDependency;
package = C3C000000000000000000018 /* XCLocalSwiftPackageReference ".." */;
productName = LyrebirdShoeGazeUI;
};
C3C00000000000000000001C /* LyrebirdUI */ = {
isa = XCSwiftPackageProductDependency;
package = C3C000000000000000000019 /* XCRemoteSwiftPackageReference "Lyrebird" */;
productName = LyrebirdUI;
};
C3C00000000000000000001E /* Lyrebird */ = {
isa = XCSwiftPackageProductDependency;
package = C3C000000000000000000019 /* XCRemoteSwiftPackageReference "Lyrebird" */;
productName = Lyrebird;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = C3C000000000000000000001 /* Project object */;
}
@@ -1,33 +0,0 @@
{
"originHash" : "cfdd71f4b32d744c862bbe26a8265d75aa9e906275b0fb1b63575b7d68be1b6a",
"pins" : [
{
"identity" : "linenoise-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/andybest/linenoise-swift",
"state" : {
"revision" : "afc897c02b030af7333105c4fedcd843a8339238",
"version" : "0.0.3"
}
},
{
"identity" : "lyrebird",
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "032b7c39d351eba4029e8399e1ab1ee201e8bb5c",
"version" : "1.2.0"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble.git",
"state" : {
"revision" : "e9d769113660769a4d9dd3afb855562c0b7ae7b0",
"version" : "7.3.4"
}
}
],
"version" : 3
}
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3C000000000000000000011"
BuildableName = "ShoeGazeiOSDemo.app"
BlueprintName = "ShoeGazeiOSDemo"
ReferencedContainer = "container:ShoeGazeiOSDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3C000000000000000000011"
BuildableName = "ShoeGazeiOSDemo.app"
BlueprintName = "ShoeGazeiOSDemo"
ReferencedContainer = "container:ShoeGazeiOSDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C3C000000000000000000011"
BuildableName = "ShoeGazeiOSDemo.app"
BlueprintName = "ShoeGazeiOSDemo"
ReferencedContainer = "container:ShoeGazeiOSDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,6 +0,0 @@
{
"images" : [
{"filename":"icon_1024.png","idiom":"universal","platform":"ios","size":"1024x1024"}
],
"info" : {"author":"xcode","version":1}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

@@ -1 +0,0 @@
{ "info" : {"author":"xcode","version":1} }
-45
View File
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 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>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -1,33 +0,0 @@
// ShoeGazeiOSDemoApp.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import SwiftUI
import LyrebirdShoeGazeUI
/// iOS entry point for the ShoeGaze in-repo demo.
///
/// Holds the `ShoeGazeiOSDemoAppModel` as `@State` so it is created once and
/// owned for the lifetime of the app. The audio engine is **not** started
/// automatically — the user presses Start in the pedalboard (`ShoeGazeView`) to
/// begin audio. The engine is stopped when the view disappears.
@main
struct ShoeGazeiOSDemoApp: App {
@State private var model: ShoeGazeiOSDemoAppModel = ShoeGazeiOSDemoAppModel()
var body: some Scene {
WindowGroup {
NavigationStack {
ScrollView {
ShoeGazeView(shoeGaze: model.shoeGaze, hardwareSampleRate: { model.hardwareSampleRate })
.padding(.horizontal, 12)
}
.navigationTitle("ShoeGaze")
}
.onDisappear { model.stop() }
}
}
}
@@ -1,103 +0,0 @@
// ShoeGazeiOSDemoAppModel.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import AVFoundation
import Observation
import LyrebirdSynth
import LyrebirdShoeGaze
/// Observable model that owns the `SynthesisEngine` and `ShoeGaze` session for
/// the ShoeGaze iOS demo.
///
/// The engine is not started automatically — the pedalboard's Start button
/// (`ShoeGazeView`) drives `engine.start()`. `stop()` is called from `.onDisappear`
/// to release audio resources when the view goes away.
///
/// `AVAudioSession` is activated at init so the hardware sample rate is known
/// before the engine is constructed — iOS devices typically lock to 48 000 Hz
/// regardless of the preferred rate, and querying the session after activation
/// avoids pitch and timing errors.
///
/// The default board (Overdrive → Delay → Reverb → Modulation) uses `.testLoop`
/// as the input source, so no microphone permission is required to run the demo.
/// Switch to `.liveInput(channel: 0)` and set `numInputChannels: 1` in the
/// engine init to route hardware microphone or instrument input through the board.
@Observable
@MainActor
final class ShoeGazeiOSDemoAppModel {
// MARK: - Engine configuration constants
private static let blockSize: Int = 512
private static let outputChannels: Int = 2
private static let numAudioBuses: Int = 256
// MARK: - Owned objects
/// The active ShoeGaze pedalboard session.
private(set) var shoeGaze: ShoeGaze
private let engine: SynthesisEngine
private let iosDriver: iOSAudioDriver
/// The sample rate the audio session actually committed to (for the config mismatch warning).
var hardwareSampleRate: Double? { iosDriver.sessionSampleRate }
// MARK: - Init
init() {
// Activate the session before querying `sampleRate` so the hardware rate
// is reported correctly (iOS locks to 48 000 Hz on most devices).
let session: AVAudioSession = AVAudioSession.sharedInstance()
try? session.setCategory(.playAndRecord,
mode: .default,
options: [.defaultToSpeaker, .allowBluetoothHFP])
try? session.setActive(true)
let sampleRate: Double = session.sampleRate
let driver: iOSAudioDriver = iOSAudioDriver()
let eng: SynthesisEngine = SynthesisEngine(
blockSize: ShoeGazeiOSDemoAppModel.blockSize,
sampleRate: sampleRate,
numOutputChannels: ShoeGazeiOSDemoAppModel.outputChannels,
numInputChannels: 0,
numAudioBuses: ShoeGazeiOSDemoAppModel.numAudioBuses,
driver: driver
)
self.iosDriver = driver
self.engine = eng
self.shoeGaze = ShoeGaze(engine: eng)
do {
let board: PedalBoard = try shoeGaze.addBoard()
board.label = "Demo Board"
try board.add(OverdrivePedal())
try board.add(DelayPedal())
try board.add(ReverbPedal())
try board.add(ModulationPedal())
try shoeGaze.finalizeBoard(board)
} catch {
print("[ShoeGazeiOSDemo] board build failed: \(error)")
}
}
// MARK: - Transport
/// Starts the audio engine. Not called automatically — the pedalboard's Start
/// button drives `engine.start()`; this is here for callers that want to start it.
func start() {
do {
try engine.start()
} catch {
print("[ShoeGazeiOSDemo] engine.start() failed: \(error)")
}
}
/// Stops the audio engine. Call from `.onDisappear`.
func stop() {
engine.stop()
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
{ {
"originHash" : "6f168dc2e522f9d35bb2fafd7dab3cd399acd820084d324db174cf1ef0c6c4fa", "originHash" : "8bbfcc5441e68d57cefd08aed960cbac3875af1e0f8b1d2d3fbdd4dadc0ac18c",
"pins" : [ "pins" : [
{ {
"identity" : "linenoise-swift", "identity" : "linenoise-swift",
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird", "location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : { "state" : {
"revision" : "8a2eb191a204a76735ba7eeac94e18f2e65f1b23", "revision" : "c058493a9853695c441895a12e9f4a5dbc7295b0",
"version" : "1.2.2" "version" : "1.2.3"
} }
}, },
{ {
+4 -3
View File
@@ -11,8 +11,9 @@
// double-registration. The dynamic-product dance used by `LiveCompile/` is only // double-registration. The dynamic-product dance used by `LiveCompile/` is only
// required for runtime dylib hot-swap, which ShoeGaze does not do. // required for runtime dylib hot-swap, which ShoeGaze does not do.
// //
// The demo app lives at Demo/ShoeGazeDemo.xcodeproj — open ShoeGaze.xcworkspace // The apps live at Demo/ShoeGazeBuilder.xcodeproj (macOS) and
// in Xcode and run the ShoeGazeDemo scheme to build it. // Demo/ShoeGazeBuilderiOS.xcodeproj (iPad) — open ShoeGaze.xcworkspace in Xcode
// and run the matching scheme to build them.
import PackageDescription import PackageDescription
let package = Package( let package = Package(
@@ -23,7 +24,7 @@ let package = Package(
.library(name: "LyrebirdShoeGazeUI", targets: ["LyrebirdShoeGazeUI"]), .library(name: "LyrebirdShoeGazeUI", targets: ["LyrebirdShoeGazeUI"]),
], ],
dependencies: [ dependencies: [
.package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "1.2.2"), .package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "1.2.3"),
], ],
targets: [ targets: [
// The core target depends on LyrebirdUI as well as the synthesis core: // The core target depends on LyrebirdUI as well as the synthesis core:
+1 -2
View File
@@ -105,12 +105,11 @@ struct ContentView: View {
} }
``` ```
## Demo apps ## Apps
Open `ShoeGaze.xcworkspace` in Xcode and run a scheme from `Demo/`: Open `ShoeGaze.xcworkspace` in Xcode and run a scheme from `Demo/`:
- **ShoeGazeBuilder** (macOS) / **ShoeGazeBuilderiOS** (iPad) — the full palette + board builder. - **ShoeGazeBuilder** (macOS) / **ShoeGazeBuilderiOS** (iPad) — the full palette + board builder.
- **ShoeGazeDemo** / **ShoeGazeiOSDemo** — a minimal player view.
## Screenshots ## Screenshots
+58
View File
@@ -1,4 +1,62 @@
# Releases # Releases
## ShoeGaze 2.0.0
Major release. Performance-focused: a visual metronome, a real rig mute with
keyboard control, and rigs that remember their tempo, input, and I/O — plus a
saveable set-list order for hands-free switching between rigs live. The version
jumps to 2.0.0 to align ShoeGaze's numbering with the wider project family.
### Highlights
- **Visual metronome** — a horizontal playhead eases wall-to-wall each beat so you
can anticipate the downbeat, replacing the old flashing LED.
- **Rig Mute (⌘Z)** — hard-silences the whole rig; distinct from Bypass Rig (dry passthrough).
- **Keyboard shortcuts** — ⌘1–⌘9 switch/solo boards, ⌘⇧1–⌘⇧0 load set-list rigs 1–10,
⌘Z mutes. macOS menus + iOS/iPadOS hardware keyboards.
- **Set lists** — reorder rigs by drag or Move Up/Down; the order saves, travels with
an exported archive, and drives the ⌘⇧ slots.
- **Per-rig memory** — tempo, input selection, and engine I/O now persist with a rig.
### Fixed
- Archive import no longer collides set-list positions with existing rigs.
### Removed
- The ShoeGazeDemo / ShoeGazeiOSDemo apps — only the ShoeGazeBuilder (macOS) and
ShoeGazeBuilderiOS (iPad) apps remain.
**Compatibility:** rig persistence is additive — older rigs load unchanged, and 2.0.0
rigs still open in older builds. The bump reflects feature scope + version alignment,
not a format break.
## 1.5.0 — 2026-07-04
### New Looper pedal (catalog now 36)
- **Multitrack looper** with a smart Loop footswitch (record → overdub → play), up to four
tracks (A/B/C/D), per-track mute via the track dots, undo, reverse, and a timeline view.
- **Beat-quantized transport** with a **Sync / Free** mode toggle; stop and cue-stop honour the
loop boundary in Sync. Clean-through and a Playback balance let the dry signal pass while
looped layers play back.
- **MIDI-mappable** transport (record/play/stop), per-track A/B/C/D taps, and the Sync toggle.
- Stomp-style **Reset** button that also fires on engine stop and rig teardown; `effect()` is
idempotent across graph rebuilds, and the multitrack engine is RT-safe (findings from review
addressed, with regression coverage for record-after-reset).
### iPad / iOS layout rework
- **Canvas-first compact layout** — composition panels move into sheets so the pedal canvas
fills the screen; the sheet-based layout is now used at every size class (no forced min width).
- **Header compaction** — performance controls sit inline right of the title; rig controls group
with Tempo/Tuner; the scope drops to a full-width strip below the rows in portrait. Fixes
Tempo/Tuner truncation, Mute-toggle expansion, mixer overflow into the CPU meters, and portrait
clipping/centering.
- **Add-Pedal sheet** is a scrollable list with a fixed header and type filter at a stable size;
fixed compact sheets that failed to present (one sheet per view node).
### Dependency
- Bumped to **Lyrebird 1.2.3**. Lyrebird now ships framework-neutral project templates only —
its ShoeGaze-specific CLI scaffolding was removed, since ShoeGaze lives in this standalone repo.
### Fixes
- A transport-only **Start** no longer reverts Settings configuration (external-review fix).
- Dropped a stale doc and a dead `looperTimeline` property.
## 1.4.0 — 2026-07-01 ## 1.4.0 — 2026-07-01
-6
View File
@@ -4,12 +4,6 @@
<FileRef <FileRef
location = "group:."> location = "group:.">
</FileRef> </FileRef>
<FileRef
location = "group:Demo/ShoeGazeDemo.xcodeproj">
</FileRef>
<FileRef
location = "group:Demo/ShoeGazeiOSDemo.xcodeproj">
</FileRef>
<FileRef <FileRef
location = "group:Demo/ShoeGazeBuilder.xcodeproj"> location = "group:Demo/ShoeGazeBuilder.xcodeproj">
</FileRef> </FileRef>
@@ -1,5 +1,5 @@
{ {
"originHash" : "91598bde27d299c8e3d95f9dc660396f52cf9b8e78f90ff2652c9d34d869f572", "originHash" : "39c6a5f1535f779ef8a83b5ea2ab6f965ee3b28ad8419b94679e422a92f75603",
"pins" : [ "pins" : [
{ {
"identity" : "linenoise-swift", "identity" : "linenoise-swift",
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird", "location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : { "state" : {
"revision" : "8a2eb191a204a76735ba7eeac94e18f2e65f1b23", "revision" : "c058493a9853695c441895a12e9f4a5dbc7295b0",
"version" : "1.2.2" "version" : "1.2.3"
} }
}, },
{ {
@@ -22,6 +22,46 @@ public enum InputSource: Equatable {
case liveInput(channel: Int) case liveInput(channel: Int)
} }
// MARK: - Codable
/// Persisted so a saved rig round-trips its input selection. Encoded as a `kind` discriminator
/// plus an optional `channel`, so adding future cases stays forward-tolerant.
extension InputSource: Codable {
private enum Kind: String, Codable {
case testLoop
case liveInput
}
private enum CodingKeys: String, CodingKey {
case kind
case channel
}
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<CodingKeys> = try decoder.container(keyedBy: CodingKeys.self)
let kind: Kind = try container.decode(Kind.self, forKey: .kind)
switch kind {
case .testLoop:
self = .testLoop
case .liveInput:
let channel: Int = try container.decode(Int.self, forKey: .channel)
self = .liveInput(channel: channel)
}
}
public func encode(to encoder: Encoder) throws {
var container: KeyedEncodingContainer<CodingKeys> = encoder.container(keyedBy: CodingKeys.self)
switch self {
case .testLoop:
try container.encode(Kind.testLoop, forKey: .kind)
case .liveInput(let channel):
try container.encode(Kind.liveInput, forKey: .kind)
try container.encode(channel, forKey: .channel)
}
}
}
/// Validates a `.liveInput` channel against the engine and returns the engine audio-bus /// Validates a `.liveInput` channel against the engine and returns the engine audio-bus
/// index of that hardware input channel. /// index of that hardware input channel.
/// ///
+9 -1
View File
@@ -49,6 +49,11 @@ public struct PedalSwitch {
/// three-state switch. Must contain at least two options. /// three-state switch. Must contain at least two options.
public let options: [Option] public let options: [Option]
/// `true` when this switch controls a tempo-synced behaviour (e.g. the looper's
/// Sync-to-Tempo mode). A generic UI can disable such switches — and the host can force them
/// to their first (off) option — while the tempo indicator is turned off. Defaults to `false`.
public let tempoDependent: Bool
/// Creates a switch descriptor. /// Creates a switch descriptor.
/// ///
/// - Parameters: /// - Parameters:
@@ -56,15 +61,18 @@ public struct PedalSwitch {
/// - node: The `UIParamNode` projected value of an `@UIParam` property /// - node: The `UIParamNode` projected value of an `@UIParam` property
/// (`pedal.$mode`, `pedal.$direction`, …). /// (`pedal.$mode`, `pedal.$direction`, …).
/// - options: Ordered switch positions, left to right. At least two. /// - options: Ordered switch positions, left to right. At least two.
/// - tempoDependent: `true` if the switch depends on the tempo/clock. Defaults to `false`.
public init( public init(
label: String, label: String,
node: UIParamNode, node: UIParamNode,
options: [Option] options: [Option],
tempoDependent: Bool = false
) { ) {
precondition(options.count >= 2, "PedalSwitch requires at least two options") precondition(options.count >= 2, "PedalSwitch requires at least two options")
self.label = label self.label = label
self.node = node self.node = node
self.options = options self.options = options
self.tempoDependent = tempoDependent
} }
/// The value of the next option after the one nearest `current`, wrapping to the first — so a /// The value of the next option after the one nearest `current`, wrapping to the first — so a
@@ -40,8 +40,9 @@ public final class LooperPedal: Pedal {
"Multitrack looper: record track A, then layer synced overdubs on tracks B–D." "Multitrack looper: record track A, then layer synced overdubs on tracks B–D."
} }
/// Double-width card: the looper carries a full transport plus a track strip and timeline. /// Triple-width card: the looper spreads its timeline, knobs, and transport grid across three
public override var widthUnits: Int { 2 } /// columns so the tall pedal fits the canvas without scrolling.
public override var widthUnits: Int { 3 }
/// The looper always passes the clean signal through and adds the loop on top (see `effect`), /// The looper always passes the clean signal through and adds the loop on top (see `effect`),
/// so the wet/dry Mix knob is meaningless — hide it and keep `mix` fully wet. /// so the wet/dry Mix knob is meaningless — hide it and keep `mix` fully wet.
@@ -167,8 +168,22 @@ public final class LooperPedal: Pedal {
private var recordStartSample: SampleTime = 0 private var recordStartSample: SampleTime = 0
private var playStartSample: SampleTime = 0 private var playStartSample: SampleTime = 0
/// Play-head position tracking that survives direction changes. `playHeadAnchor01` is the
/// normalised play-head fraction at the last anchor event (playback start or a reverse flip);
/// `playHeadAnchorSample` is the engine sample at that event. Between events the position is
/// `anchor01 + direction · (elapsed / masterLength)`, wrapped into `[0, 1)`. This mirrors the
/// actual `PlayBuffer` play-head — which reverses smoothly from its live phase — instead of the
/// old `1 − forward` reflection that jumped the read-out to the mirror point on every reverse.
private var playHeadAnchor01: Double = 0.0
private var playHeadAnchorSample: SampleTime = 0
private var transportRoutine: LyrebirdRoutine? private var transportRoutine: LyrebirdRoutine?
private var stopRoutine: LyrebirdRoutine? private var stopRoutine: LyrebirdRoutine?
private var reverseRoutine: LyrebirdRoutine?
/// Generation guard for a beat-deferred reverse. Separate from `transportGeneration` so
/// scheduling a reverse never invalidates a pending record/close (and vice versa).
private(set) var reverseGeneration: Int = 0
/// Transient notice shown in place of the state description for `noticeDuration` seconds. /// Transient notice shown in place of the state description for `noticeDuration` seconds.
private var noticeText: String? private var noticeText: String?
@@ -205,12 +220,13 @@ public final class LooperPedal: Pedal {
public override var effectSwitches: [PedalSwitch] { public override var effectSwitches: [PedalSwitch] {
[ [
PedalSwitch( PedalSwitch(
label: "Sync", label: "Sync to Tempo",
node: $syncToBeat, node: $syncToBeat,
options: [ options: [
PedalSwitch.Option(title: "Free", value: 0.0), PedalSwitch.Option(title: "Free", value: 0.0),
PedalSwitch.Option(title: "Sync", value: 1.0), PedalSwitch.Option(title: "Sync", value: 1.0),
] ],
tempoDependent: true
), ),
] ]
} }
@@ -278,11 +294,20 @@ public final class LooperPedal: Pedal {
guard phase == .playing, masterLength > 0, let engine: SynthesisEngine = hostEngine else { guard phase == .playing, masterLength > 0, let engine: SynthesisEngine = hostEngine else {
return nil return nil
} }
let elapsed: SampleTime = engine.currentTime - playStartSample return playHeadFraction(at: engine.currentTime)
guard elapsed >= 0 else { return 0.0 } }
let framesInto: Int = Int(elapsed % SampleTime(masterLength))
let forward: Double = Double(framesInto) / Double(masterLength) /// The normalised play-head fraction in `[0, 1)` at engine sample `sample`, integrating the
return reverse >= 0.5 ? (1.0 - forward) : forward /// signed distance travelled since the last anchor (playback start or reverse flip). Reversal
/// simply changes the sign of the accumulation from the current position — no jump.
func playHeadFraction(at sample: SampleTime) -> Double {
guard masterLength > 0 else { return 0.0 }
let direction: Double = reverse >= 0.5 ? -1.0 : 1.0
let elapsed: Double = Double(sample - playHeadAnchorSample)
let raw: Double = playHeadAnchor01 + direction * elapsed / Double(masterLength)
var frac: Double = raw.truncatingRemainder(dividingBy: 1.0)
if frac < 0 { frac += 1.0 }
return frac
} }
/// Caption for the Loop footswitch describing what the *next* press does. /// Caption for the Loop footswitch describing what the *next* press does.
@@ -480,10 +505,55 @@ public final class LooperPedal: Pedal {
syncToBeat = sync.nextValue(after: syncToBeat) syncToBeat = sync.nextValue(after: syncToBeat)
} }
/// Flips playback direction. Engaging reverse ends any active overdub, since overdub records /// Flips playback direction from the current play-head position. In Sync mode the flip is
/// deferred to the next beat; in Free mode (or with no clock/engine, or when not playing) it
/// applies immediately. Engaging reverse ends any active overdub, since overdub records
/// forward-in-time and can't follow a backward-reading play-head (see the class doc). /// forward-in-time and can't follow a backward-reading play-head (see the class doc).
public func toggleReverse() { public func toggleReverse() {
reverseRoutine?.stop()
reverseRoutine = nil
// Not playing: no live play-head to reverse — just flip the direction for the next start.
guard phase == .playing else {
applyReverse(at: hostEngine?.currentTime ?? playHeadAnchorSample)
return
}
reverseGeneration += 1
let generation: Int = reverseGeneration
// Free mode, or no clock/engine to schedule against → reverse immediately from here.
guard syncToBeat >= 0.5, let clock: LyrebirdClock = clock, let engine: SynthesisEngine = hostEngine else {
applyReverse(at: hostEngine?.currentTime ?? playHeadAnchorSample)
return
}
// Sync mode: reverse on the next beat, from wherever the play-head is at that beat.
let target: SampleTime = clock.nextBeat()
let routine: LyrebirdRoutine = LyrebirdRoutine { [weak self] ctx in
try ctx.waitUntil(sampleTime: target)
DispatchQueue.main.async { self?.applyDeferredReverse(generation: generation, at: target) }
}
reverseRoutine = routine
routine.start(engine: engine)
}
/// Applies a beat-deferred reverse once its target beat is reached, unless superseded by a
/// newer reverse press or a transport change.
func applyDeferredReverse(generation: Int, at beatSample: SampleTime) {
guard generation == reverseGeneration, phase == .playing else { return }
reverseRoutine = nil
applyReverse(at: beatSample)
}
/// Flips the playback direction, re-anchoring the position read-out to the current play-head so
/// it continues smoothly in the new direction. `sample` is the point the flip takes effect.
func applyReverse(at sample: SampleTime) {
let engagingReverse: Bool = reverse < 0.5 let engagingReverse: Bool = reverse < 0.5
// Re-anchor at the current play-head fraction *before* flipping, so the new-direction
// accumulation starts from where we actually are.
playHeadAnchor01 = playHeadFraction(at: sample)
playHeadAnchorSample = sample
reverse = engagingReverse ? 1.0 : 0.0 reverse = engagingReverse ? 1.0 : 0.0
if engagingReverse, overdubbingTrack != nil { if engagingReverse, overdubbingTrack != nil {
overdubbingTrack = nil overdubbingTrack = nil
@@ -497,6 +567,8 @@ public final class LooperPedal: Pedal {
transportGeneration += 1 transportGeneration += 1
stopRoutine?.stop() stopRoutine?.stop()
stopRoutine = nil stopRoutine = nil
reverseRoutine?.stop()
reverseRoutine = nil
cueStopArmed = 0.0 cueStopArmed = 0.0
overdubbingTrack = nil overdubbingTrack = nil
updateOverdubGates() updateOverdubGates()
@@ -579,6 +651,8 @@ public final class LooperPedal: Pedal {
transportRoutine = nil transportRoutine = nil
stopRoutine?.stop() stopRoutine?.stop()
stopRoutine = nil stopRoutine = nil
reverseRoutine?.stop()
reverseRoutine = nil
transportGeneration += 1 transportGeneration += 1
// Gate the recorders off (they run off `$isPlaying`) and stop the master BEFORE clearing, // Gate the recorders off (they run off `$isPlaying`) and stop the master BEFORE clearing,
@@ -634,6 +708,8 @@ public final class LooperPedal: Pedal {
transportRoutine = nil transportRoutine = nil
stopRoutine?.stop() stopRoutine?.stop()
stopRoutine = nil stopRoutine = nil
reverseRoutine?.stop()
reverseRoutine = nil
buffers.removeAll() buffers.removeAll()
players.removeAll() players.removeAll()
overdubRecorders.removeAll() overdubRecorders.removeAll()
@@ -689,6 +765,10 @@ public final class LooperPedal: Pedal {
recorder.requestReset() // realign every write head to the top recorder.requestReset() // realign every write head to the top
} }
playStartSample = sample playStartSample = sample
// Play head resets to the top (frame 0) via the playTrigger edge below; anchor the
// position read-out there so direction changes accumulate from a known origin.
playHeadAnchor01 = 0.0
playHeadAnchorSample = sample
isPlaying = 1.0 isPlaying = 1.0
stoppedIndicator = 0.0 stoppedIndicator = 0.0
overdubbingTrack = overdubTrack overdubbingTrack = overdubTrack
@@ -43,6 +43,14 @@ public struct RigEntry: Codable, Identifiable, Equatable {
/// The full rig snapshot — every board, segment, and pedal parameter. /// The full rig snapshot — every board, segment, and pedal parameter.
public let state: ShoeGazeState public let state: ShoeGazeState
/// The rig's position in the user's manually-ordered set list, or `nil` for a rig that has
/// not been placed (a legacy entry saved before ordering existed, or one not yet reordered).
///
/// Persisted per-file and inside archive export/import, so a set-list order travels with a
/// shared or backed-up library. `RigLibraryStore` sorts placed entries by this index and
/// falls back to name/date for unplaced ones. Optional, so older files decode cleanly.
public let sortIndex: Int?
/// Creates a rig library entry. /// Creates a rig library entry.
/// ///
/// - Parameters: /// - Parameters:
@@ -51,11 +59,13 @@ public struct RigEntry: Codable, Identifiable, Equatable {
/// - savedAt: Save timestamp. Defaults to `Date()` (now). Rounded to the nearest /// - savedAt: Save timestamp. Defaults to `Date()` (now). Rounded to the nearest
/// whole second so persistence round-trips are lossless. /// whole second so persistence round-trips are lossless.
/// - state: The ``ShoeGazeState`` rig snapshot to store. /// - state: The ``ShoeGazeState`` rig snapshot to store.
/// - sortIndex: Manual set-list position, or `nil` when unplaced. Defaults to `nil`.
public init( public init(
id: UUID = UUID(), id: UUID = UUID(),
name: String, name: String,
savedAt: Date = Date(), savedAt: Date = Date(),
state: ShoeGazeState state: ShoeGazeState,
sortIndex: Int? = nil
) { ) {
self.id = id self.id = id
self.name = name self.name = name
@@ -64,6 +74,16 @@ public struct RigEntry: Codable, Identifiable, Equatable {
// disk round-trip. // disk round-trip.
self.savedAt = Date(timeIntervalSince1970: savedAt.timeIntervalSince1970.rounded()) self.savedAt = Date(timeIntervalSince1970: savedAt.timeIntervalSince1970.rounded())
self.state = state self.state = state
self.sortIndex = sortIndex
}
/// Returns a copy of this entry placed at `index` in the set list, keeping its identity,
/// name, timestamp, and state. Used by `RigLibraryStore` reordering.
///
/// - Parameter index: The new set-list position, or `nil` to unplace.
/// - Returns: A copy at the new `sortIndex`.
public func reordered(to index: Int?) -> RigEntry {
RigEntry(id: id, name: name, savedAt: savedAt, state: state, sortIndex: index)
} }
/// Returns a copy of this entry with a new `name`, a fresh `id`, and `savedAt` updated to /// Returns a copy of this entry with a new `name`, a fresh `id`, and `savedAt` updated to
@@ -78,7 +98,9 @@ public struct RigEntry: Codable, Identifiable, Equatable {
name: String, name: String,
date: Date = Date() date: Date = Date()
) -> RigEntry { ) -> RigEntry {
RigEntry(id: UUID(), name: name, savedAt: date, state: state) // A duplicate is unplaced (`sortIndex: nil`) so the store appends it to the set list rather
// than colliding with the source's position.
RigEntry(id: UUID(), name: name, savedAt: date, state: state, sortIndex: nil)
} }
/// Returns a copy of this entry with a new `name` and `savedAt` updated to `date`, keeping /// Returns a copy of this entry with a new `name` and `savedAt` updated to `date`, keeping
@@ -93,6 +115,7 @@ public struct RigEntry: Codable, Identifiable, Equatable {
to name: String, to name: String,
date: Date = Date() date: Date = Date()
) -> RigEntry { ) -> RigEntry {
RigEntry(id: id, name: name, savedAt: date, state: state) // Preserve the set-list position on rename — only the name and timestamp change.
RigEntry(id: id, name: name, savedAt: date, state: state, sortIndex: sortIndex)
} }
} }
@@ -176,14 +176,17 @@ public final class RigLibraryStore {
/// asynchronously on a background queue and only logs on failure — call /// asynchronously on a background queue and only logs on failure — call
/// ``flushPendingWrites()`` to wait for it (e.g. in tests or at app termination). /// ``flushPendingWrites()`` to wait for it (e.g. in tests or at app termination).
public func save(_ entry: RigEntry) throws { public func save(_ entry: RigEntry) throws {
// Place the entry in the set list first (new rigs append; overwrites keep their position),
// so the persisted file carries a stable `sortIndex`.
let placed: RigEntry = placedForSave(entry)
// Encode synchronously (cheap, CPU) so an encoding failure is surfaced to the caller; then // Encode synchronously (cheap, CPU) so an encoding failure is surfaced to the caller; then
// update the in-memory list immediately and push the disk write to the background queue. // update the in-memory list immediately and push the disk write to the background queue.
let data: Data = try encode(entry) let data: Data = try encode(placed)
let target: URL = fileURL(for: entry) let target: URL = fileURL(for: placed)
let directory: URL = self.directory let directory: URL = self.directory
let id: UUID = entry.id let id: UUID = placed.id
let coordinated: Bool = isICloud let coordinated: Bool = isICloud
upsert(entry) upsert(placed)
ioQueue.async { ioQueue.async {
// Remove any prior file for this id first (a rename changes the name-prefixed filename). // Remove any prior file for this id first (a rename changes the name-prefixed filename).
if let stale: URL = RigLibraryStore.existingFileURL(for: id, in: directory), if let stale: URL = RigLibraryStore.existingFileURL(for: id, in: directory),
@@ -198,6 +201,87 @@ public final class RigLibraryStore {
} }
} }
// MARK: - Reordering
/// Moves entries within the set list (SwiftUI `onMove` semantics), renumbers every entry's
/// `sortIndex` to its new dense position, and persists the changed files.
///
/// - Parameters:
/// - source: The indices being moved, into the current `entries` order.
/// - destination: The insertion offset, per SwiftUI `List.onMove`.
public func move(fromOffsets source: IndexSet, toOffset destination: Int) {
var ordered: [RigEntry] = entries
ordered.move(fromOffsets: source, toOffset: destination)
renumberAndPersist(ordered)
}
/// Moves `entry` one slot earlier in the set list. No-op if it is already first or absent.
public func moveUp(_ entry: RigEntry) {
guard let index: Int = entries.firstIndex(where: { $0.id == entry.id }), index > 0 else { return }
var ordered: [RigEntry] = entries
ordered.swapAt(index, index - 1)
renumberAndPersist(ordered)
}
/// Moves `entry` one slot later in the set list. No-op if it is already last or absent.
public func moveDown(_ entry: RigEntry) {
guard let index: Int = entries.firstIndex(where: { $0.id == entry.id }),
index < entries.count - 1 else { return }
var ordered: [RigEntry] = entries
ordered.swapAt(index, index + 1)
renumberAndPersist(ordered)
}
/// Reorders the set list to match `orderedIDs`, renumbers every entry, and persists the changes.
/// Any entry not named in `orderedIDs` is appended in its current relative order (a safety net;
/// drag reorder always passes the full id list). Used by the sidebar's drag-to-reorder.
///
/// - Parameter orderedIDs: The desired full ordering, by entry id.
public func applyOrder(_ orderedIDs: [UUID]) {
let byID: [UUID: RigEntry] = Dictionary(entries.map { ($0.id, $0) }, uniquingKeysWith: { first, _ in first })
var ordered: [RigEntry] = orderedIDs.compactMap { byID[$0] }
for entry: RigEntry in entries where !orderedIDs.contains(entry.id) {
ordered.append(entry)
}
renumberAndPersist(ordered)
}
/// Renumbers `ordered` so each entry's `sortIndex` equals its position, updates the in-memory
/// list, and writes only the files whose index actually changed.
private func renumberAndPersist(_ ordered: [RigEntry]) {
var renumbered: [RigEntry] = []
var changed: [RigEntry] = []
for (position, entry) in ordered.enumerated() {
if entry.sortIndex == position {
renumbered.append(entry)
} else {
let moved: RigEntry = entry.reordered(to: position)
renumbered.append(moved)
changed.append(moved)
}
}
entries = RigLibraryStore.sorted(renumbered)
for entry: RigEntry in changed { persistToDisk(entry) }
}
/// Writes `entry`'s JSON file on the background queue without touching the in-memory list or
/// re-sorting — the reorder path already updated `entries` in one shot.
private func persistToDisk(_ entry: RigEntry) {
guard let data: Data = try? encode(entry) else { return }
let target: URL = fileURL(for: entry)
let directory: URL = self.directory
let id: UUID = entry.id
let coordinated: Bool = isICloud
ioQueue.async {
if let stale: URL = RigLibraryStore.existingFileURL(for: id, in: directory),
stale.standardizedFileURL != target.standardizedFileURL {
try? RigLibraryStore.removeFile(at: stale, coordinated: coordinated)
}
do { try RigLibraryStore.writeData(data, to: target, coordinated: coordinated) }
catch { print("[RigLibraryStore] reorder write failed: \(error)") }
}
}
/// Deletes `entry` from memory immediately and removes its file on the background queue. /// Deletes `entry` from memory immediately and removes its file on the background queue.
/// ///
/// - Parameter entry: The rig entry to remove. /// - Parameter entry: The rig entry to remove.
@@ -328,10 +412,13 @@ public final class RigLibraryStore {
let existingIDs: Set<UUID> = Set(entries.map(\.id)) let existingIDs: Set<UUID> = Set(entries.map(\.id))
var added: Int = 0 var added: Int = 0
for entry: RigEntry in imported { for entry: RigEntry in imported {
// Avoid clobbering an existing rig that happens to share this id. // Avoid clobbering an existing rig that happens to share this id. Either way, clear the
// set-list position so the import appends after the existing entries (in archive order)
// rather than colliding with their indices — `duplicated` already unplaces; a
// non-colliding entry is explicitly unplaced via `reordered(to: nil)`.
let toSave: RigEntry = existingIDs.contains(entry.id) let toSave: RigEntry = existingIDs.contains(entry.id)
? entry.duplicated(name: entry.name, date: entry.savedAt) ? entry.duplicated(name: entry.name, date: entry.savedAt)
: entry : entry.reordered(to: nil)
try save(toSave) try save(toSave)
added += 1 added += 1
} }
@@ -549,14 +636,31 @@ public final class RigLibraryStore {
entries = RigLibraryStore.sorted(next) entries = RigLibraryStore.sorted(next)
} }
/// Sorts entries by name (case-insensitive), then most-recently-saved first, then id for a /// Sorts entries by manual set-list position first (placed entries, ascending), then — for
/// fully deterministic order. /// unplaced entries or ties — by name (case-insensitive), most-recently-saved first, and id,
/// for a fully deterministic order.
private static func sorted(_ entries: [RigEntry]) -> [RigEntry] { private static func sorted(_ entries: [RigEntry]) -> [RigEntry] {
entries.sorted { lhs, rhs in entries.sorted { lhs, rhs in
let lhsIndex: Int = lhs.sortIndex ?? Int.max
let rhsIndex: Int = rhs.sortIndex ?? Int.max
if lhsIndex != rhsIndex { return lhsIndex < rhsIndex }
let byName: ComparisonResult = lhs.name.localizedCaseInsensitiveCompare(rhs.name) let byName: ComparisonResult = lhs.name.localizedCaseInsensitiveCompare(rhs.name)
if byName != .orderedSame { return byName == .orderedAscending } if byName != .orderedSame { return byName == .orderedAscending }
if lhs.savedAt != rhs.savedAt { return lhs.savedAt > rhs.savedAt } if lhs.savedAt != rhs.savedAt { return lhs.savedAt > rhs.savedAt }
return lhs.id.uuidString < rhs.id.uuidString return lhs.id.uuidString < rhs.id.uuidString
} }
} }
/// Assigns a set-list position to an entry about to be saved so every stored rig is placed:
/// an explicit index is kept as-is; overwriting an existing rig with an unplaced snapshot
/// preserves that rig's current position; a brand-new unplaced rig appends after the last one.
private func placedForSave(_ entry: RigEntry) -> RigEntry {
if entry.sortIndex != nil { return entry }
if let existing: RigEntry = entries.first(where: { $0.id == entry.id }),
let existingIndex: Int = existing.sortIndex {
return entry.reordered(to: existingIndex)
}
let nextIndex: Int = (entries.compactMap { $0.sortIndex }.max() ?? -1) + 1
return entry.reordered(to: nextIndex)
}
} }
@@ -60,6 +60,35 @@ extension ShoeGaze {
try rebuildAllBoards(from: snapshot) try rebuildAllBoards(from: snapshot)
} }
/// Applies a rig snapshot's saved hardware channel layout (``ShoeGazeState/numInputChannels`` /
/// ``ShoeGazeState/numOutputChannels``) to the engine — a **deliberate opt-in**.
///
/// ``loadRig(from:)`` persists a rig's I/O but does not auto-apply it: forcing the engine's
/// channel layout on every load would override the user's global engine config and clobber the
/// enable-live-input flow. Call this explicitly (e.g. from the engine-config UI, or a "match rig
/// I/O" action) when you do want the rig's saved layout. Reuses ``reconfigureEngine(...)`` — so
/// it captures the current rig and rebuilds every board at the new layout.
///
/// A no-op (returns `false`) when the snapshot carries no saved counts or they already match.
///
/// - Parameter state: The rig snapshot whose channel layout should be applied.
/// - Returns: `true` if the engine was reconfigured, `false` if nothing needed to change.
/// - Throws: `SynthesisEngineConfigError.engineIsRunning` if the engine is running, or any error
/// from ``reconfigureEngine(sampleRate:inputChannels:outputChannels:)``.
@discardableResult
public func applyChannelLayout(from state: ShoeGazeState) throws -> Bool {
guard !engine.isRunning else { throw SynthesisEngineConfigError.engineIsRunning }
guard let inCount: Int = state.numInputChannels,
let outCount: Int = state.numOutputChannels else { return false }
guard inCount != engine.numInputChannels || outCount != engine.numOutputChannels else { return false }
try reconfigureEngine(
sampleRate: engine.sampleRate,
inputChannels: inCount,
outputChannels: outCount
)
return true
}
/// Default samples-per-frame captured by the scope tap. /// Default samples-per-frame captured by the scope tap.
public static let defaultScopeBufferSize: Int = 2_048 public static let defaultScopeBufferSize: Int = 2_048
@@ -18,7 +18,15 @@ extension ShoeGaze {
/// - Returns: A `ShoeGazeState` reflecting the current rig. /// - Returns: A `ShoeGazeState` reflecting the current rig.
public func captureState() -> ShoeGazeState { public func captureState() -> ShoeGazeState {
let boardStates: [BoardState] = boards.map { $0.captureState() } let boardStates: [BoardState] = boards.map { $0.captureState() }
return ShoeGazeState(boards: boardStates, midiMap: midiMap) return ShoeGazeState(
boards: boardStates,
midiMap: midiMap,
bpm: clock.bpm,
tempoEnabled: tempoEnabled,
inputSource: inputSource,
numInputChannels: engine.numInputChannels,
numOutputChannels: engine.numOutputChannels
)
} }
/// Captures the current rig as a named ``RigEntry`` suitable for the rig library. /// Captures the current rig as a named ``RigEntry`` suitable for the rig library.
@@ -93,11 +101,39 @@ extension ShoeGaze {
throw PresetError.unsupportedVersion(state.version) throw PresetError.unsupportedVersion(state.version)
} }
// Note: `state.numInputChannels` / `numOutputChannels` are persisted with the rig (see
// `captureState`) but intentionally NOT auto-applied here. Forcing the engine's channel
// layout on every load would fight the global engine config and clobber the iOS
// enable-live-input flow (rebuild engine to 1 input, then load a rig saved with 0). Apply a
// rig's saved layout deliberately via `applyChannelLayout(from:)` / the config UI instead.
// Restore the saved input source before rebuilding, since board construction reads it. A
// saved live-input channel that no longer exists on this engine falls back to the test loop
// (same guard as reconfigureEngine), so the rebuild's addBoard() can't throw on a stale
// channel. Absent (older rig) → leave the current input source untouched.
if let savedInput: InputSource = state.inputSource {
if case .liveInput(let channel) = savedInput,
channel < 0 || channel >= engine.numInputChannels {
inputSource = .testLoop
} else {
inputSource = savedInput
}
}
teardown() teardown()
try rebuildAllBoards(from: state) try rebuildAllBoards(from: state)
// Restore the rig's MIDI bindings after the boards exist, so a MIDIController re-reading the // Restore the rig's MIDI bindings after the boards exist, so a MIDIController re-reading the
// map resolves against the freshly rebuilt boards. // map resolves against the freshly rebuilt boards.
midiMap = state.midiMap midiMap = state.midiMap
// Tempo restore is graph-independent, so it happens after the rebuild. Absent (older rig) →
// leave the current session tempo untouched.
if let savedBpm: Double = state.bpm {
clock.bpm = savedBpm
}
if let savedTempoEnabled: Bool = state.tempoEnabled {
setTempoEnabled(savedTempoEnabled)
}
} }
/// Rebuilds every board from a snapshot with all-or-nothing semantics. /// Rebuilds every board from a snapshot with all-or-nothing semantics.
@@ -34,26 +34,69 @@ public struct ShoeGazeState: Codable, Equatable {
/// version bump is required for this additive field. /// version bump is required for this additive field.
public let midiMap: MIDIMap? public let midiMap: MIDIMap?
/// The rig's tempo in BPM at save time, or `nil` for a rig saved before tempo persistence.
/// Restored onto the shared clock on load; `nil` leaves the current session tempo untouched.
public let bpm: Double?
/// Whether the tempo indicator and tempo-synced features were enabled at save time, or `nil`
/// for a rig saved before tempo persistence.
public let tempoEnabled: Bool?
/// How the board head bus was fed at save time (test loop or a live-input channel), or `nil`
/// for a rig saved before input persistence. A saved live-input channel that no longer exists
/// on the loading engine falls back to the test loop.
public let inputSource: InputSource?
/// The engine's hardware input-channel count at save time, or `nil` for a rig saved before I/O
/// persistence. Reapplied on load (when the engine is stopped and the count differs), so a rig
/// can restore its channel layout. Hardware that can't supply the count is negotiated at
/// `engine.start()`, exactly as with a manual reconfigure.
public let numInputChannels: Int?
/// The engine's hardware output-channel count at save time, or `nil` for a rig saved before I/O
/// persistence. Reapplied on load under the same conditions as ``numInputChannels``.
public let numOutputChannels: Int?
/// Creates a rig state snapshot. /// Creates a rig state snapshot.
/// ///
/// - Parameters: /// - Parameters:
/// - version: Preset format version. Defaults to `presetFormatVersion`. /// - version: Preset format version. Defaults to `presetFormatVersion`.
/// - boards: Ordered list of board state snapshots. /// - boards: Ordered list of board state snapshots.
/// - midiMap: The rig's MIDI bindings, or `nil` when there are none. Defaults to `nil`. /// - midiMap: The rig's MIDI bindings, or `nil` when there are none. Defaults to `nil`.
/// - bpm: The rig's tempo in BPM, or `nil` to not persist a tempo. Defaults to `nil`.
/// - tempoEnabled: Whether tempo features were enabled, or `nil`. Defaults to `nil`.
/// - inputSource: The rig's input selection, or `nil` to not persist one. Defaults to `nil`.
/// - numInputChannels: The engine input-channel count, or `nil`. Defaults to `nil`.
/// - numOutputChannels: The engine output-channel count, or `nil`. Defaults to `nil`.
public init( public init(
version: Int = presetFormatVersion, version: Int = presetFormatVersion,
boards: [BoardState], boards: [BoardState],
midiMap: MIDIMap? = nil midiMap: MIDIMap? = nil,
bpm: Double? = nil,
tempoEnabled: Bool? = nil,
inputSource: InputSource? = nil,
numInputChannels: Int? = nil,
numOutputChannels: Int? = nil
) { ) {
self.version = version self.version = version
self.boards = boards self.boards = boards
self.midiMap = midiMap self.midiMap = midiMap
self.bpm = bpm
self.tempoEnabled = tempoEnabled
self.inputSource = inputSource
self.numInputChannels = numInputChannels
self.numOutputChannels = numOutputChannels
} }
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case version case version
case boards case boards
case midiMap case midiMap
case bpm
case tempoEnabled
case inputSource
case numInputChannels
case numOutputChannels
} }
/// Decodes a rig snapshot, tolerating an absent, malformed, OR legacy-format `midiMap`. /// Decodes a rig snapshot, tolerating an absent, malformed, OR legacy-format `midiMap`.
@@ -79,5 +122,12 @@ public struct ShoeGazeState: Codable, Equatable {
} else { } else {
self.midiMap = nil self.midiMap = nil
} }
// Additive tempo + input + I/O fields: absent in older rigs, so decode leniently to `nil`.
self.bpm = try container.decodeIfPresent(Double.self, forKey: .bpm)
self.tempoEnabled = try container.decodeIfPresent(Bool.self, forKey: .tempoEnabled)
self.inputSource = try container.decodeIfPresent(InputSource.self, forKey: .inputSource)
self.numInputChannels = try container.decodeIfPresent(Int.self, forKey: .numInputChannels)
self.numOutputChannels = try container.decodeIfPresent(Int.self, forKey: .numOutputChannels)
} }
} }
+20
View File
@@ -125,10 +125,30 @@ public final class ShoeGaze {
// MARK: - Tempo state // MARK: - Tempo state
/// `true` when the tempo indicator (BPM readout / TAP / beat LED) is shown and tempo-synced
/// features are available. Toggle with ``setTempoEnabled(_:)``; when turned off, every
/// tempo-dependent pedal switch (e.g. the looper's Sync-to-Tempo mode) is forced to its
/// first (off) position so nothing keeps quantizing to a hidden clock.
public private(set) var tempoEnabled: Bool = true
/// Timestamps of recent `tapTempo()` calls, oldest first. `internal` so /// Timestamps of recent `tapTempo()` calls, oldest first. `internal` so
/// `ShoeGaze+Tempo.swift` (same module, different file) can mutate it. /// `ShoeGaze+Tempo.swift` (same module, different file) can mutate it.
internal var tapTimestamps: [Date] = [] internal var tapTimestamps: [Date] = []
/// Shows or hides the tempo indicator and, when hiding, deactivates every tempo-synced
/// control by forcing each ``PedalSwitch/tempoDependent`` switch to its first option.
public func setTempoEnabled(_ enabled: Bool) {
tempoEnabled = enabled
guard !enabled else { return }
for pedal: Pedal in allPedals() {
for pedalSwitch: PedalSwitch in pedal.effectSwitches where pedalSwitch.tempoDependent {
if let off: PedalSwitch.Option = pedalSwitch.options.first {
pedalSwitch.node.update(off.value)
}
}
}
}
// MARK: - Scope state // MARK: - Scope state
/// Scope tap over the hardware input + output buses, feeding the debug scope view. /// Scope tap over the hardware input + output buses, feeding the debug scope view.
+20 -2
View File
@@ -41,7 +41,9 @@ public struct BoardBarView: View {
// MARK: - Layout constants // MARK: - Layout constants
private static let barSpacing: CGFloat = 10 private static let barSpacing: CGFloat = 10
private static let barHeight: CGFloat = 92 // Tall enough for the control column's three rows of (iOS-chunky) segmented picker + sliders +
// bordered mute button, so it doesn't overflow into the CPU meters below.
private static let barHeight: CGFloat = 110
private static let cellSpacing: CGFloat = 8 private static let cellSpacing: CGFloat = 8
private static let cellWidth: CGFloat = 104 private static let cellWidth: CGFloat = 104
private static let cellInnerSpacing: CGFloat = 5 private static let cellInnerSpacing: CGFloat = 5
@@ -56,6 +58,9 @@ public struct BoardBarView: View {
private static let ledDimBrightness: Double = 0.16 private static let ledDimBrightness: Double = 0.16
private static let ledRimOpacity: Double = 0.30 private static let ledRimOpacity: Double = 0.30
private static let soloButtonSize: CGFloat = 22 private static let soloButtonSize: CGFloat = 22
/// Fixed size for the rig mute glyph so the slash / wave states don't shift the volume row.
private static let muteIconWidth: CGFloat = 16
private static let muteIconHeight: CGFloat = 16
private static let editingBorderWidth: CGFloat = 2 private static let editingBorderWidth: CGFloat = 2
private static let idleBorderOpacity: Double = 0.18 private static let idleBorderOpacity: Double = 0.18
private static let cellBackgroundBrightness: Double = 0.14 private static let cellBackgroundBrightness: Double = 0.14
@@ -71,6 +76,7 @@ public struct BoardBarView: View {
@Binding private var editingBoardIndex: Int @Binding private var editingBoardIndex: Int
@Binding private var crossfadeSeconds: Double @Binding private var crossfadeSeconds: Double
private let onAddBoard: () -> Void private let onAddBoard: () -> Void
private let onClearBoards: (() -> Void)?
@State private var mode: PlayMode = .solo @State private var mode: PlayMode = .solo
@@ -84,16 +90,20 @@ public struct BoardBarView: View {
/// tap writes this). /// tap writes this).
/// - crossfadeSeconds: Crossfade duration applied to every board switch / toggle. /// - crossfadeSeconds: Crossfade duration applied to every board switch / toggle.
/// - onAddBoard: Called when the trailing **+** button is tapped. /// - onAddBoard: Called when the trailing **+** button is tapped.
/// - onClearBoards: Called when the trailing **Clear** button is tapped. When `nil`
/// (the default) no Clear button is shown.
public init( public init(
shoeGaze: ShoeGaze, shoeGaze: ShoeGaze,
editingBoardIndex: Binding<Int>, editingBoardIndex: Binding<Int>,
crossfadeSeconds: Binding<Double>, crossfadeSeconds: Binding<Double>,
onAddBoard: @escaping () -> Void onAddBoard: @escaping () -> Void,
onClearBoards: (() -> Void)? = nil
) { ) {
self.shoeGaze = shoeGaze self.shoeGaze = shoeGaze
self._editingBoardIndex = editingBoardIndex self._editingBoardIndex = editingBoardIndex
self._crossfadeSeconds = crossfadeSeconds self._crossfadeSeconds = crossfadeSeconds
self.onAddBoard = onAddBoard self.onAddBoard = onAddBoard
self.onClearBoards = onClearBoards
} }
// MARK: - Body // MARK: - Body
@@ -109,6 +119,11 @@ public struct BoardBarView: View {
boardCell(index: pair.offset, board: pair.element) boardCell(index: pair.offset, board: pair.element)
} }
addButton addButton
if let onClearBoards: () -> Void = onClearBoards {
Button("Clear") { onClearBoards() }
.buttonStyle(.bordered).tint(.red)
.help("Remove all boards in the current rig (with the option to save first)")
}
} }
.frame(height: BoardBarView.barHeight) .frame(height: BoardBarView.barHeight)
} }
@@ -175,7 +190,10 @@ public struct BoardBarView: View {
Button { Button {
shoeGaze.toggleRigMuted() shoeGaze.toggleRigMuted()
} label: { } label: {
// Fixed width: the slash / wave glyphs differ in width, which would otherwise
// shift the whole volume row a few pixels when toggling mute.
Image(systemName: shoeGaze.rigMuted ? "speaker.slash.fill" : "speaker.wave.2.fill") Image(systemName: shoeGaze.rigMuted ? "speaker.slash.fill" : "speaker.wave.2.fill")
.frame(width: BoardBarView.muteIconWidth, height: BoardBarView.muteIconHeight)
} }
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(shoeGaze.rigMuted ? .red : .orange) .tint(shoeGaze.rigMuted ? .red : .orange)
@@ -42,6 +42,10 @@ public struct EngineConfigView: View {
private let hardwareSampleRate: () -> Double? private let hardwareSampleRate: () -> Double?
private let applyConfig: ((Double, Int, Int) throws -> Void)? private let applyConfig: ((Double, Int, Int) throws -> Void)?
private let onConfigApplied: () -> Void private let onConfigApplied: () -> Void
/// When `true`, renders only the Start/Stop transport button (the sample-rate / channel-count
/// controls are hidden). Used by the compact (iPhone / narrow iPad) layout, which keeps the
/// transport on screen and moves the config controls into a Settings sheet.
private let transportOnly: Bool
@State private var pendingSampleRate: Double @State private var pendingSampleRate: Double
@State private var pendingInputs: Int @State private var pendingInputs: Int
@@ -63,12 +67,14 @@ public struct EngineConfigView: View {
shoeGaze: ShoeGaze, shoeGaze: ShoeGaze,
hardwareSampleRate: @escaping () -> Double? = { nil }, hardwareSampleRate: @escaping () -> Double? = { nil },
applyConfig: ((Double, Int, Int) throws -> Void)? = nil, applyConfig: ((Double, Int, Int) throws -> Void)? = nil,
onConfigApplied: @escaping () -> Void = { } onConfigApplied: @escaping () -> Void = { },
transportOnly: Bool = false
) { ) {
self.shoeGaze = shoeGaze self.shoeGaze = shoeGaze
self.hardwareSampleRate = hardwareSampleRate self.hardwareSampleRate = hardwareSampleRate
self.applyConfig = applyConfig self.applyConfig = applyConfig
self.onConfigApplied = onConfigApplied self.onConfigApplied = onConfigApplied
self.transportOnly = transportOnly
_pendingSampleRate = State(initialValue: shoeGaze.engine.sampleRate) _pendingSampleRate = State(initialValue: shoeGaze.engine.sampleRate)
_pendingInputs = State(initialValue: shoeGaze.engine.numInputChannels) _pendingInputs = State(initialValue: shoeGaze.engine.numInputChannels)
_pendingOutputs = State(initialValue: shoeGaze.engine.numOutputChannels) _pendingOutputs = State(initialValue: shoeGaze.engine.numOutputChannels)
@@ -78,8 +84,11 @@ public struct EngineConfigView: View {
public var body: some View { public var body: some View {
_ = transportTick _ = transportTick
let isRunning: Bool = shoeGaze.engine.isRunning return Group {
return HStack(spacing: EngineConfigView.rowSpacing) { if transportOnly {
transportButton
} else {
HStack(spacing: EngineConfigView.rowSpacing) {
label("Rate") label("Rate")
Picker("Rate", selection: $pendingSampleRate) { Picker("Rate", selection: $pendingSampleRate) {
ForEach(EngineConfigView.standardRates, id: \.self) { rate in ForEach(EngineConfigView.standardRates, id: \.self) { rate in
@@ -88,25 +97,23 @@ public struct EngineConfigView: View {
} }
.labelsHidden() .labelsHidden()
.pickerStyle(.menu) .pickerStyle(.menu)
.disabled(isRunning) .disabled(shoeGaze.engine.isRunning)
Stepper(value: $pendingInputs, in: 0...EngineConfigView.maxInputs) { Stepper(value: $pendingInputs, in: 0...EngineConfigView.maxInputs) {
Text("In: \(pendingInputs)").foregroundStyle(Color.white) Text("In: \(pendingInputs)").foregroundStyle(Color.white)
} }
.disabled(isRunning) .disabled(shoeGaze.engine.isRunning)
.fixedSize() .fixedSize()
Stepper(value: $pendingOutputs, in: 1...EngineConfigView.maxOutputs) { Stepper(value: $pendingOutputs, in: 1...EngineConfigView.maxOutputs) {
Text("Out: \(pendingOutputs)").foregroundStyle(Color.white) Text("Out: \(pendingOutputs)").foregroundStyle(Color.white)
} }
.disabled(isRunning) .disabled(shoeGaze.engine.isRunning)
.fixedSize() .fixedSize()
Button(isRunning ? "Stop" : "Start") { transportButton
if isRunning { stopEngine() } else { startEngine() } }
} }
.buttonStyle(.borderedProminent)
.tint(isRunning ? .red : .green)
} }
.alert(alertTitle, isPresented: $showAlert) { .alert(alertTitle, isPresented: $showAlert) {
Button("OK", role: .cancel) { } Button("OK", role: .cancel) { }
@@ -131,6 +138,16 @@ public struct EngineConfigView: View {
.onChange(of: pendingSampleRate) { applyConfigWhileStopped() } .onChange(of: pendingSampleRate) { applyConfigWhileStopped() }
} }
/// The Start / Stop transport button, shared by the full and transport-only layouts.
private var transportButton: some View {
let isRunning: Bool = shoeGaze.engine.isRunning
return Button(isRunning ? "Stop" : "Start") {
if isRunning { stopEngine() } else { startEngine() }
}
.buttonStyle(.borderedProminent)
.tint(isRunning ? .red : .green)
}
/// Reconfigures the stopped engine with the pending values and notifies the host so views that /// Reconfigures the stopped engine with the pending values and notifies the host so views that
/// read non-observable engine state refresh. No-op while the engine is running. /// read non-observable engine state refresh. No-op while the engine is running.
private func applyConfigWhileStopped() { private func applyConfigWhileStopped() {
@@ -161,6 +178,11 @@ public struct EngineConfigView: View {
private func startEngine() { private func startEngine() {
do { do {
// Transport-only mode does not own the config controls — the engine is already
// configured (via the full instance's live apply, or the init defaults). Re-applying
// this instance's cached pending state here would revert edits made in the Settings
// sheet, so skip the reconfigure and just start.
if !transportOnly {
if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig { if let applyConfig: (Double, Int, Int) throws -> Void = applyConfig {
try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs) try applyConfig(pendingSampleRate, pendingInputs, pendingOutputs)
} else { } else {
@@ -170,6 +192,7 @@ public struct EngineConfigView: View {
outputChannels: pendingOutputs outputChannels: pendingOutputs
) )
} }
}
try shoeGaze.engine.start() try shoeGaze.engine.start()
} catch { } catch {
handleStartError(error) handleStartError(error)
+47
View File
@@ -43,6 +43,23 @@ public struct HelpView: View {
"Bypass Rig compares your sound with and without the whole pedalboard.", "Bypass Rig compares your sound with and without the whole pedalboard.",
] ]
) )
topicSection(
icon: "keyboard",
title: "Keyboard Shortcuts",
intro: "With a hardware keyboard, these speed up live use.",
steps: [
"⌘1–⌘9 switch to (and solo) boards 1–9 — the fastest way to change board live.",
"⌘⇧1–⌘⇧9 and ⌘⇧0 load set-list rigs 1–10 in the order shown in the Rigs list — "
+ "build a set list by reordering rigs, then step through them hands-free.",
"⌘Z mutes and unmutes the whole rig — a hard silence of all output (distinct "
+ "from Bypass Rig, which passes your dry signal through).",
"On macOS the menu bar adds: ⌘N New Rig, ⌘S Save Rig, ⌘E Export Archive, "
+ "⌘I Import Archive, ⌘B Add Board, ⇧⌘R Start / Stop Recording, ⌘? Help, and "
+ "Rigs ▸ Set List (the ⌘⇧ rig slots).",
"The board and set-list shortcuts and ⌘Z also work on iOS / iPadOS with a "
+ "hardware keyboard attached.",
]
)
topicSection( topicSection(
icon: "waveform", icon: "waveform",
title: "Choosing an Input", title: "Choosing an Input",
@@ -64,6 +81,36 @@ public struct HelpView: View {
+ "crossfade time; each board has S (solo) and B (bypass).", + "crossfade time; each board has S (solo) and B (bypass).",
"The Rigs sidebar lists saved rigs, with New, Save, Save As, Duplicate, Rename, " "The Rigs sidebar lists saved rigs, with New, Save, Save As, Duplicate, Rename, "
+ "Delete, and Erase All.", + "Delete, and Erase All.",
"Reorder rigs into a set list by dragging a row, or via each rig's Move Up / "
+ "Move Down menu. The order is saved and travels with an exported archive; "
+ "the top ten map to ⌘⇧1–⌘⇧0.",
]
)
topicSection(
icon: "repeat",
title: "The Looper Pedal",
intro: "The Looper records a phrase and plays it back in a loop, with up to four "
+ "overdub tracks (A–D). The big Record button is a smart footswitch whose job "
+ "changes with the looper's state.",
steps: [
"Record (smart footswitch): first press records track A; press again to set the "
+ "loop end and start playback (auto-overdubbing A); while playing it toggles "
+ "overdub on the selected track.",
"Free vs Sync to Tempo: Free loops are whatever length you play, captured instantly. "
+ "Sync quantizes record-start and loop-close to the beat clock — so every loop is "
+ "a whole number of beats. Sync needs the Tempo indicator On; it is disabled while "
+ "tempo is off.",
"Knobs: Playback sets loop level against your live signal; Overdub sets the record "
+ "level of new overdubs; Feedback sets how much existing audio survives each pass "
+ "(1.0 = keep forever); Crossfade smooths loop mute/unmute so it doesn't click.",
"Reverse flips playback direction from the current position (in Sync it waits for the "
+ "next beat). Stop halts now; Cue Stop arms a stop at the next loop end (press again "
+ "to cancel); Reset clears every track back to empty.",
"Tracks A–D: tap a dot to select the track Record overdubs into; tap a selected, "
+ "recorded track again to mute or unmute it.",
"MIDI: Record, Stop, Cue Stop, Reverse, Sync, Reset, and each Track A–D map as "
+ "footswitch (Program Change) actions in MIDI Mapping; the Crossfade / Playback / "
+ "Overdub / Feedback knobs sweep from an expression pedal like any pedal knob.",
] ]
) )
topicSection( topicSection(
@@ -9,7 +9,7 @@ import SwiftUI
/// A presentation grouping for pedals in the palette — used to colour-code the picker cards and to /// A presentation grouping for pedals in the palette — used to colour-code the picker cards and to
/// drive the "filter by type" menu. Purely a UI concern: the mapping from a pedal's `displayName` /// drive the "filter by type" menu. Purely a UI concern: the mapping from a pedal's `displayName`
/// to its category lives here, keyed by name like ``PedalPaletteView``'s preferred order. /// to its category lives here, keyed by name like ``PedalPaletteView``'s preferred order.
enum PedalCategory: String, CaseIterable, Identifiable { public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
case gain = "Gain" case gain = "Gain"
case dynamics = "Dynamics" case dynamics = "Dynamics"
case filter = "EQ & Filter" case filter = "EQ & Filter"
@@ -19,7 +19,7 @@ enum PedalCategory: String, CaseIterable, Identifiable {
case reverb = "Reverb" case reverb = "Reverb"
case texture = "Texture" case texture = "Texture"
var id: String { rawValue } public var id: String { rawValue }
/// Accent colour used to tint the palette card and the filter chip. /// Accent colour used to tint the palette card and the filter chip.
var color: Color { var color: Color {
@@ -83,9 +83,25 @@ public struct PedalPaletteView: View {
private let onAdd: (String) -> Void private let onAdd: (String) -> Void
private let onRouting: (RoutingAction) -> Void private let onRouting: (RoutingAction) -> Void
private let axis: Axis private let axis: Axis
private let showsFilterMenu: Bool
/// Active type filter; `nil` shows all pedals. /// Active type filter when the palette owns it; `nil` shows all pedals. Ignored when an
@State private var filter: PedalCategory? /// `externalFilter` binding is supplied (the host hoists the filter into its own header).
@State private var internalFilter: PedalCategory?
private let externalFilter: Binding<PedalCategory?>?
/// The live filter, from the host binding if provided, else the palette's own state.
private var activeFilter: PedalCategory? {
externalFilter?.wrappedValue ?? internalFilter
}
private func setFilter(_ category: PedalCategory?) {
if let externalFilter: Binding<PedalCategory?> = externalFilter {
externalFilter.wrappedValue = category
} else {
internalFilter = category
}
}
// MARK: - Init // MARK: - Init
@@ -95,15 +111,23 @@ public struct PedalPaletteView: View {
/// - axis: `.vertical` (default) lays the catalog out as a full-width column for a sidebar; /// - axis: `.vertical` (default) lays the catalog out as a full-width column for a sidebar;
/// `.horizontal` lays it out as a fixed-width-card row for a horizontal scroller. The host /// `.horizontal` lays it out as a fixed-width-card row for a horizontal scroller. The host
/// wraps the view in a `ScrollView` of the matching axis. /// wraps the view in a `ScrollView` of the matching axis.
/// - filter: Optional external binding for the type filter, so a host (e.g. a sheet) can put
/// the filter control in its own fixed header. When `nil` the palette manages its own filter.
/// - showsFilterMenu: Whether to draw the built-in filter menu inline. Pass `false` when the
/// host renders its own filter control. Defaults to `true`.
/// - onAdd: Invoked with a pedal's `displayName` when its row is tapped (append to main chain). /// - onAdd: Invoked with a pedal's `displayName` when its row is tapped (append to main chain).
/// Rows are also `.draggable` carrying `"add:<displayName>"` for drop-onto-lane targeting. /// Rows are also `.draggable` carrying `"add:<displayName>"` for drop-onto-lane targeting.
/// - onRouting: Invoked when a routing row is tapped. Defaults to a no-op. /// - onRouting: Invoked when a routing row is tapped. Defaults to a no-op.
public init( public init(
axis: Axis = .vertical, axis: Axis = .vertical,
filter: Binding<PedalCategory?>? = nil,
showsFilterMenu: Bool = true,
onAdd: @escaping (String) -> Void, onAdd: @escaping (String) -> Void,
onRouting: @escaping (RoutingAction) -> Void = { _ in } onRouting: @escaping (RoutingAction) -> Void = { _ in }
) { ) {
self.axis = axis self.axis = axis
self.externalFilter = filter
self.showsFilterMenu = showsFilterMenu
self.onAdd = onAdd self.onAdd = onAdd
self.onRouting = onRouting self.onRouting = onRouting
} }
@@ -120,7 +144,7 @@ public struct PedalPaletteView: View {
/// Pedal names after applying the active type filter. /// Pedal names after applying the active type filter.
private var visiblePedalNames: [String] { private var visiblePedalNames: [String] {
guard let filter: PedalCategory = filter else { return orderedPedalNames } guard let filter: PedalCategory = activeFilter else { return orderedPedalNames }
return orderedPedalNames.filter { PedalCategory.category(for: $0) == filter } return orderedPedalNames.filter { PedalCategory.category(for: $0) == filter }
} }
@@ -151,7 +175,7 @@ public struct PedalPaletteView: View {
HStack { HStack {
sectionTitle("PEDALS") sectionTitle("PEDALS")
Spacer(minLength: 0) Spacer(minLength: 0)
filterMenu if showsFilterMenu { filterMenu }
} }
ForEach(visiblePedalNames, id: \.self) { name in ForEach(visiblePedalNames, id: \.self) { name in
pedalRow(name) pedalRow(name)
@@ -174,7 +198,7 @@ public struct PedalPaletteView: View {
HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) { HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
sectionTitle("PEDALS") sectionTitle("PEDALS")
filterMenu if showsFilterMenu { filterMenu }
} }
ForEach(groupedVisiblePedals, id: \.category) { group in ForEach(groupedVisiblePedals, id: \.category) { group in
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
@@ -215,18 +239,18 @@ public struct PedalPaletteView: View {
/// "Filter by type" menu — defaults to **All** (no filtering). /// "Filter by type" menu — defaults to **All** (no filtering).
private var filterMenu: some View { private var filterMenu: some View {
Menu { Menu {
Button("All Types") { filter = nil } Button("All Types") { setFilter(nil) }
Divider() Divider()
ForEach(PedalCategory.allCases) { category in ForEach(PedalCategory.allCases) { category in
Button(category.rawValue) { filter = category } Button(category.rawValue) { setFilter(category) }
} }
} label: { } label: {
HStack(spacing: 3) { HStack(spacing: 3) {
Image(systemName: "line.3.horizontal.decrease.circle") Image(systemName: "line.3.horizontal.decrease.circle")
Text(filter?.rawValue ?? "All").lineLimit(1) Text(activeFilter?.rawValue ?? "All").lineLimit(1)
} }
.font(.system(size: PedalPaletteView.titleFontSize)) .font(.system(size: PedalPaletteView.titleFontSize))
.foregroundStyle((filter?.color ?? Color.white).opacity(0.9)) .foregroundStyle((activeFilter?.color ?? Color.white).opacity(0.9))
} }
#if os(macOS) #if os(macOS)
.menuStyle(.borderlessButton) .menuStyle(.borderlessButton)
@@ -43,10 +43,15 @@ public struct PedalSwitchView: View {
private static let borderLineWidth: CGFloat = 1 private static let borderLineWidth: CGFloat = 1
private static let activeTextBrightness: Double = 0.12 private static let activeTextBrightness: Double = 0.12
/// Opacity applied to a tempo-dependent switch while the tempo indicator is turned off.
private static let tempoDisabledOpacity: Double = 0.4
// MARK: - Properties // MARK: - Properties
private let pedalSwitch: PedalSwitch private let pedalSwitch: PedalSwitch
@Environment(\.shoeGazeTempoEnabled) private var tempoEnabled: Bool
// MARK: - Init // MARK: - Init
/// Creates a segmented switch view. /// Creates a segmented switch view.
@@ -62,6 +67,8 @@ public struct PedalSwitchView: View {
// Reading `node.value` registers this view for @Observable re-render on change. // Reading `node.value` registers this view for @Observable re-render on change.
let current: Double = pedalSwitch.node.value let current: Double = pedalSwitch.node.value
let selectedIndex: Int = nearestIndex(to: current) let selectedIndex: Int = nearestIndex(to: current)
// A tempo-synced switch is inert while the tempo indicator is turned off.
let inert: Bool = pedalSwitch.tempoDependent && !tempoEnabled
VStack(spacing: PedalSwitchView.labelSpacing) { VStack(spacing: PedalSwitchView.labelSpacing) {
HStack(spacing: PedalSwitchView.segmentSpacing) { HStack(spacing: PedalSwitchView.segmentSpacing) {
@@ -77,10 +84,12 @@ public struct PedalSwitchView: View {
lineWidth: PedalSwitchView.borderLineWidth) lineWidth: PedalSwitchView.borderLineWidth)
) )
Text(pedalSwitch.label) Text(inert ? "\(pedalSwitch.label) (tempo off)" : pedalSwitch.label)
.font(.system(size: PedalSwitchView.captionFontSize)) .font(.system(size: PedalSwitchView.captionFontSize))
.foregroundStyle(Color.white) .foregroundStyle(Color.white)
} }
.disabled(inert)
.opacity(inert ? PedalSwitchView.tempoDisabledOpacity : 1.0)
} }
// MARK: - Subviews // MARK: - Subviews
+142 -24
View File
@@ -241,6 +241,10 @@ public struct PedalView: View {
private static let shadowOpacity: Double = 0.60 private static let shadowOpacity: Double = 0.60
private static let enclosureGradientDarkFraction: Double = 0.30 private static let enclosureGradientDarkFraction: Double = 0.30
private static let bypassSectionSpacing: CGFloat = 6 private static let bypassSectionSpacing: CGFloat = 6
/// Gap between the looper's three content columns.
private static let looperColumnSpacing: CGFloat = 18
/// Fixed width of the looper's left (timeline) column.
private static let looperTimelineColumnWidth: CGFloat = 200
/// Half the screw-dot size — used to centre screws on the corner position. /// Half the screw-dot size — used to centre screws on the corner position.
private static let screwHalfSize: CGFloat = 4 private static let screwHalfSize: CGFloat = 4
private static let namePlateBackgroundOpacity: Double = 0.35 private static let namePlateBackgroundOpacity: Double = 0.35
@@ -302,21 +306,14 @@ public struct PedalView: View {
lineWidth: PedalView.innerHighlightLineWidth) lineWidth: PedalView.innerHighlightLineWidth)
.padding(PedalView.innerHighlightPadding) .padding(PedalView.innerHighlightPadding)
// Content stack // Content stack — the looper uses a wide, columnar layout to stay short; every other
VStack(spacing: PedalView.sectionSpacing) { // pedal uses the default single-column section stack.
namePlate Group {
looperTimeline if let looper: LooperPedal = pedal as? LooperPedal {
knobGrid looperColumnarContent(looper)
selectorRow } else {
switchRow defaultContent(sliders: sliders)
// Keyed on the pedal instance so the buttons' live captions (which poll the pedal }
// via `.task`) re-subscribe when a rig load / rebuild swaps in a new pedal instance.
transportButtonRow
.id(ObjectIdentifier(pedal))
buttonRow
sliderBank(sliders)
Spacer(minLength: 0)
bottomControls
} }
.padding(PedalView.enclosurePadding) .padding(PedalView.enclosurePadding)
@@ -341,6 +338,136 @@ public struct PedalView: View {
} }
} }
// MARK: - Content layouts
/// The default single-column section stack used by every pedal except the looper.
private func defaultContent(sliders: [PedalSlider]) -> some View {
VStack(spacing: PedalView.sectionSpacing) {
namePlate
knobGrid
selectorRow
switchRow
// Keyed on the pedal instance so the buttons' live captions (which poll the pedal
// via `.task`) re-subscribe when a rig load / rebuild swaps in a new pedal instance.
transportButtonRow
.id(ObjectIdentifier(pedal))
buttonRow
sliderBank(sliders)
Spacer(minLength: 0)
bottomControls
}
}
/// Wide, three-column layout for the looper: the loop timeline on the left, the effect knobs
/// over the Free/Sync switch in the centre, and the transport footswitch grid (with bypass) on
/// the right. Laying the sections side-by-side keeps the tall pedal short enough to fit the
/// canvas without scrolling. Requires the looper's `widthUnits` to be wide enough (3×).
private func looperColumnarContent(_ looper: LooperPedal) -> some View {
VStack(spacing: PedalView.sectionSpacing) {
namePlate
HStack(alignment: .top, spacing: PedalView.looperColumnSpacing) {
// Left column: timeline, then the Free/Sync switch, then the Reset footswitch.
VStack(spacing: PedalView.sectionSpacing) {
LooperTimelineView(pedal: looper)
switchRow
looperResetCell
Spacer(minLength: 0)
}
.frame(width: PedalView.looperTimelineColumnWidth)
// Centre column: the four effect knobs (2×2), with the Level + Bypass footer at the
// bottom. The Mix slot is reserved (empty) so Bypass stays horizontally centred,
// matching a normal pedal's footer.
VStack(spacing: PedalView.sectionSpacing) {
looperEffectKnobs(columns: 2)
Spacer(minLength: 0)
looperFooter
}
// Right column: the transport footswitches (minus Reset) in a 2×2 grid.
looperTransportGrid(columns: 2)
.id(ObjectIdentifier(pedal))
}
Spacer(minLength: 0)
}
}
/// The looper's effect knobs (everything except the trailing `Mix` / `Level`) laid out in
/// rows of `columns`.
private func looperEffectKnobs(columns: Int) -> some View {
let knobs: [PedalKnob] = Array(pedal.knobs.dropLast(2))
let rows: [[PedalKnob]] = stride(from: 0, to: knobs.count, by: columns).map { start in
Array(knobs[start ..< min(start + columns, knobs.count)])
}
return VStack(spacing: PedalView.knobSpacing) {
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
HStack(spacing: PedalView.knobRowItemSpacing) {
Spacer(minLength: 0)
ForEach(Array(rowPair.element.enumerated()), id: \.offset) { knobPair in
let knob: PedalKnob = knobPair.element
ParameterKnob(knob.label, node: knob.node, range: knob.range)
.foregroundStyle(Color.white)
}
Spacer(minLength: 0)
}
}
}
}
/// Preferred grid order for the looper's transport footswitches (row-major), so the 2×2 grid
/// reads Record / Reverse over Stop / Cue Stop. Buttons not listed keep their original order
/// and follow. Matched by label to stay robust if the descriptor order changes.
private static let looperTransportOrder: [String] = ["Loop", "Reverse", "Stop", "Cue Stop"]
/// The looper's transport footswitches — everything except the trailing Reset (which sits in
/// the left column) — laid out in rows of `columns` in ``looperTransportOrder``.
private func looperTransportGrid(columns: Int) -> some View {
let buttons: [PedalButton] = Array(pedal.effectTransportButtons.dropLast())
let ordered: [PedalButton] =
PedalView.looperTransportOrder.compactMap { label in buttons.first { $0.label == label } }
+ buttons.filter { !PedalView.looperTransportOrder.contains($0.label) }
let rows: [[PedalButton]] = stride(from: 0, to: ordered.count, by: columns).map { start in
Array(ordered[start ..< min(start + columns, ordered.count)])
}
return VStack(spacing: PedalView.knobSpacing) {
ForEach(Array(rows.enumerated()), id: \.offset) { rowPair in
HStack(alignment: .top, spacing: PedalView.knobRowItemSpacing) {
Spacer(minLength: 0)
ForEach(Array(rowPair.element.enumerated()), id: \.offset) { pair in
PedalButtonView(pair.element)
}
Spacer(minLength: 0)
}
}
}
}
/// The looper's footer: Level on the left, Bypass in the centre, and an empty third where a
/// normal pedal's Mix knob would sit — so Bypass stays horizontally centred in the column.
private var looperFooter: some View {
HStack(spacing: 0) {
levelControl
.frame(maxWidth: .infinity)
bypassControl
.frame(maxWidth: .infinity)
Color.clear
.frame(maxWidth: .infinity, maxHeight: 0) // reserved Mix slot
}
}
/// The Reset footswitch (the trailing transport button), centred — sits at the bottom of the
/// looper's left (timeline) column.
@ViewBuilder
private var looperResetCell: some View {
if let reset: PedalButton = pedal.effectTransportButtons.last {
HStack(spacing: 0) {
Spacer(minLength: 0)
PedalButtonView(reset)
Spacer(minLength: 0)
}
}
}
// MARK: - Subviews // MARK: - Subviews
/// Capsule name plate near the top of the enclosure. /// Capsule name plate near the top of the enclosure.
@@ -354,15 +481,6 @@ public struct PedalView: View {
.clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius)) .clipShape(RoundedRectangle(cornerRadius: PedalView.namePlateCornerRadius))
} }
/// Loop timeline strip — rendered only for the double-width `LooperPedal`, between the
/// name plate and the knob grid. Other pedals render nothing here.
@ViewBuilder
private var looperTimeline: some View {
if let looper: LooperPedal = pedal as? LooperPedal {
LooperTimelineView(pedal: looper)
}
}
/// Info button tucked just under the top-left corner screw. /// Info button tucked just under the top-left corner screw.
private var infoButton: some View { private var infoButton: some View {
Button { Button {
@@ -16,4 +16,8 @@ public extension Notification.Name {
/// Create a new, named, empty rig and make it current. /// Create a new, named, empty rig and make it current.
static let shoeGazeNewRig: Notification.Name = Notification.Name("net.realizedsound.shoegaze.newRig") static let shoeGazeNewRig: Notification.Name = Notification.Name("net.realizedsound.shoegaze.newRig")
/// Load the set-list rig at a zero-based slot index (0…9, mapped to ⌘⇧1…⌘⇧0 on macOS). The
/// slot index is posted as the notification's `object` (an `NSNumber`/`Int`).
static let shoeGazeLoadRigSlot: Notification.Name = Notification.Name("net.realizedsound.shoegaze.loadRigSlot")
} }
@@ -149,7 +149,20 @@ struct RigLibrarySidebarView: View {
.contentShape(Rectangle()) .contentShape(Rectangle())
} }
.buttonStyle(.plain) .buttonStyle(.plain)
// Drag the row onto another to reorder; dropping inserts it just before the target. Works
// on macOS (mouse drag) and iPad (long-press drag); taps still select.
.draggable(entry.id.uuidString)
.dropDestination(for: String.self) { droppedIDs, _ in
guard let first: String = droppedIDs.first else { return false }
moveDragged(first, onto: entry)
return true
}
.contextMenu { .contextMenu {
Button("Move Up") { store.moveUp(entry) }
.disabled(isFirst(entry))
Button("Move Down") { store.moveDown(entry) }
.disabled(isLast(entry))
Divider()
Button("Rename…") { onRename(entry) } Button("Rename…") { onRename(entry) }
Button("Duplicate…") { onDuplicate(entry) } Button("Duplicate…") { onDuplicate(entry) }
// Encoding a fully-concrete RigEntry to JSON does not fail in practice; on the // Encoding a fully-concrete RigEntry to JSON does not fail in practice; on the
@@ -167,6 +180,28 @@ struct RigLibrarySidebarView: View {
} }
} }
// MARK: - Reorder helpers
private func isFirst(_ entry: RigEntry) -> Bool {
store.entries.first?.id == entry.id
}
private func isLast(_ entry: RigEntry) -> Bool {
store.entries.last?.id == entry.id
}
/// Moves the dragged entry (by id string) to sit just before `target` in the set list.
private func moveDragged(_ draggedIDString: String, onto target: RigEntry) {
guard let draggedID: UUID = UUID(uuidString: draggedIDString), draggedID != target.id else { return }
var order: [UUID] = store.entries.map(\.id)
guard let from: Int = order.firstIndex(of: draggedID) else { return }
order.remove(at: from)
// Target's index in the post-removal array; inserting there drops the dragged row before it.
guard let to: Int = order.firstIndex(of: target.id) else { return }
order.insert(draggedID, at: to)
store.applyOrder(order)
}
// MARK: - Action bar // MARK: - Action bar
private var actionBar: some View { private var actionBar: some View {
@@ -49,6 +49,11 @@ public struct ShoeGazeBuilderView: View {
/// Width of the scope/CPU block in the bottom strip — matches `BoardBarView`'s Solo/Blend/All /// Width of the scope/CPU block in the bottom strip — matches `BoardBarView`'s Solo/Blend/All
/// control column so the scope aligns under it. /// control column so the scope aligns under it.
private static let scopeWidth: CGFloat = 188 private static let scopeWidth: CGFloat = 188
/// Narrow scope shown in the compact (iPad) header, tucked left of the transport buttons.
private static let compactHeaderScopeWidth: CGFloat = 340
private static let compactHeaderScopeHeight: CGFloat = 76
/// Stable height (fraction of the screen) for the Add-Pedal sheet — a single, non-resizable detent.
private static let paletteSheetHeightFraction: CGFloat = 0.82
private static let columnSpacing: CGFloat = 14 private static let columnSpacing: CGFloat = 14
private static let backgroundRed: Double = 0.08 private static let backgroundRed: Double = 0.08
private static let backgroundGreen: Double = 0.07 private static let backgroundGreen: Double = 0.07
@@ -60,6 +65,9 @@ public struct ShoeGazeBuilderView: View {
private static let maxCrossfadeSeconds: Double = 10.0 private static let maxCrossfadeSeconds: Double = 10.0
/// Highest board reachable via a ⌘-number switch shortcut. /// Highest board reachable via a ⌘-number switch shortcut.
private static let maxBoardShortcuts: Int = 9 private static let maxBoardShortcuts: Int = 9
/// The number of set-list rigs reachable by ⌘⇧1…⌘⇧0 (the top ten).
private static let maxRigShortcuts: Int = 10
/// Default filename offered when exporting the whole library as an archive. /// Default filename offered when exporting the whole library as an archive.
private static let defaultArchiveFileName: String = "ShoeGaze Library" private static let defaultArchiveFileName: String = "ShoeGaze Library"
/// Extra width reserved for the rig-library sidebar on top of the builder's minimum width. /// Extra width reserved for the rig-library sidebar on top of the builder's minimum width.
@@ -157,6 +165,21 @@ public struct ShoeGazeBuilderView: View {
/// Help sheet presentation flag (iOS button; macOS uses the Help menu). /// Help sheet presentation flag (iOS button; macOS uses the Help menu).
@State private var showHelpSheet: Bool = false @State private var showHelpSheet: Bool = false
/// Compact-layout sheet flags — the composition panels docked in the regular layout become
/// bottom sheets so the board canvas gets the full screen.
@State private var showRigsSheet: Bool = false
@State private var showPaletteSheet: Bool = false
@State private var showSettingsSheet: Bool = false
/// Type filter for the compact Add-Pedal sheet, hoisted so it sits in the sheet's fixed header.
@State private var pedalFilter: PedalCategory?
/// `true` when the window is taller than it is wide (portrait). iPad is `.regular` in both
/// orientations, so this is derived from the actual size, not the size class. In portrait the
/// header scope moves to a full-width strip below the controls (it would otherwise overlay /
/// clip the header on narrower iPads); landscape keeps it inline beside the transport.
@State private var isPortrait: Bool = false
#if !os(macOS) #if !os(macOS)
/// iOS recording-folder picker presentation flag. (macOS uses the Record menu.) /// iOS recording-folder picker presentation flag. (macOS uses the Record menu.)
@State private var showRecordingFolderImporter: Bool = false @State private var showRecordingFolderImporter: Bool = false
@@ -197,16 +220,30 @@ public struct ShoeGazeBuilderView: View {
// MARK: - Body // MARK: - Body
public var body: some View { /// `true` on iPad (any size) — the canvas-first layout with composition panels in sheets. The
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) { /// docked desktop layout is macOS-only; on iPad it overflowed and clipped even at iPad-Pro
rigSidebar /// width, so every iPad size uses the sheet-based layout. macOS always uses the docked layout.
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity)) private var isCompact: Bool {
builderColumn #if os(iOS)
return true
#else
return false
#endif
} }
public var body: some View {
rootContent
.padding(ShoeGazeBuilderView.outerPadding) .padding(ShoeGazeBuilderView.outerPadding)
// A large min width is a macOS window sizing hint; on iPad it would force content wider than
// the screen and clip it, so the sheet-based iPad layout imposes no minimum width. Fill the
// whole window and pin to the top-leading corner so portrait isn't vertically centered.
.frame( .frame(
minWidth: ShoeGazeBuilderView.minWidth + ShoeGazeBuilderView.librarySidebarReserve, minWidth: isCompact ? nil : ShoeGazeBuilderView.minWidth + ShoeGazeBuilderView.librarySidebarReserve,
minHeight: ShoeGazeBuilderView.minHeight maxWidth: isCompact ? .infinity : nil,
minHeight: isCompact ? nil : ShoeGazeBuilderView.minHeight,
maxHeight: isCompact ? .infinity : nil,
alignment: .topLeading
) )
.background( .background(
Color( Color(
@@ -215,6 +252,14 @@ public struct ShoeGazeBuilderView: View {
blue: ShoeGazeBuilderView.backgroundBlue blue: ShoeGazeBuilderView.backgroundBlue
) )
) )
// Track portrait vs landscape by actual size (iPad is `.regular` in both orientations).
.background(
GeometryReader { proxy in
Color.clear.task(id: proxy.size) {
isPortrait = proxy.size.height > proxy.size.width
}
}
)
// The builder is always dark-themed; force the dark scheme so system controls (nav title, // The builder is always dark-themed; force the dark scheme so system controls (nav title,
// steppers, the Record button) use light text instead of black-on-dark in light mode. // steppers, the Record button) use light text instead of black-on-dark in light mode.
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
@@ -269,6 +314,11 @@ public struct ShoeGazeBuilderView: View {
.onReceive(NotificationCenter.default.publisher(for: .shoeGazeNewRig)) { _ in .onReceive(NotificationCenter.default.publisher(for: .shoeGazeNewRig)) { _ in
promptNewRig() promptNewRig()
} }
.onReceive(NotificationCenter.default.publisher(for: .shoeGazeLoadRigSlot)) { note in
if let index: Int = note.object as? Int {
loadRigSlot(index)
}
}
.confirmationDialog( .confirmationDialog(
"Clear all boards?", "Clear all boards?",
isPresented: $showClearDialog, isPresented: $showClearDialog,
@@ -309,9 +359,57 @@ public struct ShoeGazeBuilderView: View {
.sheet(isPresented: $showHelpSheet) { .sheet(isPresented: $showHelpSheet) {
HelpView() HelpView()
} }
// Each compact composition sheet lives on its own anchor node — SwiftUI presents at most one
// sheet per node, so stacking them on the main node would silently swallow all but one.
.background(rigsSheetAnchor)
.background(paletteSheetAnchor)
.background(settingsSheetAnchor)
.overlay(alignment: .top) { midiLearnBanner } .overlay(alignment: .top) { midiLearnBanner }
} }
/// Hosts the compact rig-library sheet on its own node.
private var rigsSheetAnchor: some View {
Color.clear
.sheet(isPresented: $showRigsSheet) {
rigSidebar
.padding(.top, ShoeGazeBuilderView.outerPadding)
.presentationDetents([.large])
.preferredColorScheme(.dark)
}
}
/// Hosts the compact Add-pedal palette sheet on its own node.
private var paletteSheetAnchor: some View {
Color.clear
.sheet(isPresented: $showPaletteSheet) {
paletteSheet
}
}
/// Hosts the compact engine-settings sheet on its own node.
private var settingsSheetAnchor: some View {
Color.clear
.sheet(isPresented: $showSettingsSheet) {
settingsSheet
.presentationDetents([.medium, .large])
}
}
/// The whole-view layout: docked desktop layout on regular widths, canvas-first on compact.
@ViewBuilder
private var rootContent: some View {
if isCompact {
// No docked sidebar — the rig library is a sheet reached from the header.
builderColumn
} else {
HStack(alignment: .top, spacing: ShoeGazeBuilderView.columnSpacing) {
rigSidebar
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
builderColumn
}
}
}
/// A banner shown while a control is armed for MIDI Learn, prompting the user to move it. /// A banner shown while a control is armed for MIDI Learn, prompting the user to move it.
@ViewBuilder @ViewBuilder
private var midiLearnBanner: some View { private var midiLearnBanner: some View {
@@ -384,17 +482,290 @@ public struct ShoeGazeBuilderView: View {
/// board canvas. /// board canvas.
private var builderColumn: some View { private var builderColumn: some View {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) { VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
transportRow if isCompact {
ioRow compactHeader
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
compactTopSection
} else {
headerSection
#if !os(macOS) #if !os(macOS)
recordingRow recordingRow
#endif #endif
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity)) Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
topSection topSection
}
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity)) Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
boardArea boardArea
} }
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.environment(\.shoeGazeTempoEnabled, shoeGaze.tempoEnabled)
}
// MARK: - Compact layout (iPhone / narrow iPad)
/// The compact header: a performance row (title, transport, mute) always visible, plus a
/// horizontally scrollable row of panel toggles that open the composition sheets.
private var compactHeader: some View {
_ = transportTick
// The three control rows stack tight on the left; the transport sits top-right. The scope
// is inline (right, spanning the rows) in landscape, but on narrower portrait widths it
// would overlay/clip the header — so there it drops to a full-width strip below the rows.
// Row 1: title · [Bypass · Mute · Help · MIDI] Row 2: Tempo · Tuner Row 3: Rigs/Pedals/Settings
return VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(alignment: .top, spacing: ShoeGazeBuilderView.rowSpacing) {
headerControlRows
if !isPortrait {
// Inline: clamped to the compact header height (a short strip beside transport).
headerScope
.frame(
width: ShoeGazeBuilderView.compactHeaderScopeWidth,
height: ShoeGazeBuilderView.compactHeaderScopeHeight
)
}
headerTransport
}
if isPortrait {
// Full-width strip at the scope's natural height (legend + lanes), so the legend
// doesn't overflow up into the panel row.
headerScope
.frame(maxWidth: .infinity)
}
}
}
/// The three stacked control rows shared by both orientations.
private var headerControlRows: some View {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: 1) {
Text("ShoeGaze").font(.headline).bold()
.foregroundStyle(Color.white)
currentRigLabel
}
if shoeGaze.isRecording { recordingBadge }
compactRigControlsRow
}
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze)
}
.environment(\.shoeGazeTempoEnabled, shoeGaze.tempoEnabled)
compactPanelRow
}
.frame(maxWidth: .infinity, alignment: .leading)
}
/// The oscilloscope. The caller sizes it: a fixed short strip inline (landscape) or a
/// full-width strip at natural height (portrait).
private var headerScope: some View {
ShoeGazeScopeView(shoeGaze: shoeGaze)
}
/// The Start / Stop over Record transport cluster (top-right in both orientations).
private var headerTransport: some View {
VStack(alignment: .trailing, spacing: ShoeGazeBuilderView.rowSpacing) {
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() },
transportOnly: true
)
#if !os(macOS)
recordButton
#endif
}
}
/// The rig-wide controls shown inline on the title row: Bypass / Mute / Help / MIDI.
private var compactRigControlsRow: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
rigBypassButton
rigMuteButton
helpButton
if let midi: MIDIController = midi {
MIDIIndicatorView(controller: midi) { showMIDISheet = true }
}
}
}
}
/// The composition-panel row: buttons that open the Rigs / Pedals / Settings sheets.
private var compactPanelRow: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
compactPanelButton("Rigs", systemImage: "tray.full") { showRigsSheet = true }
compactPanelButton("Pedals", systemImage: "plus.app") { showPaletteSheet = true }
compactPanelButton("Settings", systemImage: "gearshape") { showSettingsSheet = true }
}
}
}
/// The recording indicator badge (extracted so both header variants can show it).
private var recordingBadge: some View {
HStack(spacing: 4) {
Circle()
.fill(Color.red)
.frame(width: ShoeGazeBuilderView.recordDotSize, height: ShoeGazeBuilderView.recordDotSize)
Text("REC")
.font(.caption.monospaced())
.foregroundStyle(Color.red)
}
}
/// A labelled icon button that opens one of the compact composition sheets.
private func compactPanelButton(
_ title: String,
systemImage: String,
action: @escaping () -> Void
) -> some View {
Button(action: action) {
Label(title, systemImage: systemImage)
.font(.subheadline)
}
.buttonStyle(.bordered)
.tint(.gray)
}
/// Compact top strip: performance monitoring kept on screen — the board switch/mixer bar, the
/// scope, and the CPU meters. Tempo / Tuner sit below so they don't crowd the transport row.
private var compactTopSection: some View {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
BoardBarView(
shoeGaze: shoeGaze,
editingBoardIndex: $selectedBoardIndex,
crossfadeSeconds: $crossfadeSeconds,
onAddBoard: { addBoard() },
onClearBoards: { showClearDialog = true }
)
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
// Scope + Tempo/Tuner moved to the header; the CPU meters stay here.
LyrebirdStatusView(engine: shoeGaze.engine)
}
}
/// The Add-a-pedal palette + routing options, presented as a compact sheet.
private var paletteSheet: some View {
// A fixed header (title, type filter, Done) over a scrolling list. Not a NavigationStack —
// its transparent bar let the list scroll under the title. The palette does not self-wrap in
// a ScrollView (the host must), so it is wrapped here.
VStack(spacing: 0) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
Text("Add Pedal")
.font(.headline)
.foregroundStyle(Color.white)
Spacer()
pedalFilterMenu
Button("Done") { showPaletteSheet = false }
.fontWeight(.semibold)
}
.padding()
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
ScrollView {
PedalPaletteView(
axis: .vertical,
filter: $pedalFilter,
showsFilterMenu: false,
onAdd: { type in addPedal(type: type); showPaletteSheet = false },
onRouting: { action in performRouting(action); showPaletteSheet = false }
)
.padding()
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.preferredColorScheme(.dark)
// One fixed detent (no resize-drag) and drags scroll the list instead of the sheet.
.presentationDetents([.fraction(ShoeGazeBuilderView.paletteSheetHeightFraction)])
.presentationContentInteraction(.scrolls)
}
/// The type-filter menu shown in the Add-Pedal sheet header, bound to `pedalFilter`.
private var pedalFilterMenu: some View {
Menu {
Button("All Types") { pedalFilter = nil }
Divider()
ForEach(PedalCategory.allCases) { category in
Button(category.rawValue) { pedalFilter = category }
}
} label: {
HStack(spacing: 3) {
Image(systemName: "line.3.horizontal.decrease.circle")
Text(pedalFilter?.rawValue ?? "All").lineLimit(1)
}
}
}
/// Engine configuration (sample rate, input/output channel counts, input source), presented as
/// a compact sheet — the set-and-forget composition controls.
private var settingsSheet: some View {
NavigationStack {
// A plain scroll (not a Form) so the engine controls' horizontal row has the full sheet
// width — a Form row compresses it and clips the Start button to "S…".
ScrollView {
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.sectionSpacing) {
Text("Engine")
.font(.headline)
.foregroundStyle(Color.white)
EngineConfigView(
shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() }
)
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
HStack {
Text("Input")
.font(.headline)
.foregroundStyle(Color.white)
Spacer()
Picker("Input", selection: inputBinding) {
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
if shoeGaze.engine.numInputChannels > 0 {
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
} else if onEnableLiveInput != nil {
Text("Live Input").tag(0)
}
}
.labelsHidden()
.pickerStyle(.menu)
}
#if !os(macOS)
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
Text("Recording")
.font(.headline)
.foregroundStyle(Color.white)
recordingFolderPicker
#endif
Spacer(minLength: 0)
}
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
}
.navigationTitle("Settings")
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { showSettingsSheet = false }
}
}
}
.preferredColorScheme(.dark)
} }
/// Top section: the scope + CPU meters on the left (sized to align with the mixer's /// Top section: the scope + CPU meters on the left (sized to align with the mixer's
@@ -415,7 +786,8 @@ public struct ShoeGazeBuilderView: View {
shoeGaze: shoeGaze, shoeGaze: shoeGaze,
editingBoardIndex: $selectedBoardIndex, editingBoardIndex: $selectedBoardIndex,
crossfadeSeconds: $crossfadeSeconds, crossfadeSeconds: $crossfadeSeconds,
onAddBoard: { addBoard() } onAddBoard: { addBoard() },
onClearBoards: { showClearDialog = true }
) )
Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity)) Divider().overlay(Color.white.opacity(ShoeGazeBuilderView.dividerOpacity))
pedalPickerRow pedalPickerRow
@@ -530,11 +902,14 @@ public struct ShoeGazeBuilderView: View {
// MARK: - Transport row // MARK: - Transport row
private var transportRow: some View { /// Two-row header. Left: the title with the Tempo / Tuner toggles stacked and left-aligned
/// beside it. Right: the engine options (row 1) over the input controls (row 2), trailing-
/// aligned so both right edges line up. Keeping it two rows tall frees canvas for the pedals.
private var headerSection: some View {
_ = transportTick _ = transportTick
return HStack(spacing: ShoeGazeBuilderView.rowSpacing) { return HStack(alignment: .top, spacing: ShoeGazeBuilderView.rowSpacing) {
VStack(alignment: .leading, spacing: 1) { VStack(alignment: .leading, spacing: 1) {
Text("ShoeGaze Builder") Text("ShoeGaze")
.font(.title2).bold() .font(.title2).bold()
.foregroundStyle(Color.white) .foregroundStyle(Color.white)
currentRigLabel currentRigLabel
@@ -551,20 +926,63 @@ public struct ShoeGazeBuilderView: View {
.foregroundStyle(Color.red) .foregroundStyle(Color.red)
} }
} }
Spacer()
// Tempo over Tuner, left-aligned to each other.
VStack(alignment: .leading, spacing: ShoeGazeBuilderView.rowSpacing) {
TempoView(shoeGaze: shoeGaze) TempoView(shoeGaze: shoeGaze)
TunerView(shoeGaze: shoeGaze) TunerView(shoeGaze: shoeGaze)
}
Spacer()
// Right column: engine options over input controls, both right-aligned.
VStack(alignment: .trailing, spacing: ShoeGazeBuilderView.rowSpacing) {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
if let midi: MIDIController = midi { if let midi: MIDIController = midi {
MIDIIndicatorView(controller: midi) { showMIDISheet = true } MIDIIndicatorView(controller: midi) { showMIDISheet = true }
} }
helpButton helpButton
rigBypassButton rigBypassButton
rigMuteButton
EngineConfigView( EngineConfigView(
shoeGaze: shoeGaze, shoeGaze: shoeGaze,
hardwareSampleRate: hardwareSampleRate, hardwareSampleRate: hardwareSampleRate,
onConfigApplied: { transportTick.toggle() } onConfigApplied: { transportTick.toggle() }
) )
} }
.frame(height: TempoView.enabledHeight)
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
// Whether engaging the tuner silences the rig; sits left of the input selector.
Toggle("Mute while tuning", isOn: Binding(
get: { shoeGaze.tunerMutesRig },
set: { shoeGaze.tunerMutesRig = $0 }
))
.toggleStyle(.switch)
.fixedSize()
Text("Input:")
.font(.subheadline)
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
Picker("Input", selection: inputBinding) {
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
if shoeGaze.engine.numInputChannels > 0 {
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
} else if onEnableLiveInput != nil {
// No input channel yet: offer live input; selecting it asks the host to
// request mic access and rebuild the engine with one (channel 0).
Text("Live Input").tag(0)
}
}
.labelsHidden()
.pickerStyle(.menu)
.foregroundStyle(Color.white)
}
.frame(height: TempoView.enabledHeight)
}
}
} }
/// Opens the in-app help. Shown on both platforms; macOS also has a Help menu item. /// Opens the in-app help. Shown on both platforms; macOS also has a Help menu item.
@@ -595,38 +1013,20 @@ public struct ShoeGazeBuilderView: View {
.help("Bypass the entire rig — every board passes your dry input straight through") .help("Bypass the entire rig — every board passes your dry input straight through")
} }
// MARK: - Input + board + save/load row /// Global rig mute — a hard gate to silence the whole output (distinct from Bypass, which
/// passes the dry signal through). Lit when engaged. A live performance panic/silence control.
private var ioRow: some View { private var rigMuteButton: some View {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) { let muted: Bool = shoeGaze.rigMuted
Text("Input:") return Button {
shoeGaze.toggleRigMuted()
} label: {
Label(muted ? "Rig Muted" : "Mute Rig",
systemImage: muted ? "speaker.slash.fill" : "speaker.wave.2.fill")
.font(.subheadline) .font(.subheadline)
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.labelOpacity))
Picker("Input", selection: inputBinding) {
Text("Test Loop").tag(ShoeGazeBuilderView.testLoopTag)
if shoeGaze.engine.numInputChannels > 0 {
ForEach(Array(0..<shoeGaze.engine.numInputChannels), id: \.self) { channel in
Text("In \(channel)").tag(channel)
}
} else if onEnableLiveInput != nil {
// No input channel yet: offer live input; selecting it asks the host to
// request mic access and rebuild the engine with one (channel 0).
Text("Live Input").tag(0)
}
}
.pickerStyle(.menu)
.foregroundStyle(Color.white)
Button("Boards…") { showBoardsSheet = true }
.buttonStyle(.bordered).tint(.orange)
.help("Rename, reorder, or delete boards")
Button("Clear") { showClearDialog = true }
.buttonStyle(.bordered).tint(.red)
.help("Remove all boards in the current rig (with the option to save first)")
Spacer()
} }
.buttonStyle(.bordered)
.tint(muted ? .red : .gray)
.help("Mute the entire rig output — silences all sound")
} }
// MARK: - Board area // MARK: - Board area
@@ -832,19 +1232,40 @@ public struct ShoeGazeBuilderView: View {
// MARK: - Board-switch shortcuts // MARK: - Board-switch shortcuts
/// Hidden ⌘1…⌘9 buttons that solo (live-switch to) the matching board and select it as the /// Hidden ⌘1…⌘9 buttons that solo (live-switch to) the matching board and select it as the
/// edit target. Kept at zero opacity so the shortcuts stay active without showing chrome. /// edit target, plus ⌘M to toggle the rig mute. Kept at zero opacity so the shortcuts stay
/// active without showing chrome.
private var boardSwitchShortcuts: some View { private var boardSwitchShortcuts: some View {
ZStack { ZStack {
ForEach(0 ..< min(ShoeGazeBuilderView.maxBoardShortcuts, shoeGaze.boards.count), id: \.self) { index in ForEach(0 ..< min(ShoeGazeBuilderView.maxBoardShortcuts, shoeGaze.boards.count), id: \.self) { index in
Button("") { switchToBoard(index) } // Titles are invisible (the ZStack is opacity 0) but feed the iPadOS ⌘-hold
// discoverability HUD, so the shortcut reads as a named command there.
Button("Switch to Board \(index + 1)") { switchToBoard(index) }
.keyboardShortcut(KeyEquivalent(Character("\(index + 1)")), modifiers: .command) .keyboardShortcut(KeyEquivalent(Character("\(index + 1)")), modifiers: .command)
} }
// ⌘Z toggles rig mute on iOS/iPadOS hardware keyboards. On macOS the Board menu item
// owns the ⌘Z equivalent, so it is not also bound here (a double-bound event is ambiguous).
#if !os(macOS)
Button("Mute / Unmute Rig") { shoeGaze.toggleRigMuted() }
.keyboardShortcut("z", modifiers: .command)
// ⌘⇧1…⌘⇧9 + ⌘⇧0 load set-list rigs 1…10. macOS binds these via the Rigs ▸ Set List menu
// instead, so they are not also bound here.
ForEach(0 ..< ShoeGazeBuilderView.maxRigShortcuts, id: \.self) { slot in
Button("Load Set List Rig \(slot + 1)") { loadRigSlot(slot) }
.keyboardShortcut(ShoeGazeBuilderView.rigSlotKey(slot), modifiers: [.command, .shift])
}
#endif
} }
.opacity(0) .opacity(0)
.frame(width: 0, height: 0) .frame(width: 0, height: 0)
.accessibilityHidden(true) .accessibilityHidden(true)
} }
/// The key equivalent for set-list slot `slot` (0-based): slots 0…8 map to `1`…`9`, slot 9 to
/// `0` — matching the ⌘⇧1…⌘⇧0 physical row.
private static func rigSlotKey(_ slot: Int) -> KeyEquivalent {
KeyEquivalent(Character(slot < 9 ? "\(slot + 1)" : "0"))
}
/// Solos board `index` (a live amp-channel-style switch) and makes it the edit target. /// Solos board `index` (a live amp-channel-style switch) and makes it the edit target.
private func switchToBoard(_ index: Int) { private func switchToBoard(_ index: Int) {
guard index < shoeGaze.boards.count else { return } guard index < shoeGaze.boards.count else { return }
@@ -859,6 +1280,26 @@ public struct ShoeGazeBuilderView: View {
#if !os(macOS) #if !os(macOS)
/// iOS recording controls: choose an output folder, then start/stop recording. /// iOS recording controls: choose an output folder, then start/stop recording.
private var recordingRow: some View { private var recordingRow: some View {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
recordingFolderPicker
Spacer()
recordButton
}
}
/// The Record / Stop-Recording button (performance control; lives in the compact header).
private var recordButton: some View {
Button(shoeGaze.isRecording ? "Stop Recording" : "Record") {
toggleRecording()
}
.buttonStyle(.borderedProminent)
.tint(shoeGaze.isRecording ? .red : .accentColor)
.disabled(shoeGaze.recordingFolder == nil && !shoeGaze.isRecording)
}
/// The recording-folder chooser + current folder name (a set-and-forget control; shown in the
/// compact Settings sheet).
private var recordingFolderPicker: some View {
HStack(spacing: ShoeGazeBuilderView.rowSpacing) { HStack(spacing: ShoeGazeBuilderView.rowSpacing) {
Button("Recording Folder…") { showRecordingFolderImporter = true } Button("Recording Folder…") { showRecordingFolderImporter = true }
.buttonStyle(.bordered).tint(.blue) .buttonStyle(.bordered).tint(.blue)
@@ -867,13 +1308,6 @@ public struct ShoeGazeBuilderView: View {
.foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.folderLabelOpacity)) .foregroundStyle(Color.white.opacity(ShoeGazeBuilderView.folderLabelOpacity))
.lineLimit(1) .lineLimit(1)
.truncationMode(.middle) .truncationMode(.middle)
Spacer()
Button(shoeGaze.isRecording ? "Stop Recording" : "Record") {
toggleRecording()
}
.buttonStyle(.borderedProminent)
.tint(shoeGaze.isRecording ? .red : .accentColor)
.disabled(shoeGaze.recordingFolder == nil && !shoeGaze.isRecording)
} }
} }
@@ -921,6 +1355,16 @@ public struct ShoeGazeBuilderView: View {
transportTick.toggle() transportTick.toggle()
} }
/// Loads the set-list rig at zero-based `index` (the library's manual order), if one exists.
/// Backs the ⌘⇧1…⌘⇧0 shortcuts and the macOS Rigs ▸ Set List menu. Routes through
/// ``requestLoad(_:)`` so the unsaved-changes prompt and no-op-if-current behaviour apply.
///
/// - Parameter index: Zero-based slot index (0…9).
private func loadRigSlot(_ index: Int) {
guard index >= 0, index < library.entries.count else { return }
requestLoad(library.entries[index])
}
/// Switches to `entry`, prompting to save first when the current rig has unsaved changes. /// Switches to `entry`, prompting to save first when the current rig has unsaved changes.
/// No-op when `entry` is already the current rig. /// No-op when `entry` is already the current rig.
private func requestLoad(_ entry: RigEntry) { private func requestLoad(_ entry: RigEntry) {
@@ -0,0 +1,22 @@
// TempoEnabledEnvironment.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import SwiftUI
/// Environment flag mirroring ``ShoeGaze/tempoEnabled`` so leaf views (e.g. ``PedalSwitchView``)
/// can disable tempo-synced controls without each needing a reference to the session. Set once
/// near the builder root; defaults to `true`.
private struct TempoEnabledKey: EnvironmentKey {
static let defaultValue: Bool = true
}
extension EnvironmentValues {
/// `true` when the tempo indicator is shown and tempo-synced features are active.
var shoeGazeTempoEnabled: Bool {
get { self[TempoEnabledKey.self] }
set { self[TempoEnabledKey.self] = newValue }
}
}
+105 -24
View File
@@ -19,22 +19,42 @@ public struct TempoView: View {
// MARK: - Constants // MARK: - Constants
private static let pollIntervalNanoseconds: UInt64 = 33_333_333 // ~30 Hz private static let pollIntervalNanoseconds: UInt64 = 33_333_333 // ~30 Hz
/// Fraction of each beat the LED stays lit — a short flash, not a 50% duty-cycle blink.
private static let flashDutyCycle: Double = 0.15
private static let minBpm: Double = 30.0 private static let minBpm: Double = 30.0
private static let maxBpm: Double = 300.0 private static let maxBpm: Double = 300.0
private static let bpmStep: Double = 1.0 private static let bpmStep: Double = 1.0
private static let ledDiameter: CGFloat = 16 private static let rowSpacing: CGFloat = 10
private static let panelSpacing: CGFloat = 10
private static let rowSpacing: CGFloat = 14 // Metronome track: a dot swings wall-to-wall once per beat, pausing at each wall (the beat)
private static let tapAreaSize: CGFloat = 64 // so the eye can anticipate the hit. Pendulum easing comes for free from the cosine map.
private static let trackWidth: CGFloat = 150
private static let trackHeight: CGFloat = 16
private static let trackCornerRadius: CGFloat = 4
private static let trackBrightness: Double = 0.14
private static let trackBorderOpacity: Double = 0.35
private static let trackBorderWidth: CGFloat = 1
/// Vertical playhead sweeping horizontally across the track (Looper-style), full track height.
private static let lineWidth: CGFloat = 3
/// Playhead opacity floor at mid-swing; ramps to full at the walls so it fades as it travels
/// toward center and re-brightens into each beat.
private static let lineMinOpacity: Double = 0.25
/// Curve on the wall-proximity → brightness map; > 1 dims harder through the middle.
private static let brightnessFadeCurve: Double = 1.6
/// Soft glow drawn behind the playhead; its opacity peaks at the turnaround (on the beat).
private static let glowWidth: CGFloat = 16
private static let glowMaxOpacity: Double = 0.7
/// End-wall tick marks sit on the beat positions.
private static let wallTickWidth: CGFloat = 2
private static let wallTickOpacity: Double = 0.4
/// Fixed row height = the enabled (BPM/TAP-visible) height, so toggling doesn't shift layout.
static let enabledHeight: CGFloat = 34
// MARK: - Properties // MARK: - Properties
private let shoeGaze: ShoeGaze private let shoeGaze: ShoeGaze
@State private var displayedBpm: Double @State private var displayedBpm: Double
@State private var ledOn: Bool = false /// Continuous beat position, polled from the clock; drives the metronome dot.
@State private var beat: Double = 0.0
// MARK: - Init // MARK: - Init
@@ -47,9 +67,17 @@ public struct TempoView: View {
// MARK: - Body // MARK: - Body
public var body: some View { public var body: some View {
VStack(spacing: TempoView.panelSpacing) {
HStack(spacing: TempoView.rowSpacing) { HStack(spacing: TempoView.rowSpacing) {
led Button(shoeGaze.tempoEnabled ? "Tempo: On" : "Tempo: Off") {
shoeGaze.setTempoEnabled(!shoeGaze.tempoEnabled)
}
.buttonStyle(.bordered)
.tint(shoeGaze.tempoEnabled ? .green : .gray)
.fixedSize()
.help("Show the tempo indicator and enable tempo-synced controls")
if shoeGaze.tempoEnabled {
metronome
Text("\(Int(displayedBpm.rounded())) BPM") Text("\(Int(displayedBpm.rounded())) BPM")
.font(.system(size: 18, weight: .semibold, design: .rounded)) .font(.system(size: 18, weight: .semibold, design: .rounded))
.foregroundStyle(Color.white) .foregroundStyle(Color.white)
@@ -67,15 +95,16 @@ public struct TempoView: View {
step: TempoView.bpmStep step: TempoView.bpmStep
) )
.labelsHidden() .labelsHidden()
}
tapArea tapArea
} }
.task { }
while !Task.isCancelled { // Pin to the enabled height (BPM / stepper / TAP visible) so toggling tempo on/off never
let beat: Double = shoeGaze.clock.currentBeat // shifts the surrounding layout.
let phase: Double = beat - beat.rounded(.down) .frame(height: TempoView.enabledHeight)
ledOn = phase < TempoView.flashDutyCycle .task(id: shoeGaze.tempoEnabled) {
while shoeGaze.tempoEnabled && !Task.isCancelled {
beat = shoeGaze.clock.currentBeat
displayedBpm = shoeGaze.clock.bpm displayedBpm = shoeGaze.clock.bpm
try? await Task.sleep(nanoseconds: TempoView.pollIntervalNanoseconds) try? await Task.sleep(nanoseconds: TempoView.pollIntervalNanoseconds)
} }
@@ -84,24 +113,76 @@ public struct TempoView: View {
// MARK: - Subviews // MARK: - Subviews
private var led: some View { /// Horizontal pendulum: the dot maps `beat` through a cosine so it eases to a stop at each
Circle() /// wall (an integer beat) and moves fastest at mid-swing — the wall pauses give the eye a
.fill(ledOn ? Color.red : Color.red.opacity(0.15)) /// runway to anticipate the beat. `x01 = (1 − cos(π·swing)) / 2`, `swing = beat mod 2`, puts
.frame(width: TempoView.ledDiameter, height: TempoView.ledDiameter) /// the left wall on even beats and the right wall on odd beats (one wall hit per beat).
private var metronome: some View {
// Reduce beat mod 2 before the cosine so precision holds over a long session.
let swing: Double = beat.truncatingRemainder(dividingBy: 2)
let x01: Double = (1 - cos(.pi * swing)) / 2
// Proximity to a wall in [0, 1]: 1 at a wall (on the beat), 0 at mid-swing. The curve dims
// harder through the middle so the playhead visibly fades as it travels toward center.
let wallGlow: Double = pow(1 - 2 * min(x01, 1 - x01), TempoView.brightnessFadeCurve)
return ZStack(alignment: .leading) {
RoundedRectangle(cornerRadius: TempoView.trackCornerRadius)
.fill(Color(white: TempoView.trackBrightness))
.overlay(
RoundedRectangle(cornerRadius: TempoView.trackCornerRadius)
.strokeBorder(
Color.white.opacity(TempoView.trackBorderOpacity),
lineWidth: TempoView.trackBorderWidth
)
)
// Beat-position tick marks flush against each end wall.
.overlay(alignment: .leading) { wallTick }
.overlay(alignment: .trailing) { wallTick }
playhead(x01: x01, wallGlow: wallGlow)
}
.frame(width: TempoView.trackWidth, height: TempoView.trackHeight)
.clipShape(RoundedRectangle(cornerRadius: TempoView.trackCornerRadius))
}
private var wallTick: some View {
Rectangle()
.fill(Color.white.opacity(TempoView.wallTickOpacity))
.frame(width: TempoView.wallTickWidth)
}
private func playhead(x01: Double, wallGlow: Double) -> some View {
// Travel spans the track minus the line's own width so the playhead kisses each wall.
let travel: CGFloat = TempoView.trackWidth - TempoView.lineWidth
let x: CGFloat = CGFloat(x01) * travel
let lineOpacity: Double = TempoView.lineMinOpacity + (1 - TempoView.lineMinOpacity) * wallGlow
// Center glow + line share a leading-aligned box; offset positions the line's leading edge.
return ZStack {
Rectangle()
.fill(Color.red.opacity(TempoView.glowMaxOpacity * wallGlow))
.frame(width: TempoView.glowWidth, height: TempoView.trackHeight)
.blur(radius: TempoView.glowWidth / 3)
Rectangle()
.fill(Color.red.opacity(lineOpacity))
.frame(width: TempoView.lineWidth, height: TempoView.trackHeight)
}
.frame(width: TempoView.lineWidth, height: TempoView.trackHeight, alignment: .center)
.offset(x: x)
} }
private var tapArea: some View { private var tapArea: some View {
// A standard-height bordered button (not a tall circle) so the tempo row matches the
// height of the title and the engine-option buttons and top-aligns cleanly with them.
Button { Button {
shoeGaze.tapTempo() shoeGaze.tapTempo()
displayedBpm = shoeGaze.clock.bpm displayedBpm = shoeGaze.clock.bpm
} label: { } label: {
Text("TAP") Text("TAP")
.font(.system(size: 14, weight: .bold, design: .rounded)) .font(.system(size: 13, weight: .bold, design: .rounded))
.frame(width: TempoView.tapAreaSize, height: TempoView.tapAreaSize)
.background(Color.white.opacity(0.08))
.clipShape(Circle())
} }
.buttonStyle(.plain) .buttonStyle(.bordered)
.tint(.gray)
.foregroundStyle(Color.white) .foregroundStyle(Color.white)
} }
} }
+12 -12
View File
@@ -26,10 +26,12 @@ public struct TunerView: View {
private static let trackingConfidenceThreshold: Double = 0.8 private static let trackingConfidenceThreshold: Double = 0.8
/// Opacity applied to the latched readout while not actively tracking. /// Opacity applied to the latched readout while not actively tracking.
private static let untrackedOpacity: Double = 0.35 private static let untrackedOpacity: Double = 0.35
private static let panelSpacing: CGFloat = 10
private static let rowSpacing: CGFloat = 14 private static let rowSpacing: CGFloat = 14
private static let noteFontSize: CGFloat = 34 private static let readoutSpacing: CGFloat = 10
private static let noteFontSize: CGFloat = 24
private static let statusFontSize: CGFloat = 10 private static let statusFontSize: CGFloat = 10
/// Fixed row height = the engaged (readout-visible) height, so toggling doesn't shift layout.
static let engagedHeight: CGFloat = 34
// MARK: - Properties // MARK: - Properties
@@ -50,25 +52,23 @@ public struct TunerView: View {
// MARK: - Body // MARK: - Body
public var body: some View { public var body: some View {
VStack(spacing: TunerView.panelSpacing) { // Single horizontal row so engaging the tuner grows it sideways, not downward — the
// transport row keeps its height and the pedals below don't jump.
HStack(spacing: TunerView.rowSpacing) { HStack(spacing: TunerView.rowSpacing) {
Button(shoeGaze.tunerEngaged ? "Tuner: On" : "Tuner: Off") { Button(shoeGaze.tunerEngaged ? "Tuner: On" : "Tuner: Off") {
shoeGaze.toggleTunerEngaged() shoeGaze.toggleTunerEngaged()
} }
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(shoeGaze.tunerEngaged ? .green : .gray) .tint(shoeGaze.tunerEngaged ? .green : .gray)
.fixedSize()
Toggle("Mute rig", isOn: Binding(
get: { shoeGaze.tunerMutesRig },
set: { shoeGaze.tunerMutesRig = $0 }
))
.toggleStyle(.switch)
}
if shoeGaze.tunerEngaged { if shoeGaze.tunerEngaged {
readout readout
} }
} }
// Pin to the engaged height (the taller readout state) so toggling the tuner on/off never
// shifts the surrounding layout by a few pixels.
.frame(height: TunerView.engagedHeight)
.task(id: shoeGaze.tunerEngaged) { .task(id: shoeGaze.tunerEngaged) {
while shoeGaze.tunerEngaged && !Task.isCancelled { while shoeGaze.tunerEngaged && !Task.isCancelled {
updateReading() updateReading()
@@ -100,7 +100,7 @@ public struct TunerView: View {
@ViewBuilder @ViewBuilder
private var readout: some View { private var readout: some View {
if let pitch: TunerPitchReading = latchedPitch { if let pitch: TunerPitchReading = latchedPitch {
VStack(spacing: 6) { HStack(spacing: TunerView.readoutSpacing) {
Text(pitch.noteName) Text(pitch.noteName)
.font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded)) .font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded))
.foregroundStyle(TunerView.color(forCents: pitch.cents)) .foregroundStyle(TunerView.color(forCents: pitch.cents))
@@ -111,7 +111,7 @@ public struct TunerView: View {
} }
.opacity(isTracking ? 1.0 : TunerView.untrackedOpacity) .opacity(isTracking ? 1.0 : TunerView.untrackedOpacity)
} else { } else {
VStack(spacing: 6) { HStack(spacing: TunerView.readoutSpacing) {
Text("—") Text("—")
.font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded)) .font(.system(size: TunerView.noteFontSize, weight: .bold, design: .rounded))
.foregroundStyle(Color.white.opacity(0.4)) .foregroundStyle(Color.white.opacity(0.4))
@@ -163,13 +163,13 @@ struct LooperPedalTests {
@Test func exposesLooperControls() throws { @Test func exposesLooperControls() throws {
let pedal: LooperPedal = LooperPedal() let pedal: LooperPedal = LooperPedal()
#expect(pedal.effectKnobs.map { $0.label } == ["Crossfade", "Playback", "Overdub", "Feedback"]) #expect(pedal.effectKnobs.map { $0.label } == ["Crossfade", "Playback", "Overdub", "Feedback"])
#expect(pedal.effectSwitches.map { $0.label } == ["Sync"]) #expect(pedal.effectSwitches.map { $0.label } == ["Sync to Tempo"])
#expect(pedal.effectButtons.isEmpty) #expect(pedal.effectButtons.isEmpty)
#expect(pedal.effectTransportButtons.map { $0.label } == ["Loop", "Stop", "Cue Stop", "Reverse", "Reset"]) #expect(pedal.effectTransportButtons.map { $0.label } == ["Loop", "Stop", "Cue Stop", "Reverse", "Reset"])
} }
@Test func looperIsDoubleWidth() throws { @Test func looperIsTripleWidth() throws {
#expect(LooperPedal().widthUnits == 2) #expect(LooperPedal().widthUnits == 3)
#expect(LooperPedal.trackCount == 4) #expect(LooperPedal.trackCount == 4)
} }
@@ -420,6 +420,75 @@ struct LooperPedalTests {
} } } }
} }
@Test func reverseDoesNotJumpPlayHeadPosition() throws {
let sampleRate: Double = 44100.0
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
try makeQuantizedFixture(bpm: 120.0, sampleRate: sampleRate)
withExtendedLifetime(engine) { withExtendedLifetime(clock) {
// Record a 1-second master (record start at 0, close at 44100) → masterLength = 44100.
pedal.pressLoop()
pedal.applyQuantizedTransport(.beginMaster, generation: pedal.transportGeneration, at: SampleTime(0))
let closeSample: SampleTime = SampleTime(sampleRate)
pedal.pressLoop()
pedal.applyQuantizedTransport(.closeMaster, generation: pedal.transportGeneration, at: closeSample)
#expect(pedal.transportState == .playing)
// A quarter of the way in, moving forward.
let quarter: SampleTime = closeSample + SampleTime(sampleRate * 0.25)
#expect(abs(pedal.playHeadFraction(at: quarter) - 0.25) < 0.001)
// Reversing here must NOT jump the read-out to the mirror point (0.75) — it stays at 0.25.
pedal.applyReverse(at: quarter)
#expect(abs(pedal.playHeadFraction(at: quarter) - 0.25) < 0.001,
"reverse must continue from the current position, not jump to duration − position")
// Advancing time now walks the position backward from 0.25.
let laterBy: SampleTime = SampleTime(sampleRate * 0.10)
#expect(abs(pedal.playHeadFraction(at: quarter + laterBy) - 0.15) < 0.001,
"reversed play head moves backward from the reverse point")
} }
}
@Test func reverseDefersToNextBeatInSyncMode() throws {
let sampleRate: Double = 44100.0
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
try makeQuantizedFixture(bpm: 120.0, sampleRate: sampleRate)
withExtendedLifetime(engine) { withExtendedLifetime(clock) {
pedal.pressLoop()
pedal.applyQuantizedTransport(.beginMaster, generation: pedal.transportGeneration, at: SampleTime(0))
pedal.pressLoop()
pedal.applyQuantizedTransport(.closeMaster, generation: pedal.transportGeneration, at: SampleTime(sampleRate))
#expect(pedal.transportState == .playing)
#expect(pedal.overdubbingTrackIndex == 0)
// Sync mode (default): the press is deferred — direction and overdub are untouched.
pedal.toggleReverse()
#expect(pedal.reverse == 0.0, "sync-mode reverse waits for the next beat")
#expect(pedal.overdubbingTrackIndex == 0, "overdub survives until the deferred reverse fires")
// The beat arrives: direction flips and the overdub ends.
pedal.applyDeferredReverse(generation: pedal.reverseGeneration, at: SampleTime(sampleRate * 2))
#expect(pedal.reverse == 1.0)
#expect(pedal.overdubbingTrackIndex == nil, "engaging reverse ends the overdub")
} }
}
@Test func reverseIsImmediateInFreeMode() throws {
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0)
withExtendedLifetime(engine) { withExtendedLifetime(clock) {
pedal.syncToBeat = 0.0
pedal.pressLoop() // record A (immediate)
pedal.pressLoop() // play + overdub A (immediate)
#expect(pedal.transportState == .playing)
// Free mode: reverse applies right away, even with a clock present.
pedal.toggleReverse()
#expect(pedal.reverse == 1.0, "free-mode reverse is immediate")
#expect(pedal.overdubbingTrackIndex == nil, "engaging reverse ends the overdub")
} }
}
@Test func engineStopResetsLooperAndPostsNotice() throws { @Test func engineStopResetsLooperAndPostsNotice() throws {
let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) = let (engine, clock, pedal): (SynthesisEngine, LyrebirdClock, LooperPedal) =
try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0) try makeQuantizedFixture(bpm: 120.0, sampleRate: 44100.0)
@@ -316,6 +316,138 @@ struct PresetTests {
#expect(abs(driveValue - 12.0) < 1e-9, "drive knob value should be 12.0, got \(driveValue)") #expect(abs(driveValue - 12.0) < 1e-9, "drive knob value should be 12.0, got \(driveValue)")
} }
// MARK: - Tempo & input persistence
@Test func tempoAndInputSettingsRoundTripThroughFile() throws {
let (sg, _, url): (ShoeGaze, SynthesisEngine, URL) = try makeTwoBoardRig()
defer { try? FileManager.default.removeItem(at: url) }
let presetURL: URL = FileManager.default.temporaryDirectory
.appendingPathComponent(UUID().uuidString + ".json")
defer { try? FileManager.default.removeItem(at: presetURL) }
// Save a distinctive tempo + disabled tempo features (input stays on the test loop).
let savedBpm: Double = 132.0
sg.clock.bpm = savedBpm
sg.setTempoEnabled(false)
try sg.saveRig(to: presetURL)
// Drift the live values away from what was saved, then confirm the reload restores them.
sg.clock.bpm = 90.0
sg.setTempoEnabled(true)
try sg.loadRig(from: presetURL)
#expect(abs(sg.clock.bpm - savedBpm) < 1e-9, "bpm should restore to \(savedBpm)")
#expect(sg.tempoEnabled == false, "tempoEnabled should restore to false")
#expect(sg.inputSource == .testLoop, "input source should restore to test loop")
}
@Test func liveInputSourcePersistsAndFallsBackWhenChannelMissing() throws {
// Engine WITH an input channel: a live-input rig round-trips its source.
let (engineIn, urlIn): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numInputChannels: 1,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlIn) }
let sgIn: ShoeGaze = ShoeGaze(engine: engineIn, inputSource: .liveInput(channel: 0))
let board: PedalBoard = try sgIn.addBoard()
try board.add(OverdrivePedal())
try sgIn.finalizeBoard(board)
let state: ShoeGazeState = sgIn.captureState()
#expect(state.inputSource == .liveInput(channel: 0), "capture should record the live input")
// Reload into the same input-capable engine: source preserved.
try sgIn.loadRig(from: state)
#expect(sgIn.inputSource == .liveInput(channel: 0), "live input should round-trip")
// loadRig does NOT auto-apply the saved channel layout, so loading into an engine with no
// input channels falls back to the test loop rather than clobbering the engine's config.
let (engineNoIn, urlNoIn): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numInputChannels: 0,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlNoIn) }
let sgNoIn: ShoeGaze = ShoeGaze(engine: engineNoIn)
try sgNoIn.loadRig(from: state)
#expect(engineNoIn.numInputChannels == 0, "loadRig must not reconfigure the engine's I/O")
#expect(sgNoIn.inputSource == .testLoop, "missing channel should fall back to test loop")
}
@Test func channelCountsPersistButLoadDoesNotReconfigure() throws {
// Capture a rig on an engine with 1 input / 2 output channels: the counts are recorded and
// survive a JSON round-trip.
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numOutputChannels: 2,
numInputChannels: 1,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlA) }
let sgA: ShoeGaze = ShoeGaze(engine: engineA)
let boardA: PedalBoard = try sgA.addBoard()
try boardA.add(OverdrivePedal())
try sgA.finalizeBoard(boardA)
let state: ShoeGazeState = sgA.captureState()
#expect(state.numInputChannels == 1)
#expect(state.numOutputChannels == 2)
let decoded: ShoeGazeState = try JSONDecoder().decode(
ShoeGazeState.self, from: JSONEncoder().encode(state)
)
#expect(decoded.numInputChannels == 1)
#expect(decoded.numOutputChannels == 2)
// Loading the rig must NOT reconfigure the destination engine's channel layout.
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numOutputChannels: 2,
numInputChannels: 0,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlB) }
let sgB: ShoeGaze = ShoeGaze(engine: engineB)
try sgB.loadRig(from: state)
#expect(engineB.numInputChannels == 0, "loadRig must leave engine I/O untouched")
}
@Test func applyChannelLayoutReconfiguresEngineToSavedCounts() throws {
// The deliberate opt-in DOES reconfigure the engine to a rig's saved channel layout.
let (engineA, urlA): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numOutputChannels: 2,
numInputChannels: 1,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlA) }
let sgA: ShoeGaze = ShoeGaze(engine: engineA)
let boardA: PedalBoard = try sgA.addBoard()
try boardA.add(OverdrivePedal())
try sgA.finalizeBoard(boardA)
let state: ShoeGazeState = sgA.captureState()
let (engineB, urlB): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.1,
numOutputChannels: 2,
numInputChannels: 0,
numAudioBuses: 128
)
defer { try? FileManager.default.removeItem(at: urlB) }
let sgB: ShoeGaze = ShoeGaze(engine: engineB)
try sgB.loadRig(from: state)
#expect(engineB.numInputChannels == 0, "load alone leaves I/O untouched")
let changed: Bool = try sgB.applyChannelLayout(from: state)
#expect(changed, "applyChannelLayout should report a change")
#expect(engineB.numInputChannels == 1, "opt-in apply reconfigures to the saved input count")
#expect(engineB.numOutputChannels == 2)
// Idempotent: applying again with matching counts is a no-op.
let changedAgain: Bool = try sgB.applyChannelLayout(from: state)
#expect(!changedAgain, "no reconfigure when counts already match")
}
// MARK: - Save / Load via temp file // MARK: - Save / Load via temp file
@Test func saveRigAndLoadRigRestoresKnobValues() throws { @Test func saveRigAndLoadRigRestoresKnobValues() throws {
@@ -202,4 +202,138 @@ struct RigLibraryStoreTests {
#expect(store.entries.isEmpty) #expect(store.entries.isEmpty)
store.flushPendingWrites() store.flushPendingWrites()
} }
// MARK: - Set-list ordering
@Test func newSavesAppendToSetListInSaveOrder() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
// Save in reverse-alphabetical order; the set list keeps SAVE order, not name order.
try store.save(makeEntry("Zebra"))
try store.save(makeEntry("Alpha"))
#expect(store.entries.map(\.name) == ["Zebra", "Alpha"])
#expect(store.entries.map(\.sortIndex) == [0, 1])
store.flushPendingWrites()
}
@Test func moveUpMoveDownReorderAndPersistAcrossReload() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
try store.save(makeEntry("A"))
try store.save(makeEntry("B"))
try store.save(makeEntry("C"))
// A,B,C → move C up → A,C,B → move A down → C,A,B
guard let entryC: RigEntry = store.entries.first(where: { $0.name == "C" }) else {
Issue.record("missing C"); return
}
store.moveUp(entryC)
#expect(store.entries.map(\.name) == ["A", "C", "B"])
guard let entryA: RigEntry = store.entries.first(where: { $0.name == "A" }) else {
Issue.record("missing A"); return
}
store.moveDown(entryA)
#expect(store.entries.map(\.name) == ["C", "A", "B"])
#expect(store.entries.map(\.sortIndex) == [0, 1, 2])
// Order survives a fresh store over the same directory.
store.flushPendingWrites()
let reopened: RigLibraryStore = RigLibraryStore(directory: dir, isICloud: false)
await reopened.start()
#expect(reopened.entries.map(\.name) == ["C", "A", "B"])
}
@Test func moveFromOffsetsReordersAndRenumbers() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
try store.save(makeEntry("A"))
try store.save(makeEntry("B"))
try store.save(makeEntry("C"))
// SwiftUI List.onMove semantics: move the first row to the end.
store.move(fromOffsets: IndexSet(integer: 0), toOffset: 3)
#expect(store.entries.map(\.name) == ["B", "C", "A"])
#expect(store.entries.map(\.sortIndex) == [0, 1, 2])
store.flushPendingWrites()
}
@Test func applyOrderReordersAndRenumbers() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
try store.save(makeEntry("A"))
try store.save(makeEntry("B"))
try store.save(makeEntry("C"))
let byName: [String: UUID] = Dictionary(uniqueKeysWithValues: store.entries.map { ($0.name, $0.id) })
store.applyOrder([byName["C"], byName["A"], byName["B"]].compactMap { $0 })
#expect(store.entries.map(\.name) == ["C", "A", "B"])
#expect(store.entries.map(\.sortIndex) == [0, 1, 2])
store.flushPendingWrites()
}
@Test func renamePreservesSetListPosition() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
try store.save(makeEntry("A"))
try store.save(makeEntry("B"))
try store.save(makeEntry("C"))
let byName: [String: UUID] = Dictionary(uniqueKeysWithValues: store.entries.map { ($0.name, $0.id) })
store.applyOrder([byName["C"], byName["A"], byName["B"]].compactMap { $0 })
// Renaming the middle rig keeps its slot rather than re-sorting by the new name.
guard let entryA: RigEntry = store.entries.first(where: { $0.name == "A" }) else {
Issue.record("missing A"); return
}
_ = try store.rename(entryA, to: "Zzz")
#expect(store.entries.map(\.name) == ["C", "Zzz", "B"])
store.flushPendingWrites()
}
@Test func exportedArchiveCarriesSetListOrder() async throws {
let (store, dir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: dir) }
try store.save(makeEntry("A"))
try store.save(makeEntry("B"))
try store.save(makeEntry("C"))
let byName: [String: UUID] = Dictionary(uniqueKeysWithValues: store.entries.map { ($0.name, $0.id) })
store.applyOrder([byName["C"], byName["A"], byName["B"]].compactMap { $0 })
let archiveData: Data = try store.exportArchiveData()
// A fresh store importing the archive sees the same set-list order.
let (other, otherDir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: otherDir) }
_ = try other.importArchive(from: archiveData)
#expect(other.entries.map(\.name) == ["C", "A", "B"])
store.flushPendingWrites()
other.flushPendingWrites()
}
@Test func importAppendsAfterExistingRigsWithoutInterleaving() async throws {
// Source archive with its own set-list order.
let (source, srcDir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: srcDir) }
try source.save(makeEntry("Import1"))
try source.save(makeEntry("Import2"))
let archiveData: Data = try source.exportArchiveData()
// Destination already holds two placed rigs; the import must land AFTER them (append),
// not interleave by name/date on a colliding sortIndex.
let (dest, destDir): (RigLibraryStore, URL) = await makeStore()
defer { try? FileManager.default.removeItem(at: destDir) }
try dest.save(makeEntry("Existing1"))
try dest.save(makeEntry("Existing2"))
_ = try dest.importArchive(from: archiveData)
#expect(dest.entries.map(\.name) == ["Existing1", "Existing2", "Import1", "Import2"])
#expect(dest.entries.map(\.sortIndex) == [0, 1, 2, 3])
source.flushPendingWrites()
dest.flushPendingWrites()
}
} }
@@ -0,0 +1,55 @@
// TempoEnableTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import Testing
import Foundation
import LyrebirdSynth
@testable import LyrebirdShoeGaze
@MainActor
@Suite("Tempo enable")
struct TempoEnableTests {
private func makeRigWithLooper() throws -> (ShoeGaze, SynthesisEngine, URL, LooperPedal) {
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.1)
let sg: ShoeGaze = ShoeGaze(engine: engine)
let board: PedalBoard = try sg.addBoard()
guard let looper: LooperPedal = PedalRegistry.makePedal(type: "Looper") as? LooperPedal else {
fatalError("Looper pedal must be registered")
}
try board.add(looper)
try sg.finalizeBoard(board)
return (sg, engine, url, looper)
}
@Test func tempoEnabledDefaultsOn() throws {
let (sg, _, url, _): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
defer { try? FileManager.default.removeItem(at: url) }
#expect(sg.tempoEnabled, "tempo indicator is on by default")
}
@Test func looperSyncSwitchIsTempoDependent() throws {
let (_, _, url, looper): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
defer { try? FileManager.default.removeItem(at: url) }
let syncSwitch: PedalSwitch? = looper.effectSwitches.first { $0.tempoDependent }
#expect(syncSwitch != nil, "the looper Sync-to-Tempo switch must be marked tempo-dependent")
}
@Test func disablingTempoForcesSyncSwitchesOff() throws {
let (sg, _, url, looper): (ShoeGaze, SynthesisEngine, URL, LooperPedal) = try makeRigWithLooper()
defer { try? FileManager.default.removeItem(at: url) }
looper.syncToBeat = 1.0 // engage Sync
sg.setTempoEnabled(false)
#expect(!sg.tempoEnabled)
#expect(looper.syncToBeat == 0.0, "disabling tempo forces the looper back to Free")
// Re-enabling leaves it Free — the user re-selects Sync if wanted.
sg.setTempoEnabled(true)
#expect(sg.tempoEnabled)
#expect(looper.syncToBeat == 0.0)
}
}
+4 -6
View File
@@ -197,10 +197,8 @@ are the case names — renames are a format break. Wideners and stereo-native pe
(`OctaveUpSplitterPedal` "Octave Splitter", `PingPongDelayPedal` "Ping-Pong") are registered in (`OctaveUpSplitterPedal` "Octave Splitter", `PingPongDelayPedal` "Ping-Pong") are registered in
`PedalRegistry`. Unknown pedal types are skipped on load, including inside branches. `PedalRegistry`. Unknown pedal types are skipped on load, including inside branches.
The macOS Demo app has a `.stereo` mode (`ShoeGazeDemoController.buildStereo()` + The Builder app composes stereo chains directly from the palette — e.g. Overdrive →
`DemoRootView.stereoContent`): Overdrive → `splitStereo(Delay | Ping-Pong)` → `collectStereo`, `splitStereo(Delay | Ping-Pong)` → `collectStereo`, with the four route modes selectable live.
with the four route modes selectable live.
Deferred (follow-up): an iOS demo showcase (the iOS demo app has no mode switcher); rendering Deferred (follow-up): rendering the board's `orderedSegments` directly in a generic board view
the board's `orderedSegments` directly in a generic board view (today the UI composes pedal (today the UI composes pedal rows and section views separately).
rows and section views separately).