audio

package
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package audio provides cross-platform audio playback using malgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlayFile

func PlayFile(path string) error

PlayFile plays an audio file from a file path asynchronously. Supports WAV, MP3, OGG (Vorbis), and FLAC formats. The function returns immediately after starting playback. Format is detected by file extension. If another sound is already playing, it will be cancelled and replaced by this sound.

func PlayWAV

func PlayWAV(r io.ReadCloser) error

PlayWAV plays a WAV audio stream from an io.ReadCloser asynchronously. The function returns immediately after starting playback. The reader will be closed after playback completes. The audio device is created, used, and released for each playback. If another sound is already playing, it will be cancelled and replaced by this sound.

func PlayWAVBytes

func PlayWAVBytes(data []byte) error

PlayWAVBytes plays a WAV audio file from a byte slice asynchronously. The function returns immediately after starting playback.

func PlayWAVFile

func PlayWAVFile(path string) error

PlayWAVFile plays a WAV audio file from a file path asynchronously. The function returns immediately after starting playback.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL