audio

package
v0.0.0-...-d216d2d Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup()

func Init

func Init()

func SetListenPosition

func SetListenPosition(x, y, z float32)

Types

type PlayInstance

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

PlayInstance is returned when you make a call to play a sound so you can stop playback or determine if the sound is still playing

func (*PlayInstance) IsPlaying

func (playback *PlayInstance) IsPlaying() bool

func (*PlayInstance) StopPlayback

func (playback *PlayInstance) StopPlayback()

type Sound

type Sound struct {
	Channels      uint16
	Frequency     uint32
	BitsPerSample uint16
	Size          uint32
	Data          []byte
	// contains filtered or unexported fields
}

func LoadWav

func LoadWav(file string) *Sound

func NewSound

func NewSound(file string) *Sound

NewSound returns a newly created Sound object.

Only used if you are going to load your own data instead of using the wav loader

s := NewSound("example.mp3")

/* Code that gets the Data, BufferSize, Frequency and Channels of mp3s */

//The we load that data in manually with:
s.LoadPCMData()

func (*Sound) Destroy

func (s *Sound) Destroy()

func (*Sound) LoadPCMData

func (s *Sound) LoadPCMData()

func (*Sound) Play

func (s *Sound) Play(volume float32) (request PlayInstance)

Play will play the sound. Volume ( 1.0 is normal volume, 0 is silence ) Returns the PlayInstance that can be used to stop the source while playing

func (*Sound) Play3D

func (s *Sound) Play3D(x, y, z, falloff, volume float32) (request PlayInstance)

Play will play the sound at a given position, the falloff distance in which the sound's volume is cut in half, and the volume ( 1.0 is normal volume, 0 is silence ) It will return the PlayInstance that can be used to stop the source while playing Remember that in order for the 3D audio to work properly that the audio needs to be all in one channel, not stereo!

Jump to

Keyboard shortcuts

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