// HelpView.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import SwiftUI /// The in-app user guide, shared by both platforms — presented from the macOS **Help** menu (in a /// window) and an iOS **?** button (in a sheet). /// /// A sectioned `List` of topics: setup, the engine, input, boards & rigs, saving, iCloud, and MIDI. /// Text + SF Symbols only for now; each topic leaves room for a bundled screenshot to be dropped in /// later (see the commented slot in ``topicSection(icon:title:intro:steps:)``). public struct HelpView: View { // MARK: - Constants private static let windowMinWidth: CGFloat = 520 private static let windowMinHeight: CGFloat = 620 private static let bulletSpacing: CGFloat = 6 // MARK: - Init /// Creates the help view. public init() {} @Environment(\.dismiss) private var dismiss // MARK: - Body public var body: some View { NavigationStack { List { topicSection( icon: "power", title: "Setup & Starting the Engine", intro: "ShoeGaze runs your guitar — or a built-in test phrase — through a chain " + "of pedals. Configure the audio, then press Start.", steps: [ "Set the sample Rate and the input/output channel counts in the top-right controls.", "Press Start to run the engine; press again to Stop. Most controls stay live while running.", "Input starts MUTED every time you press Start — a safety default so nothing squeals " + "the instant the engine spins up. The Input Mute button (microphone icon, left of " + "the Start button) pulses red while muted; click it to let your instrument through.", "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( icon: "waveform", title: "Choosing an Input", intro: "Pick what feeds the board, and mute it when you need silence.", steps: [ "Input ▸ Test Loop plays a built-in phrase, so you can hear the rig with no guitar connected.", "Input ▸ In 0 (Live Input on iOS) uses your audio interface or mic. iOS asks for " + "microphone access the first time you enable it. New rigs open on In 0.", "Input Mute (microphone icon, left of Start) is a hard gate on the incoming signal — " + "distinct from Rig Mute, which silences the OUTPUT. Use it to stop feedback or " + "handling noise while you set up. It pulses red while muted, and re-arms muted on " + "every Start.", "The input mute is MIDI-mappable — bind it to a footswitch or key in MIDI / Control " + "Mapping for a hands-free panic mute of your instrument.", ] ) topicSection( icon: "square.stack.3d.up", title: "Boards & Rigs", intro: "A rig is a set of boards; a board is a chain of pedals.", steps: [ "Drag a pedal from the palette onto the chain to add it; drop it onto a pedal to " + "insert before it; tap a palette pedal to append.", "Add boards with +. Solo / Blend / All choose which boards you hear; XFade sets the " + "crossfade time; each board has S (solo) and B (bypass).", "The Rigs sidebar lists saved rigs, with New, Save, Save As, Duplicate, Rename, " + "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.", "Switching rigs keeps your current input — your live guitar stays selected " + "instead of snapping back to the test loop.", ] ) topicSection( icon: "guitars", title: "Starter Rigs", intro: "ShoeGaze ships a library of ready-to-play rigs so you always have somewhere " + "to start.", steps: [ "The Rigs sidebar has a Mine / Starters toggle at the top: Mine is your own " + "saved rigs; Starters is the shipped set, grouped by style — Shoegaze " + "Walls, Dreampop, Classic, Ambient, and Experimental.", "Tap a starter to load it. To keep your tweaks, use Save As or Duplicate to make " + "your own copy — saving directly over a starter asks first and offers Save " + "as New Rig.", "Restore Starter Rigs (the rig-library ⋯ menu, or the Starters empty state) " + "reinstalls the shipped rigs — handy if you deleted some, or to refresh " + "them after an update.", ] ) topicSection( icon: "amplifier", title: "Amp Models", intro: "Amp Model pedals are complete guitar amplifiers — preamp, tone stack, power " + "amp, and a built-in speaker cabinet in one pedal. They live in the Amp Model " + "row of the palette.", steps: [ "Pick an amp from the Amp Model category. Each has its own voice: Gain (preamp " + "drive), a Bass / Mid / Treble tone stack, and a Cab selector for its " + "built-in speaker. Full-surface amps add signature controls — Master, " + "Presence, Reverb, Tremolo, a channel switch, and so on.", "Gain (and a drive channel's Drive) read 1–11 with a musical taper: most of the " + "usable grit spreads across the dial, with full saturation at the top.", "Master vs Level: Master drives the power-amp stage — turning it up saturates the " + "amp like a real master volume. Level is a clean output trim applied after " + "the amp; it changes loudness, not tone.", "No digital clipping: every amp ends in an analog-style soft limiter, so a driven " + "amp compresses toward its ceiling instead of clipping harshly.", "Advanced controls (the sliders button at the top-right of the amp card open a " + "pop-over): Sag, Bias, and Bias X — power-amp \"feel\" controls kept off the " + "main face. Sag models power-supply droop and bloom (compression and touch " + "response as you dig in); Bias sets the power tubes' operating point (cold = " + "tighter, more bite; hot = warmer, rounder); Bias X balances the push-pull " + "pair to shift the harmonic character. All are subtle set-and-leave voicing " + "controls that default to neutral.", ] ) topicSection( icon: "hifispeaker", title: "Cabinets & Microphones", intro: "Every amp has a built-in cabinet, but you can also run a dedicated Cabinet " + "pedal for full speaker-and-microphone control.", steps: [ "Built-in vs standalone: an amp's Cab selector picks its onboard speaker voicing " + "— the quick path, one knob. For deeper control, set the amp's Cab to " + "\"None (direct)\" and add a Cabinet pedal after it. (On \"None\" the amp " + "sounds raw and fizzy by itself — expected; the Cabinet pedal is what " + "supplies the speaker.)", "The Cabinet pedal's Cab selector chooses the speaker voicing, and Mic chooses the " + "microphone — Dynamic, Ribbon, Condenser, or No Mic. The mic colour is baked " + "into the same speaker response, so it costs nothing extra.", "Mic placement (the Cabinet's advanced pop-over, again via the top-right sliders " + "button): Position moves the mic from on-axis (bright, on the dust cap) " + "toward the cone edge (darker, smoother); Proximity runs from a distant, " + "flat low end to a close-mic'd bass lift.", "Dual-mic (same pop-over): set Mic B to a second microphone to blend two mics. " + "Mic Blend sets the A/B balance; Mic Offset spaces them apart for the comb " + "colour of a real two-mic setup (a set-and-leave spacing control — sweeping " + "it live acts like a flanger).", ] ) 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) or key actions in MIDI / Control Mapping; the " + "Crossfade / Playback / Overdub / Feedback knobs sweep from an expression pedal " + "like any pedal knob.", ] ) topicSection( icon: "square.and.arrow.down", title: "Saving & Autosave", intro: "Your work is kept two ways.", steps: [ "Save writes the current rig to the highlighted library entry; Save As creates a new one.", "The working session autosaves continuously, so it returns on relaunch even without an " + "explicit Save. The sidebar highlights the rig the session came from.", ] ) topicSection( icon: "icloud", title: "iCloud Documents", intro: "Keep your rig library in sync across devices.", steps: [ "With iCloud Drive on, saved rigs sync across your devices. The cloud icon in the Rigs " + "header shows the status.", "A slashed cloud means local-only. Sign in to iCloud and turn on iCloud Drive in " + "Settings, then reopen ShoeGaze.", ] ) topicSection( icon: "pianokeys", title: "MIDI / Control", intro: "Map a MIDI foot controller (e.g. a Behringer FCB1010) or your computer keyboard for " + "hands-free control.", steps: [ "The keys icon in the top bar lights green when a device is connected. Tap it to open " + "MIDI / Control Mapping.", "Switches: footswitches and letter keys toggle Rig Bypass, Rig Mute, Input Mute, All " + "Boards, and each board's Solo / Audible / Bypass or a pedal's bypass. Tap PC then " + "press a footswitch, or Key then press a key. One switch or key can drive several " + "actions at once — a scene.", "Keys fire only when you're not typing — while a text field (like a rig name) is focused, " + "letters go to the field, not to your mappings.", "Hold Shift, Control, or Option while learning to bind a modified key — a and ⇧a are " + "separate triggers. Command is reserved for the menu shortcuts.", "Expression (Control Change): an expression pedal sweeps any pedal knob or slider, or a " + "board's Level. Tap Learn, then move the pedal. Invert reverses the sweep — map one " + "CC to two controls and invert one for a crossfade.", ] ) topicSection( icon: "checkmark.seal", title: "Acknowledgments", intro: "ShoeGaze is built on the Lyrebird audio-synthesis engine. Third-party resources " + "and techniques used in this app:", steps: [ "Lyrebird audio engine (Joshua Parmenter / realizedsound) — MIT licensed.", "Filter design follows the RBJ Audio EQ Cookbook by Robert Bristow-Johnson — the " + "standard biquad coefficient formulas, used to synthesize the Cabinet pedal's " + "built-in speaker impulse responses.", "The Cabinet pedal's built-in cab and microphone voicings are original impulse " + "responses generated in code — not captures of any third-party speaker, " + "microphone, or IR pack.", "The tube-amp voice pedals' tone stacks " + "follow the Yeh & Smith analysis of the classic passive tone-stack circuit (\"Discretization " + "of the '59 Fender Bassman Tone Stack\", DAFx-06); their models are original code, not " + "captures of specific hardware.", ] ) } .navigationTitle("ShoeGaze Help") .toolbar { ToolbarItem(placement: .confirmationAction) { Button("Done") { dismiss() } } } } .frame(minWidth: HelpView.windowMinWidth, minHeight: HelpView.windowMinHeight) } // MARK: - Topic section private func topicSection( icon: String, title: String, intro: String, steps: [String] ) -> some View { Section { Text(intro) .font(.subheadline) ForEach(steps, id: \.self) { step in HStack(alignment: .firstTextBaseline, spacing: HelpView.bulletSpacing) { Text("•") Text(step) } .font(.callout) } // Screenshot slot: Image("help-\(icon)", bundle: .module).resizable().scaledToFit() // once captures are added to a Resources.xcassets on this target. } header: { Label(title, systemImage: icon) } } }