Documentation
¶
Overview ¶
Package audio defines bounded, transport-free audio device observation and caller-selected capture or playback. It opens no device, process, or connection itself: a backend such as the PulseAudio or ALSA adapter implements the interfaces, and the consumer selects the device and grants access.
Index ¶
Constants ¶
const ( // DefaultMaxDevices bounds one observation. DefaultMaxDevices = 64 // MaxDevices is the library ceiling for MaxDevices. MaxDevices = 1024 // DefaultMaxPacketBytes bounds one read or written PCM packet. DefaultMaxPacketBytes = 192_000 // MaxPacketBytes is the library ceiling for MaxPacketBytes. MaxPacketBytes = 1 << 20 )
Variables ¶
Functions ¶
func ValidatePacket ¶
ValidatePacket checks PCM format, alignment, and the caller's packet ceiling.
func ValidateSnapshot ¶
ValidateSnapshot checks identity, kind, format, and device bounds.
Types ¶
type CaptureBackend ¶
CaptureBackend opens a bounded source for one caller-selected device.
type Device ¶
type Device struct {
ID string `json:"id"`
Name string `json:"name"`
Kind Kind `json:"kind"`
State string `json:"state,omitempty"`
SampleFormat string `json:"sample_format,omitempty"`
SampleRate int `json:"sample_rate,omitempty"`
Channels int `json:"channels,omitempty"`
}
Device is one observed endpoint. ID is backend-local and opaque to the library; Name is display metadata. Sample values are zero when the backend does not know them.
type Kind ¶
type Kind string
Kind classifies a device without exposing a native endpoint or routing rule.
type Limits ¶
type Limits struct {
MaxDevices int `json:"max_devices"`
MaxPacketBytes int `json:"max_packet_bytes"`
}
Limits bound an observation and one PCM packet. Zero values select defaults.
type Observer ¶
Observer reports caller-visible local audio devices. It sends no audio and starts no stream.
type ObserverFunc ¶
type PlaybackBackend ¶
PlaybackBackend opens a bounded sink for one caller-selected device.
type Snapshot ¶
type Snapshot struct {
Backend string `json:"backend"`
ObservedAt time.Time `json:"observed_at"`
Devices []Device `json:"devices"`
Status Status `json:"status"`
}
Snapshot is one bounded observation. Backend names the selected native mechanism for diagnostics; the library never chooses it.