mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
68d24f1c62
commit
e62eba387d
@ -116,7 +116,7 @@ func (d *decoded) Length() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decode accepts an ogg stream and returns a decorded stream.
|
// decode accepts an ogg stream and returns a decorded stream.
|
||||||
func decode(in io.ReadSeeker) (*decoded, int, int, error) {
|
func decode(in io.Reader) (*decoded, int, int, error) {
|
||||||
r, err := oggvorbis.NewReader(in)
|
r, err := oggvorbis.NewReader(in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
@ -143,9 +143,11 @@ func decode(in io.ReadSeeker) (*decoded, int, int, error) {
|
|||||||
//
|
//
|
||||||
// DecodeWithSampleRate automatically resamples the stream to fit with sampleRate if necessary.
|
// DecodeWithSampleRate automatically resamples the stream to fit with sampleRate if necessary.
|
||||||
//
|
//
|
||||||
|
// The returned Stream's Seek is available only when src is an io.Seeker.
|
||||||
|
//
|
||||||
// A Stream doesn't close src even if src implements io.Closer.
|
// A Stream doesn't close src even if src implements io.Closer.
|
||||||
// Closing the source is src owner's responsibility.
|
// Closing the source is src owner's responsibility.
|
||||||
func DecodeWithSampleRate(sampleRate int, src io.ReadSeeker) (*Stream, error) {
|
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
|
||||||
decoded, channelNum, origSampleRate, err := decode(src)
|
decoded, channelNum, origSampleRate, err := decode(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -174,10 +176,12 @@ func DecodeWithSampleRate(sampleRate int, src io.ReadSeeker) (*Stream, error) {
|
|||||||
//
|
//
|
||||||
// Decode automatically resamples the stream to fit with the audio context if necessary.
|
// Decode automatically resamples the stream to fit with the audio context if necessary.
|
||||||
//
|
//
|
||||||
|
// The returned Stream's Seek is available only when src is an io.Seeker.
|
||||||
|
//
|
||||||
// A Stream doesn't close src even if src implements io.Closer.
|
// A Stream doesn't close src even if src implements io.Closer.
|
||||||
// Closing the source is src owner's responsibility.
|
// Closing the source is src owner's responsibility.
|
||||||
//
|
//
|
||||||
// Deprecated: as of v2.1. Use DecodeWithSampleRate instead.
|
// Deprecated: as of v2.1. Use DecodeWithSampleRate instead.
|
||||||
func Decode(context *audio.Context, src io.ReadSeeker) (*Stream, error) {
|
func Decode(context *audio.Context, src io.Reader) (*Stream, error) {
|
||||||
return DecodeWithSampleRate(context.SampleRate(), src)
|
return DecodeWithSampleRate(context.SampleRate(), src)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user