extra

package
v0.0.0-...-5f7c387 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

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

The Audio type represents the audio controller. It should be used as a singleton, as multiple streams in PortAudio may not be supported on some hardware.

func InitAudio

func InitAudio() (*Audio, error)

InitAudio starts up PortAudio, creates a stream and returns a pointer to an Audio struct, or an error.

func (*Audio) LoadTrack

func (a *Audio) LoadTrack(filename string, loop bool) (*Track, error)

LoadTrack reads an audio track from a file, and returns a pointer to a Track struct, or an error. The boolean parameter 'loop' determines whether or not a Track should loop when it is finished playing.

Supported filetypes are whatever libsndfile supports, e.g. WAV or OGG.

func (*Audio) Stop

func (a *Audio) Stop()

Stop shuts down PortAudio

type Track

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

The Track type represents an audio track which can be played.

func (*Track) Looping

func (t *Track) Looping() bool

Looping returns whether or not the Track is set to loop.

func (*Track) Pause

func (t *Track) Pause()

Pause stops a Track playing, but does not reset its position. The track can be resumed by calling Play().

func (*Track) Play

func (t *Track) Play()

Play triggers a Track to start playing.

func (*Track) Restart

func (t *Track) Restart()

Restart resets the Track to the beginning but does not stop playback.

func (*Track) SetLooping

func (t *Track) SetLooping(looping bool)

SetLooping sets whether or not a Track should loop.

func (*Track) SetVolume

func (t *Track) SetVolume(v float32)

SetVolume sets the Track's volume to v.

func (*Track) Stop

func (t *Track) Stop()

Stop stops a Track playing, and resets it to the beginning.

func (*Track) Volume

func (t *Track) Volume() float32

Volume returns the current volume of the Track. Default is 1.0.

Jump to

Keyboard shortcuts

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