feat: WASAPI driver — Pure Go audio output (ADR-001, v0.1.0) - #1
Merged
Conversation
Working Windows audio output through WASAPI shared mode. Zero CGO. Architecture: - internal/wasapi/ — COM vtable structs, driver implementation - wasapiWrapper in audio/ adapts internal driver to public interface - Pull model: background goroutine reads from Mixer via ReadFloat32er - Event-driven: WaitForSingleObject on WASAPI buffer events WASAPI flow: CoInitializeEx → MMDeviceEnumerator → GetDefaultAudioEndpoint → IAudioClient.Initialize(SHARED, AUTOCONVERTPCM) → IAudioRenderClient → audio loop (GetBuffer → fill from Mixer → ReleaseBuffer) Fixes: - AUDCLNT_E_UNSUPPORTED_FORMAT (0x88890008): added AUTOCONVERTPCM + SRC_DEFAULT_QUALITY flags — WASAPI handles format conversion - Tests use NullDriver explicitly (no real audio device in CI) - Driver interface refined: pull model with ReadFloat32er Verified: 440Hz sine wave plays through speakers on Windows. 42 tests pass, lint 0 issues (Windows/Linux/macOS).
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
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
First working release of gogpu/audio — Pure Go audio engine with WASAPI driver.
WASAPI Driver (Windows)
syscall.SyscallN(same pattern as wgpu DX12 backend)ReadFloat32erinternal/wasapi/hides COM implementation from public APICore
Verified
Test plan
go build ./...go test ./...— 42 passgolangci-lint run— 0 issues (3 platforms)