Skip to content

fix: initialize macOS audio output safely - #385

Merged
devgianlu merged 3 commits into
devgianlu:masterfrom
SubController-LLC:fix/macos-audio-output
Sep 14, 2026
Merged

devgianlu merged 3 commits into
devgianlu:masterfrom
SubController-LLC:fix/macos-audio-output

Conversation

@saito828koki

@saito828koki saito828koki commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

On macOS, the daemon defaults to ALSA. Selecting AudioToolbox instead exposes a retained Go pointer in C memory (fatal under cgocheck2), and the queue ignores InitialVolume at startup.

This change defaults to AudioToolbox on macOS, uses runtime/cgo.Handle with cleanup after queue disposal, applies the initial volume before playback, and fixes initialization errors and blocking callback error delivery.

Validated on macOS 26.6.2 / arm64 with Go 1.25.5 and 1.27.1:

  • Full unit/integration suite (19 packages) and daemon build pass.
  • Real-device tests pass at 44.1/48 kHz with -race and cgocheck2, covering initial mute, volume changes, GC, pause/resume, and repeated Close.
  • The new config and device regression tests fail on the upstream base and pass with this change.

Tests and reproduction instructions are included. Hardware tests are opt-in and use generated silence.

Spotify track playback on the tested account still fails with failed retrieving aes key with code 1; this PR addresses native audio output, and does not resolve that separate issue. Fork CI passes Linux/macOS/Windows tests and Windows cross-compilation; upstream CI awaits approval.

@devgianlu
devgianlu merged commit 940ba49 into devgianlu:master Sep 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants