mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio: Comment about ownership
This behavior might be changed at version 2 though (#837).
This commit is contained in:
parent
200c3b80a9
commit
df2604c221
@ -77,6 +77,8 @@ func (s *Stream) Size() int64 {
|
||||
// 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.
|
||||
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
||||
d, err := mp3.NewDecoder(src)
|
||||
if err != nil {
|
||||
|
@ -169,6 +169,8 @@ func decode(in audio.ReadSeekCloser) (*decoded, int, int, error) {
|
||||
// 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.
|
||||
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
||||
decoded, channelNum, sampleRate, err := decode(src)
|
||||
if err != nil {
|
||||
|
@ -124,6 +124,8 @@ func (s *stream) Length() int64 {
|
||||
// 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.
|
||||
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
|
||||
buf := make([]byte, 12)
|
||||
n, err := io.ReadFull(src, buf)
|
||||
|
Loading…
Reference in New Issue
Block a user