audio

package
v0.0.0-...-c036310 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Panel

type Panel struct {
	Volume   *effects.Volume
	SoundDir SoundDirectory
	// contains filtered or unexported fields
}

Panel holds all Player structs like mixer, ctrl and Volume

func NewPanel

func NewPanel(speakerSampleRate int, dir SoundDirectory) *Panel

NewPanel returns a pointer to a Panel struct

func (*Panel) ChangeVolume

func (ap *Panel) ChangeVolume(newVolume float64) float64

ChangeVolume changes the Volume of the mixer

func (*Panel) Init

func (ap *Panel) Init(buffSize int) error

Init initializes the speaker and plays the empty mixer

func (*Panel) PlaySound

func (ap *Panel) PlaySound(s SoundFile) error

PlaySound plays a specified SoundFile

func (*Panel) Reload

func (ap *Panel) Reload() error

Reload gets all the SoundFiles in the directory

func (*Panel) Stop

func (ap *Panel) Stop()

Stop stops all playing streams

type SoundDirectory

type SoundDirectory struct {
	SoundFiles []SoundFile `json:"soundfiles"`
	Path       string      `json:"path"`
}

SoundDirectory collects all SoundFiles from a specific path

func GetFilesInFolder

func GetFilesInFolder(folderPath string) (SoundDirectory, error)

GetFilesInFolder returns a new SoundDorectory in a specified path

type SoundFile

type SoundFile struct {
	Path      string `json:"path"`
	Name      string `json:"name"`
	Extension string `json:"extension"`
	ID        int    `json:"id"`
}

SoundFile holds a sound struct

Jump to

Keyboard shortcuts

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