audio

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRate = Rate44100Hz

DefaultRate is the rate that all the audio will pe played on. If you need to change it, do it before loading any audio from Primen, as the audio context cannot be changed once it is created.

Functions

func Context

func Context() *audio.Context

Context returns an audio context with the DefaultRate

Types

type SampleRate

type SampleRate int

SampleRate is the rate (in Hz) at which all the audio will be played. Ebiten recommends a sample rate of 44100Hz or 48000Hz. 22050Hz is reported to have playback issues on Safari.

const (
	Rate44100Hz SampleRate = 44100
	Rate48000Hz SampleRate = 48000
	Rate22050Hz SampleRate = 22050
)

type StereoPanStream

type StereoPanStream struct {
	audio.ReadSeekCloser
	// contains filtered or unexported fields
}

StereoPanStream is an audio buffer that changes the stereo channel's signal based on the Panning.

func NewStereoPanStream

func NewStereoPanStream(src []byte) *StereoPanStream

NewStereoPanStream returns a new StereoPanStream with a shared buffer src. The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.

The src can be shared by multiple buffers.

func NewStereoPanStreamFromReader

func NewStereoPanStreamFromReader(src audio.ReadSeekCloser) *StereoPanStream

NewStereoPanStreamFromReader returns a new StereoPanStream with buffer src.

The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.

func (*StereoPanStream) Pan

func (s *StereoPanStream) Pan() float64

func (*StereoPanStream) Read

func (s *StereoPanStream) Read(p []byte) (n int, err error)

func (*StereoPanStream) SetPan

func (s *StereoPanStream) SetPan(pan float64)

type Wrapper

type Wrapper struct {
	*bytes.Reader
}

func NewWrapper

func NewWrapper(src []byte) *Wrapper

func (*Wrapper) Close

func (w *Wrapper) Close() error

Jump to

Keyboard shortcuts

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