audio/wav, audio/vorbis: Add comments about errors (#331)

This commit is contained in:
Hajime Hoshi 2017-04-18 01:25:23 +09:00
parent 1497d52928
commit 4d3ad434b3
2 changed files with 4 additions and 0 deletions

View File

@ -174,6 +174,8 @@ func decode(in audio.ReadSeekCloser) (*decoded, int, int, error) {
// Decode decodes Ogg/Vorbis data to playable stream. // Decode decodes Ogg/Vorbis data to playable stream.
// //
// Decode returns error when the source format is wrong.
//
// Sample rate is automatically adjusted to fit with the audio context. // Sample rate is automatically adjusted to fit with the audio context.
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) { func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
decoded, channelNum, sampleRate, err := decode(src) decoded, channelNum, sampleRate, err := decode(src)

View File

@ -113,6 +113,8 @@ func (s *stream) Size() int64 {
// The format must be 1 or 2 channels, 8bit or 16bit little endian PCM. // The format must be 1 or 2 channels, 8bit or 16bit little endian PCM.
// The format is converted into 2 channels and 16bit. // The format is converted into 2 channels and 16bit.
// //
// Decode returns error when the source format is wrong.
//
// Sample rate is automatically adjusted to fit with the audio context. // Sample rate is automatically adjusted to fit with the audio context.
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) { func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
buf := make([]byte, 12) buf := make([]byte, 12)