Documentation
¶
Overview ¶
Package sfx holds Linefire's pure sound-synthesis helpers over gion, shared by the game runtime and the editors so a previewed sound is exactly the played one. Everything here is deterministic and device-free: functions return PCM (16-bit little-endian stereo at gion.DefaultRate); playing it is the caller's business.
Index ¶
- Constants
- func Bases() []string
- func IsMusicFile(name string) bool
- func Known(base string) bool
- func KnownMood(name string) bool
- func LoopSamples(base string, seed int64) []int16
- func Moods() []string
- func Render(base string, seed int64) []byte
- func Stereo16(samples []int16) []byte
- func Track(mood string, seed int64) []byte
- func Variations(base string, seed int64) [][]byte
Constants ¶
const LoopSeconds = 1.0
LoopSeconds is the length of one rendered loop. Long enough that the repetition is not read as rhythm, short enough to render instantly.
const VariationCount = 4
VariationCount is how many siblings of a base sound the game cycles through, so repeated shots or explosions do not sound identical.
Variables ¶
This section is empty.
Functions ¶
func Bases ¶
func Bases() []string
Bases lists every renderable base sound name (weapon recipes + gion presets + loop recipes), sorted — the editor's pick list.
func IsMusicFile ¶
IsMusicFile reports whether a theme names an audio file rather than a gion mood.
func Known ¶
Known reports whether base names a renderable sound — a one-shot (weapon recipe or gion preset) or a continuous loop recipe. Editors use it to flag a typo.
func KnownMood ¶
KnownMood reports whether name is a gion music mood (cheap; Track without the render). Editors use it to flag a typo before playing silence.
func LoopSamples ¶
LoopSamples renders one seamless loop of a continuous base, or nil when the base is not a known loop recipe.
func Moods ¶
func Moods() []string
Moods lists the gion music mood names, sorted — the editor's pick list for theme sounds.
func Render ¶
Render synthesizes one base sound — a one-shot (weapon recipe or gion preset), or a single pass of a continuous loop — to stereo PCM. It is the editor's preview: what this returns is what the game plays. Unknown base -> nil.
func Stereo16 ¶
Stereo16 packs mono samples into the 16-bit little-endian stereo stream the audio context expects, duplicating each sample into both channels.
func Track ¶
Track synthesizes one looping track for a gion mood name, or nil for a name the music engine does not know. The lead is muted: its high notes turn repetitive fast in a game loop (playtest + a known gion finding); bass and drums carry the mood.
func Variations ¶
Variations resolves a one-shot base (weapon recipe or gion preset) and renders the base plus its variations to stereo PCM. Unknown base -> nil.
Types ¶
This section is empty.