From a4e181eede970637f92caff422057f35c6322d35 Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Thu, 3 Dec 2026 01:59:13 -0500 Subject: [PATCH] Debug preview: -previewInterfaceName names the silent interface, for screenshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The App Store frames read a real interface's name ("X18/XR18 · 18 out · 48 kHz"), not "Preview interface (silent)". Debug only: DebugPreview is under #if DEBUG, and Release never makes the fake interface. Assisted-by: Claude Code:claude-opus-5-5 --- App/DebugPreview.swift | 6 +++++- .../Sources/Playback/PreviewInterface.swift | 12 +++++++++++ .../PlaybackTests/PreviewInterfaceTests.swift | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Packages/SoundcheckKit/Sources/Playback/PreviewInterface.swift create mode 100644 Packages/SoundcheckKit/Tests/PlaybackTests/PreviewInterfaceTests.swift diff --git a/App/DebugPreview.swift b/App/DebugPreview.swift index daf7171..de92aef 100644 --- a/App/DebugPreview.swift +++ b/App/DebugPreview.swift @@ -1,6 +1,7 @@ #if DEBUG import AudioIO import Foundation +import Playback import Shows import ShowTakes import StemFolder @@ -17,13 +18,16 @@ import UIKit /// - `-previewScreen takes`: the Show's Take list instead, with the Take playing in the mini player (#67). /// - `-previewOutputs `: plays to a silent fake interface with `n` outputs, pulled by a timer, instead of the real /// output, so every meter moves without a sound. +/// - `-previewInterfaceName `: names that fake interface, for screenshots ("X18/XR18"); otherwise it is +/// "Preview interface (silent)". /// - `-previewAutoplay YES`: presses Play; `-previewPauseAfter ` pauses again after that long. /// - `-previewLandscape YES`: turns an iPhone or iPad to landscape, for a Simulator with no window to turn. enum DebugPreview { static let device: FakeAudioDevice? = { let outputs = UserDefaults.standard.integer(forKey: "previewOutputs") guard outputs > 0 else { return nil } - let device = FakeAudioDevice(name: "Preview interface (silent)", inputChannelCount: 0, outputChannelCount: outputs) + let name = PreviewInterface.name(asked: UserDefaults.standard.string(forKey: "previewInterfaceName")) + let device = FakeAudioDevice(name: name, inputChannelCount: 0, outputChannelCount: outputs) let thread = Thread { while true { _ = device.pull(frameCount: 1_600) diff --git a/Packages/SoundcheckKit/Sources/Playback/PreviewInterface.swift b/Packages/SoundcheckKit/Sources/Playback/PreviewInterface.swift new file mode 100644 index 0000000..f3cb579 --- /dev/null +++ b/Packages/SoundcheckKit/Sources/Playback/PreviewInterface.swift @@ -0,0 +1,12 @@ +/// The name of the Debug preview's silent fake interface (#25). Screenshots ask for a real interface's name with +/// `-previewInterfaceName`, so the header reads "X18/XR18 · 18 out · 48 kHz" (docs/app-store/listing.md, open +/// question 8). Only the Debug build makes a fake interface; a Release build never uses this. +public enum PreviewInterface { + public static let silentName = "Preview interface (silent)" + + /// The name asked for, or the silent name when none (or a blank one) is. + public static func name(asked: String?) -> String { + guard let asked, !asked.allSatisfy(\.isWhitespace) else { return silentName } + return asked + } +} diff --git a/Packages/SoundcheckKit/Tests/PlaybackTests/PreviewInterfaceTests.swift b/Packages/SoundcheckKit/Tests/PlaybackTests/PreviewInterfaceTests.swift new file mode 100644 index 0000000..b4242d0 --- /dev/null +++ b/Packages/SoundcheckKit/Tests/PlaybackTests/PreviewInterfaceTests.swift @@ -0,0 +1,20 @@ +import Testing + +@testable import Playback + +/// The Debug preview's silent interface (#25) and its name for screenshots: the App Store frames read a real +/// interface's name, not "Preview interface (silent)" (docs/app-store/listing.md, open question 8). +@Suite("Preview interface name") +struct PreviewInterfaceTests { + @Test func keepsTheSilentNameWhenNoneIsAsked() { + #expect(PreviewInterface.name(asked: nil) == "Preview interface (silent)") + } + + @Test func usesTheNameAskedFor() { + #expect(PreviewInterface.name(asked: "X18/XR18") == "X18/XR18") + } + + @Test func aBlankNameKeepsTheSilentOne() { + #expect(PreviewInterface.name(asked: " ") == "Preview interface (silent)") + } +}