func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
	decoded, channelNum, sampleRate, err := decode(src)
	if err != nil {
		return nil, err
	}
	if channelNum != 1 && channelNum != 2 {
		return nil, fmt.Errorf("vorbis: number of channels must be 1 or 2 but was %d", channelNum)
	}
	var s audio.ReadSeekCloser = decoded
	size := decoded.Length()
	if channelNum == 1 {
		s = convert.NewStereo16(s, true, false)
		size *= 2
	}
	if sampleRate != context.SampleRate() {
		r := convert.NewResampling(s, size, sampleRate, context.SampleRate())
		s = r
		size = r.Length()
	}
	stream := &Stream{decoded: s, size: size}
	runtime.SetFinalizer(stream, (*Stream).Close)
	return stream, nil
}
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
	decoded, channelNum, sampleRate, err := decode(src)
	if err != nil {
		return nil, err
	}
	if channelNum != 1 && channelNum != 2 {
		return nil, fmt.Errorf("vorbis: number of channels must be 1 or 2 but was %d", channelNum)
	}
	var s audio.ReadSeekCloser = decoded
	size := decoded.Length()
	if channelNum == 1 {
		s = convert.NewStereo16(s, true, false)
		size *= 2
	}
	if sampleRate != context.SampleRate() {
		r := convert.NewResampling(s, size, sampleRate, context.SampleRate())
		s = r
		size = r.Length()
	}
	stream := &Stream{decoded: s, size: size}
	runtime.SetFinalizer(stream, (*Stream).Close)
	return stream, nil
}
// Decode decodes Ogg/Vorbis data to playable stream.
//
// Decode returns error when decoding fails or IO error happens.
//
// Decode automatically resamples the stream to fit with the audio context if necessary.
//
// Decode takes the ownership of src, and Stream's Close function closes src.