mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
audio/vorbis: Accept ReadSeekCloser instead of Reader
This commit is contained in:
parent
e0a058bcc3
commit
4dba239cb5
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user