mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
audio/vorbis: Accept ReadSeekCloser instead of Reader
This commit is contained in:
parent
e0a058bcc3
commit
4dba239cb5
@ -20,7 +20,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/exp/audio"
|
"github.com/hajimehoshi/ebiten/exp/audio"
|
||||||
@ -29,7 +28,7 @@ import (
|
|||||||
|
|
||||||
// TODO: src should be ReadCloser?
|
// 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)
|
decoded, channels, sampleRate, err := vorbis.Decode(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -18,7 +18,6 @@ package vorbis
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ import (
|
|||||||
// TODO: This just uses decodeAudioData can treat audio files other than Ogg/Vorbis.
|
// 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.
|
// 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)
|
b, err := ioutil.ReadAll(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user