Documentation
¶
Overview ¶
Package audio provides audio processing and playback functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// CreateMedia creates a new Media object based on the specified info.
CreateMedia(info MediaInfo) Media
// Play plays the specified media as soon as possible.
Play(media Media, info PlayInfo) Playback
}
API provides access to a low-level audio manipulation and playback.
type Media ¶ added in v0.15.0
type Media interface {
// Length returns the duration of the media.
Length() time.Duration
// Delete frees any resources used by this media.
Delete()
}
Media represents a playable audio sequence.
type MediaDataType ¶ added in v0.15.0
type MediaDataType int8
MediaDataType indicates the type of media data contained in a data block.
const ( // MediaDataTypeAuto indicates that the media data type should be // automatically detected based on the data. MediaDataTypeAuto MediaDataType = iota // MediaDataTypeWAV indicates that the media data is in WAV format. MediaDataTypeWAV // MediaDataTypeMP3 indicates that the media data is in MP3 format. MediaDataTypeMP3 )
type MediaInfo ¶ added in v0.15.0
type MediaInfo struct {
// Data is the raw media data.
Data []byte
// DataType indicates the type of media data.
DataType MediaDataType
}
MediaInfo contains the necessary information to create a Media.
type PlayInfo ¶ added in v0.15.0
type PlayInfo struct {
// Loop indicates whether the playback should loop.
Loop bool
// Gain indicates the amount of volume, where 1.0 is max and 0.0 is min.
//
// If not specified, the default value is 1.0.
Gain opt.T[float64]
// Pan indicates the sound panning, where -1.0 is left, 0.0 is center, and
// 1.0 is right.
Pan float64
}
PlayInfo specifies conditions for the playback.
Click to show internal directories.
Click to hide internal directories.