aplay

package
v0.0.0-...-7f18e8e Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Unlicense, Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedFormat indicates the input format is not supported.
	ErrUnsupportedFormat = errors.New("audio: Unsupported format")
)

Functions

func IsAvailable

func IsAvailable() bool

IsAvailable reports whether audio available

func ListenerOrient

func ListenerOrient() (toward [3]float32)

ListenerOrient reports the orientation of listener, the toward vector

func ListenerPosition

func ListenerPosition() (p [3]float32)

ListenerPosition reports the position of listener

func ListenerVelocity

func ListenerVelocity() (v [3]float32)

ListenerVelocity reports the velocity of listener

func MasterGain

func MasterGain() float32

MasterGain reports the master gain

func SetListenerOrient

func SetListenerOrient(toward [3]float32)

SetListenerOrient set the orientation of listener, the toward vector

func SetListenerPosition

func SetListenerPosition(p [3]float32)

SetListenerPosition set the position of listener

func SetListenerVelocity

func SetListenerVelocity(v [3]float32)

SetListenerVelocity set the velocity of listener

func SetMasterGain

func SetMasterGain(gain float32)

SetMasterGain set the master gain

func WaitIdle

func WaitIdle()

WaitIdle wait for all players stopped, so we can exit program without make broken noise

Types

type Player

type Player interface {
	SetPosition([3]float32)

	SetVelocity([3]float32)

	SetDirection([3]float32)

	// SetOverlayGain set overlay gain of the source, normalized between 0 to 1
	SetOverlayGain(float32)

	// IsRelative reports whether the player postion is relative to the listener.
	// relative postion is typically use for play BGM
	IsRelative() bool

	// SetRelative set/unset retative position
	SetRelative(b bool)

	// Play the sound, if sound implement io.ReadAt interface (i.e. MemSound), it can be played
	// in difference players at same time. otherwise (i.e. SoundFile) the io.Read interface will be used.
	// if the player is playing another sound, the new sound will put in pending state.
	Play(x wav.Reader, gain float32, loop int) error

	// Terminate current playing sound, apply fade out if not zero. the pending sound also be removed,
	// but call Play immediately after Terminate is legal.
	Terminate()

	// SetFadeOut set the fade out duration for terminate sound, it not apply to normal ending sound.
	// there is not "fade in" feature.
	SetFadeOut(msec uint)

	IsPlaying() bool

	// TODO: what?
	Release()
}

Player is abstract audio player. to use it, place it into a 3D scene, select a song, then press the play button.

func Alloc

func Alloc() (p Player)

Alloc a player, this function never failed.

Jump to

Keyboard shortcuts

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