From 9078740e7ad00027ae4936ad09c429253858b0e9 Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Sat, 10 Oct 2026 23:46:45 -0400 Subject: [PATCH] No USB Channel warning for a 1- or 2-channel input with the Mixer linked over Wi-Fi From TestFlight feedback: recording the iPhone's microphone with the XR18 linked for names is on purpose. Assisted-by: Claude Code:claude-opus-5-5 Claude-Session: https://claude.ai/code/session_01S6amVoNeB4GahnMMe79dZ6 --- .../Sources/Recording/USBChannelShortfall.swift | 10 +++++++--- .../RecordingTests/USBChannelShortfallTests.swift | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Packages/ShowRecorderKit/Sources/Recording/USBChannelShortfall.swift b/Packages/ShowRecorderKit/Sources/Recording/USBChannelShortfall.swift index 6b32672c..9609414b 100644 --- a/Packages/ShowRecorderKit/Sources/Recording/USBChannelShortfall.swift +++ b/Packages/ShowRecorderKit/Sources/Recording/USBChannelShortfall.swift @@ -35,12 +35,17 @@ public struct USBChannelShortfall: Equatable, Sendable { if let offered = offeredChannelCount, offered > usbChannelCount { return USBChannelShortfall(usbChannelCount: usbChannelCount, reason: .systemGrantedFewer(offered: offered)) } - if let mixer, let mixerSends = capabilities?.usbChannelCount, mixerSends > usbChannelCount { + // A 1- or 2-channel input (the device's microphone, a stereo interface) isn't the Mixer's USB: recording it + // with the Mixer linked over Wi-Fi for names is on purpose, so no warning. + if usbChannelCount > Self.notTheMixerUpTo, let mixer, let mixerSends = capabilities?.usbChannelCount, mixerSends > usbChannelCount { return USBChannelShortfall(usbChannelCount: usbChannelCount, reason: .mixerSendsMore(mixer: mixer, mixerSends: mixerSends)) } return nil } + /// Inputs with this many channels or fewer are never taken for the Mixer's USB. + static let notTheMixerUpTo = 2 + /// The banner text. It names a Mixer only when one was identified. public var message: String { let sent = usbChannelCount == 1 ? "1 USB Channel" : "\(usbChannelCount) USB Channels" @@ -49,8 +54,7 @@ public struct USBChannelShortfall: Equatable, Sendable { return "This input offers \(offered) channels, but the system is sending the recorder \(sent), so some channels won't be recorded." case .mixerSendsMore(let mixer, let mixerSends): // Short enough for the banner's 2 lines on an iPhone (#292); the Mixer chip already names the Mixer. - let verb = usbChannelCount == 1 ? "is" : "are" - return "Only \(usbChannelCount) of the \(mixer.model)'s \(mixerSends) USB Channels \(verb) coming in. Arm the \(mixer.model) to record all \(mixerSends)." + return "Only \(usbChannelCount) of the \(mixer.model)'s \(mixerSends) USB Channels are coming in. Arm the \(mixer.model) to record all \(mixerSends)." } } } diff --git a/Packages/ShowRecorderKit/Tests/RecordingTests/USBChannelShortfallTests.swift b/Packages/ShowRecorderKit/Tests/RecordingTests/USBChannelShortfallTests.swift index 14d89c90..10041e13 100644 --- a/Packages/ShowRecorderKit/Tests/RecordingTests/USBChannelShortfallTests.swift +++ b/Packages/ShowRecorderKit/Tests/RecordingTests/USBChannelShortfallTests.swift @@ -14,16 +14,20 @@ struct USBChannelShortfallTests { #expect(USBChannelShortfall.check(usbChannelCount: count, offeredChannelCount: nil, mixer: nil, capabilities: nil) == nil) } - @Test("A device sending fewer USB Channels than the identified Mixer sends is a shortfall that names the Mixer, short enough for 2 lines on an iPhone (#292)", arguments: [1, 8, 16]) + @Test("A device sending fewer USB Channels than the identified Mixer sends is a shortfall that names the Mixer, short enough for 2 lines on an iPhone (#292)", arguments: [3, 8, 16]) func fewerThanIdentifiedMixer(count: Int) throws { let shortfall = try #require(USBChannelShortfall.check( usbChannelCount: count, offeredChannelCount: nil, mixer: xr18, capabilities: xr18Capabilities)) - let verb = count == 1 ? "is" : "are" - #expect(shortfall.message == "Only \(count) of the XR18's 18 USB Channels \(verb) coming in. Arm the XR18 to record all 18.") + #expect(shortfall.message == "Only \(count) of the XR18's 18 USB Channels are coming in. Arm the XR18 to record all 18.") #expect(shortfall.message.count <= 90) } + @Test("A 1- or 2-channel input (the iPhone's microphone, a stereo interface) with the Mixer linked over Wi-Fi is on purpose: no warning", arguments: [1, 2]) + func micWithLinkedMixer(count: Int) { + #expect(USBChannelShortfall.check(usbChannelCount: count, offeredChannelCount: nil, mixer: xr18, capabilities: xr18Capabilities) == nil) + } + @Test("A device sending at least what the identified Mixer sends is fine", arguments: [18, 32]) func enoughForIdentifiedMixer(count: Int) { #expect(USBChannelShortfall.check(usbChannelCount: count, offeredChannelCount: nil, mixer: xr18, capabilities: xr18Capabilities) == nil)