Fix macOS mic TX: platform-aware sample rate negotiation#642
Merged
Conversation
Three issues fixed: 1. VITA-49 Opus TX packets were zero-padded to 32-bit word alignment. FlexLib Opus packets are byte-centric — the 1-3 trailing zero bytes corrupted the radio's Opus decoder, causing distorted transmitted audio on all PC mic configurations. 2. Mono-only USB mic devices (e.g. Plantronics BT600) were rejected because format negotiation only tried stereo. Extended fallback: 24k stereo → 48k stereo → 44.1k stereo → mono at 48k/44.1k/24k. 3. 48kHz→24kHz TX downsampling used naive 2:1 decimation (drop every other sample) with no anti-aliasing filter, causing aliasing. Replaced with r8brain polyphase resampler (already used for RX). Co-Authored-By: JJ Boyd ~ boydsoftprez ~ KG4VCF <kg4vcf@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two MSVC-specific APIs missing from MinGW headers:
1. TCP_INFO_v0 and SIO_TCP_INFO (Windows 10 1703+ kernel RTT) are
defined in MSVC's mstcpip.h but not MinGW's. Added manual
struct/macro definitions guarded by #ifndef SIO_TCP_INFO.
2. _dupenv_s is MSVC-specific secure CRT. Replaced with standard
std::getenv("APPDATA") for Thetis FFTW wisdom import path.
Co-Authored-By: JJ Boyd ~ boydsoftprez ~ KG4VCF <kg4vcf@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ethersdr#625) The TunerApplet power and SWR gauges always showed 0 because meter data comes from the TGXL's direct TCP connection (port 9010), not the radio's VITA-49 meter stream. Three issues fixed: 1. TgxlConnection discarded all R responses (status poll replies) which contain fwd= and swr= fields. Now parses R response bodies as KV pairs and emits statusUpdated(). 2. TunerModel had no fwd/swr fields. Now parses fwd (dBm→watts) and swr (return loss dB→ratio) from both stateUpdated and statusUpdated signals, emitting metersChanged() for the gauge. 3. Removed txMetersChanged→TunerApplet connection that was overwriting TGXL readings with exciter power values. TGXL protocol: fwd is reported in dBm (watts = 10^(dBm/10)/1000), swr is reported as negative return loss in dB (rho = 10^(rl/20), SWR = (1+rho)/(1-rho)). Fixes aethersdr#625 Co-Authored-By: JJ Boyd ~ boydsoftprez ~ KG4VCF <kg4vcf@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… ordering macOS Core Audio claims to support 24kHz mic input via isFormatSupported() but its internal resampler produces gravelly/distorted audio at that non-standard rate. The previous code also had a macOS-only path that only tried 48kHz and 24kHz stereo, failing entirely on the Mac built-in mic (mono-only device). Replace the platform-split negotiation with a unified loop that tries stereo then mono across three rates. macOS prefers 48kHz first (letting r8brain handle the clean 2:1 downsample to 24kHz), while Linux/Windows prefer 24kHz first (avoiding resampling when possible). Verified on-air: clean TX audio in both Opus and uncompressed modes using Mac built-in mic (mono 48kHz capture → r8brain → 24kHz stereo). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
Claude here. Great follow-up to the Opus padding fix — unified sample rate negotiation across platforms is the right call. The macOS 24kHz Core Audio quirk is a nasty gotcha. 73, Jeremy KK7GWY & Claude (AI dev partner) |
auto-merge was automatically disabled
April 4, 2026 03:46
Pull request was closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
🤖 Generated with Claude Code