Documentation ¶
Index ¶
Constants ¶
View Source
const IdSep = "\n"
Variables ¶
View Source
var ErrFormat = errors.New("codec: unknown format")
ErrFormat indicates that decoding encountered an unknown format.
Functions ¶
func RegisterCodec ¶
func RegisterCodec(name string, magic, extensions []string, decode func(Reader) (Songs, error), get func(Reader, ID) (Song, error))
RegisterCodec registers an audio codec for use by Decode. Name is the name of the format, like "nsf" or "wav". Magic is the magic prefix that identifies the codec's encoding. The magic string can contain "?" wildcards that each match any one byte. Decode is the function that decodes the encoded codec.
Types ¶
type Reader ¶
type Reader func() (io.ReadCloser, int64, error)
Reader returns a file reader and the file size in bytes (or 0 if streamed or unknown).
type Song ¶
type Song interface { // Info returns information about a song. Info() (SongInfo, error) // Init is called before the first call to Play(). It should prepare resources // needed for Play(). Init() (sampleRate, channels int, err error) // Play returns the next n samples. Return < n to indicate end of song or 0 // to indicate EOF, neither of which should return an error. If < n samples // are returned, Play will not be invoked again. Play(n int) ([]float32, error) // Close releases resources used by the current file. Close() }
Click to show internal directories.
Click to hide internal directories.