sound

package
v0.0.0-...-79996cc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sound manages music and sound effects.

Index

Constants

This section is empty.

Variables

View Source
var (
	// If enabled is false, all sound functions are no-ops.
	Enabled bool

	// Root folder on disk where sound and music files should live.
	SoundRoot = filepath.Join("rtp", "sfx")
	MusicRoot = filepath.Join("rtp", "music")
)

Package globals.

Functions

func LoadMusic

func LoadMusic(filename string) audio.Playable

LoadMusic loads filename from the MusicRoot into the global music cache. If the music is already loaded, does nothing.

func LoadSound

func LoadSound(filename string) audio.Playable

LoadSound loads filename from the SoundRoot into the global SFX cache. If the sound is already loaded, does nothing.

func PlaySound

func PlaySound(filename string)

PlaySound plays the named sound. It will de-duplicate if the same sound is already playing.

func PreloadAll

func PreloadAll()

PreloadAll looks in the SoundRoot and MusicRoot folders and preloads all supported files into the caches.

Types

This section is empty.

Jump to

Keyboard shortcuts

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