vorbis

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package vorbis provides Ogg/Vorbis decoder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream is a decoded audio stream.

func Decode deprecated

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

Decode decodes Ogg/Vorbis data to playable stream.

Decode returns error when decoding fails or IO error happens.

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. Closing the source is src owner's responsibility.

Deprecated: as of v2.1. Use DecodeWithSampleRate instead.

func DecodeWithSampleRate

func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error)

DecodeWithSampleRate decodes Ogg/Vorbis data to playable stream.

DecodeWithSampleRate returns error when decoding fails or IO error happens.

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. Closing the source is src owner's responsibility.

func DecodeWithoutResampling

func DecodeWithoutResampling(src io.Reader) (*Stream, error)

DecodeWithoutResampling decodes Ogg/Vorbis data to playable stream.

DecodeWithoutResampling returns error when decoding fails or IO error happens.

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. Closing the source is src owner's responsibility.

func (*Stream) Length

func (s *Stream) Length() int64

Length returns the size of decoded stream in bytes.

If the source is not io.Seeker, Length returns 0.

func (*Stream) Read

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

Read is implementation of io.Reader's Read.

func (*Stream) Seek

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL