Documentation
¶
Overview ¶
Package coreaudio plays PCM through the macOS default output device.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Playback ¶
type Playback struct {
// contains filtered or unexported fields
}
Playback is a buffered sink for planar float32 PCM. CoreAudio converts the queue's input format to the format of the selected system output device.
func OpenPlayback ¶
func OpenPlayback(ctx context.Context, format audio.Format, options PlaybackOptions) (*Playback, error)
OpenPlayback prepares a mono or stereo float32 queue for the macOS default output device. Playback starts with the first nonempty write. Canceling ctx aborts playback and releases the native queue. A nil context returns audio.ErrNilContext.
func (*Playback) Close ¶
Close aborts playback and releases its native resources. It is safe to call Close concurrently with a blocked write or drain.
func (*Playback) Drain ¶
Drain waits until AudioQueue plays all accepted frames and stops. Writes can resume afterward. Canceling the playback context interrupts this wait.
func (*Playback) PreferredBlockFrames ¶
PreferredBlockFrames reports the capacity of one native queue buffer.
type PlaybackOptions ¶
PlaybackOptions controls buffering. Zero fields select 512 frames per block and four native buffers.
type StatusError ¶
StatusError reports an error returned by AudioQueue Services.
func (*StatusError) Error ¶
func (e *StatusError) Error() string