func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
	d, err := mp3.NewDecoder(src)
	if err != nil {
		return nil, err
	}

	var r *convert.Resampling
	if d.SampleRate() != context.SampleRate() {
		r = convert.NewResampling(d, d.Length(), d.SampleRate(), context.SampleRate())
	}
	s := &Stream{
		orig:       d,
		resampling: r,
		toClose:    src,
	}
	runtime.SetFinalizer(s, (*Stream).Close)
	return s, nil
}
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
	d, err := mp3.NewDecoder(src)
	if err != nil {
		return nil, err
	}

	var r *convert.Resampling
	if d.SampleRate() != context.SampleRate() {
		r = convert.NewResampling(d, d.Length(), d.SampleRate(), context.SampleRate())
	}
	s := &Stream{
		orig:       d,
		resampling: r,
		toClose:    src,
	}
	runtime.SetFinalizer(s, (*Stream).Close)
	return s, nil
}
func Decode ( context * audio . Context , src audio . ReadSeekCloser ) ( * Stream , error ) { d , err := mp3 . NewDecoder ( src ) if err != nil { return nil , err } var r * convert . Resampling if d . SampleRate ( ) != context . SampleRate ( ) { r = convert . NewResampling ( d , d . Length ( ) , d . SampleRate ( ) , context . SampleRate ( ) ) } s := & Stream { orig : d , resampling : r , toClose : src , } runtime . SetFinalizer ( s , ( * Stream ) . Close ) return s , nil }
// Decode decodes MP3 source and returns a decoded 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.
Decode decodes MP3 source and returns a decoded 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 .