diff --git a/Sources/LyrebirdShoeGazeUI/HelpView.swift b/Sources/LyrebirdShoeGazeUI/HelpView.swift index dc35fcf..da596fe 100644 --- a/Sources/LyrebirdShoeGazeUI/HelpView.swift +++ b/Sources/LyrebirdShoeGazeUI/HelpView.swift @@ -40,6 +40,9 @@ public struct HelpView: View { 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.", ] ) @@ -63,11 +66,17 @@ public struct HelpView: View { topicSection( icon: "waveform", title: "Choosing an Input", - intro: "Pick what feeds the board.", + 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.", + + "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( @@ -143,9 +152,10 @@ public struct HelpView: View { 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, 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.", + "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 " diff --git a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift index 45e17ed..d94892c 100644 --- a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift +++ b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift @@ -1209,19 +1209,71 @@ public struct ShoeGazeBuilderView: View { } /// Input-mute toggle, shown beside the Start/Stop transport. Silences the incoming guitar / mic - /// signal (distinct from the rig-output mute). Comes up muted on each engine start. + /// signal (distinct from the rig-output mute). Comes up muted on each engine start, with a + /// pulsing red glow while muted so new users spot why they hear nothing. private var inputMuteButton: some View { - let muted: Bool = shoeGaze.inputMuted - return Button { - shoeGaze.toggleInputMuted() - } label: { - Label(muted ? "Input Muted" : "Mute Input", - systemImage: muted ? "mic.slash.fill" : "mic.fill") - .font(.subheadline) + InputMuteButton(shoeGaze: shoeGaze) + } + + /// The input-mute toggle with a pulsing red glow while active. Its own view so it can own the + /// repeating-animation state; the glow reads `pulse`, which oscillates under a `repeatForever` + /// animation only while the input is muted. + private struct InputMuteButton: View { + + let shoeGaze: ShoeGaze + + /// Oscillates 0↔1 under a repeating animation while muted, driving the glow's radius/opacity. + @State private var pulse: Bool = false + + private static let glowCornerRadius: CGFloat = 6 + private static let glowLineWidth: CGFloat = 1.5 + private static let glowRadiusLow: CGFloat = 2 + private static let glowRadiusHigh: CGFloat = 9 + private static let glowOpacityLow: Double = 0.35 + private static let glowOpacityHigh: Double = 0.95 + private static let pulseDuration: Double = 0.85 + + var body: some View { + let muted: Bool = shoeGaze.inputMuted + return Button { + shoeGaze.toggleInputMuted() + } label: { + Label(muted ? "Input Muted" : "Mute Input", + systemImage: muted ? "mic.slash.fill" : "mic.fill") + .font(.subheadline) + } + .buttonStyle(.bordered) + .tint(muted ? .red : .gray) + .overlay(glow(muted: muted)) + .help("Mute the input feeding the pedals — silences the incoming guitar / mic signal") + .onChange(of: muted) { _, nowMuted in startOrStopPulse(muted: nowMuted) } + .onAppear { startOrStopPulse(muted: muted) } + } + + /// A red ring + shadow that pulses while muted, and is invisible otherwise. Non-interactive + /// so it never intercepts the button's taps. + private func glow(muted: Bool) -> some View { + RoundedRectangle(cornerRadius: InputMuteButton.glowCornerRadius, style: .continuous) + .strokeBorder(Color.red, lineWidth: InputMuteButton.glowLineWidth) + .shadow( + color: Color.red, + radius: pulse ? InputMuteButton.glowRadiusHigh : InputMuteButton.glowRadiusLow + ) + .opacity(muted ? (pulse ? InputMuteButton.glowOpacityHigh : InputMuteButton.glowOpacityLow) : 0) + .allowsHitTesting(false) + } + + /// Starts the forever-repeating pulse when muted, or settles it back to rest when not. + private func startOrStopPulse(muted: Bool) { + if muted { + pulse = false + withAnimation(.easeInOut(duration: InputMuteButton.pulseDuration).repeatForever(autoreverses: true)) { + pulse = true + } + } else { + withAnimation(.easeOut(duration: 0.2)) { pulse = false } + } } - .buttonStyle(.bordered) - .tint(muted ? .red : .gray) - .help("Mute the input feeding the pedals — silences the incoming guitar / mic signal") } // MARK: - Board area