From 4dba239cb51cc57c9304262e76a19c1125547810 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 30 Mar 2016 03:15:31 +0900 Subject: [PATCH] audio/vorbis: Accept ReadSeekCloser instead of Reader --- exp/audio/vorbis/vorbis.go | 3 +-- exp/audio/vorbis/vorbis_js.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/exp/audio/vorbis/vorbis.go b/exp/audio/vorbis/vorbis.go index 152744f14..38f8aeb85 100644 --- a/exp/audio/vorbis/vorbis.go +++ b/exp/audio/vorbis/vorbis.go @@ -20,7 +20,6 @@ import ( "bytes" "errors" "fmt" - "io" "io/ioutil" "github.com/hajimehoshi/ebiten/exp/audio" @@ -29,7 +28,7 @@ import ( // TODO: src should be ReadCloser? -func Decode(context *audio.Context, src io.Reader) (*Stream, error) { +func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) { decoded, channels, sampleRate, err := vorbis.Decode(src) if err != nil { return nil, err diff --git a/exp/audio/vorbis/vorbis_js.go b/exp/audio/vorbis/vorbis_js.go index 8e643dabe..e4e774ace 100644 --- a/exp/audio/vorbis/vorbis_js.go +++ b/exp/audio/vorbis/vorbis_js.go @@ -18,7 +18,6 @@ package vorbis import ( "bytes" - "io" "io/ioutil" "runtime" @@ -29,7 +28,7 @@ import ( // TODO: This just uses decodeAudioData can treat audio files other than Ogg/Vorbis. // TODO: This doesn't work on iOS which doesn't have Ogg/Vorbis decoder. -func Decode(context *audio.Context, src io.Reader) (*Stream, error) { +func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) { b, err := ioutil.ReadAll(src) if err != nil { return nil, err