nativeaudio

audio playback for Go
Log | Files | Refs | README | LICENSE

commit 6a7c98d26b76c0c93b56884040d8d14392a5c21c
parent e63bbc49b6a3d4b85606a5cc85c187a57ae6f09b
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Thu, 17 Sep 2026 12:09:48 -0400

docs: describe the public API and the v1.0.0 breaking changes

Diffstat:
MREADME.md | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -31,6 +31,21 @@ func main() { } ``` +## API + +- `Play(path)` decodes a file and plays it synchronously. On Windows and + macOS the playback context is fixed to the first file's sample rate and + channel count for the life of the process. +- `Load(path)` and `Decode(data)` return s16le PCM together with a + `Format` giving `SampleRate`, `Channels` and `BytesPerSample` (always 2). +- `Start()` and `End()` initialise and tear down platform state. The + functions above call `Start()` for you; call `End()` when you are done. +- `FFmpegPlay`, `FFmpegLoad` and `FFmpegDecode` shell out to ffmpeg + regardless of platform. + +v1.0.0 renamed `Format.BitDepth` to `BytesPerSample` and removed the +Windows Media Foundation bindings from the public API. + ## TODO - [ ] streaming API (current API is a buffered for simplicity)