audio

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeepManager

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

BeepManager manages audio state and functionality using the beep library.

func (*BeepManager) GetVolume

func (m *BeepManager) GetVolume() float64

GetVolume fetches the Manager's scaled volume, from 0 to 100.

func (*BeepManager) Play

func (m *BeepManager) Play()

Play triggers audio to be played through the computer's default speaker. NOTE: this function is not tested, as adding testing would be more hassle than it's worth for a homework project.

func (*BeepManager) SetVolume

func (m *BeepManager) SetVolume(volume float64) (float64, error)

SetVolume sets the Manager's volume. Accepts values between 0 and 100.

type Manager

type Manager interface {
	GetVolume() float64
	SetVolume(float64) (float64, error)
	Play()
}

Manager allows for mocking, which allows for easier testing of other packages.

func New

func New(wavFilename string) (Manager, error)

New creates a new audio Manager from the given wav filename. Returns an error if the file cannot be found or is not decodeable in the wav format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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