audios

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SampleRate = 44100

Variables

Functions

This section is empty.

Types

type MusicPlayer added in v0.3.1

type MusicPlayer struct {
	*audio.Player
	Closer func() error
}

func NewMusicPlayer added in v0.3.1

func NewMusicPlayer(fsys fs.FS, name string) (MusicPlayer, error)

func (MusicPlayer) Close added in v0.3.1

func (p MusicPlayer) Close()

type Sound added in v0.3.1

type Sound []byte

func NewSound added in v0.3.1

func NewSound(fsys fs.FS, name string) Sound

NewSound is for effect sounds, which is short. Long audio file will make the game stutter. No closers are related since no any files are open.

func (Sound) IsValid added in v0.3.1

func (s Sound) IsValid() bool

func (Sound) Play added in v0.3.1

func (s Sound) Play(vol float64)

type SoundBag added in v0.3.1

type SoundBag []Sound

SoundBag is for playing one of effects in the slice. Useful for playing slightly different effect when doing same actions.

func NewSoundBag added in v0.3.1

func NewSoundBag(fsys fs.FS, name string) SoundBag

Todo: remove redundancy with NewImages()?

func (SoundBag) Play added in v0.3.1

func (sb SoundBag) Play(vol float64)

type SoundPlayer added in v0.3.1

type SoundPlayer struct {
	Sounds map[string]Sound
	Volume *float64
}

A player for sample sound is generated at a place.

func NewSoundPlayer added in v0.3.1

func NewSoundPlayer(fsys fs.FS, vol *float64) (s SoundPlayer)

Todo: need a test

func (SoundPlayer) Play added in v0.3.1

func (s SoundPlayer) Play(name string, vol2 float64)

type Sounder added in v0.3.1

type Sounder interface {
	Play(vol float64)
}

Jump to

Keyboard shortcuts

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