ebiten: github.com/hajimehoshi/ebiten/audio/wav Index | Files

package wav

import "github.com/hajimehoshi/ebiten/audio/wav"

Package wav provides WAV (RIFF) decoder.


Package Files


type Stream Uses

type Stream struct {
    // contains filtered or unexported fields

Stream is a decoded audio stream.

func Decode Uses

func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error)

Decode decodes WAV (RIFF) data to playable stream.

The format must be 1 or 2 channels, 8bit or 16bit little endian PCM. The format is converted into 2 channels and 16bit.

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 (*Stream) Close Uses

func (s *Stream) Close() error

Read is implementation of io.Closer's Close.

func (*Stream) Length Uses

func (s *Stream) Length() int64

Length returns the size of decoded stream in bytes.

func (*Stream) Read Uses

func (s *Stream) Read(p []byte) (int, error)

Read is implementation of io.Reader's Read.

func (*Stream) Seek Uses

func (s *Stream) Seek(offset int64, whence int) (int64, error)

Seek is implementation of io.Seeker's Seek.

Note that Seek can take long since decoding is a relatively heavy task.

func (*Stream) Size Uses

func (s *Stream) Size() int64

Size is deprecated as of version 1.6.0-alpha. Use Length instead.

Package wav imports 6 packages (graph) and is imported by 10 packages. Updated 2019-04-05. Refresh now. Tools for package owners.