sound

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

README

sound

The sound package contains utilities for controlling global volume levels.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventVolumeChange = event.RegisterEvent[VolumeChangePayload]()

EventVolumeChange for any given volume type which should be one of the 3 supported.

Functions

func Init

func Init(masterVolume, mVolume, sVolume float64)

Init loads assets and initializes volume levels. It will do nothing after it has been called once.

func NewBar

func NewBar(ctx *scene.Context, kind VolumeKind, pos floatgeom.Point2, w, h int) *entities.Entity

NewBar for setting of the sound graphically.

func PlayOneOfSFX

func PlayOneOfSFX(files ...string)

PlayOneOfSFX playes a random entry from the provided files

func PlaySFX

func PlaySFX(s string) error

func SetMasterVolume

func SetMasterVolume(eh event.Handler, masterVolume float64)

SetMasterVolume value and update all volume values based of the given value.

func SetSFXVolume

func SetSFXVolume(eh event.Handler, newVolume float64)

SetSFXVolume for grove's sound component

Types

type DashedLine

type DashedLine struct {
	render.LayeredPoint
	Dims     intgeom.Point2
	OnColor  color.RGBA
	OffColor color.RGBA
	DashMod  int
	Progress float64
}

DashedLine to display the current value on the bar.

func (*DashedLine) Draw

func (dl *DashedLine) Draw(buff draw.Image, xOff, yOff float64)

Draw the dashed line.

func (*DashedLine) GetDims

func (dl *DashedLine) GetDims() (int, int)

GetDims for the line.

type VolumeChangePayload

type VolumeChangePayload struct {
	Kind      VolumeKind `json:"kind,omitempty"`
	NewVolume float64    `json:"new_volume,omitempty"`
}

VolumeChangePayload encodes that type of volume to manipulate and the volume to set to.

type VolumeKind

type VolumeKind int

VolumeKind details which type of volume should be manipulated by the bar

const (
	KindMaster VolumeKind = iota
	KindMusic  VolumeKind = iota
	KindSFX    VolumeKind = iota
)

Types of bars.

Jump to

Keyboard shortcuts

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