Expand description
The audio manifest: every sound and music cue a game can play, the music pools, and the credits for every third-party work. Screens name cues; the platform layer plays the files.
The game says where the files are (Files): sounds are usually in
the bundle, and music in a folder shipped next to the game, which the
game itself may not be able to read. from_source checks what it can
see, including each track’s length_ms against its file
(ogg_length_ms).
As formats (ADR-0007): a sound file’s header is the Sound kind
(Wav, OggVorbis), a music track’s the MusicTrack kind
(OggVorbisTrack), and the manifest is read by
AudioManifestRon.
Structs§
- Audio
Manifest - The validated audio manifest. Build it with
default()and assign its fields (ADR-0039). - Audio
Manifest Ron - The audio manifest (
audio-manifest,.ron), checked asfrom_sourcesays. Its sound files are named from its own folder and read from the bundle beside it (audio/audio.ronnamessfx/a.wav,audio/sfx/a.wav). The music folder isn’t in the bundle, so its tracks aren’t read here: a tool that can see the folder checks them withfrom_source. - Credit
- One third-party work, for the credits screen (
audio.mdrule 3). - Files
- How to read the referenced files, and how errors name them.
musicisNonewhere the music folder can’t be seen (the game itself, which does no file I/O). Build it withFiles::new(ADR-0039). - Music
Cue - A music track.
- Music
Switch - How one music track gives way to the next (ADR-0054): the old one
fades out over
out_ms, and the new one fades in overin_ms, starting as the old one begins to fade (overlap, a crossfade) or once it has stopped. Build it withnew,after_fadeorcrossfade(ADR-0039). - Music
Track - A music track’s header, and how long it plays.
- OggVorbis
- OGG Vorbis (
ogg-vorbis,.ogg), read for a sound. - OggVorbis
Track - OGG Vorbis (
ogg-vorbis,.ogg), read for a music track: a whole file, whose last page gives its length (ogg_length_ms). - Sound
- A sound file’s header: what the engine knows of a sound before the
platform plays it. Every one is mono or stereo, at
SAMPLE_RATE. - Sound
Cue - A sound effect: one of its files plays each time. Build it with
SoundCue::new(ADR-0039). - Wav
- WAV, PCM or float (
wav,.wav).
Enums§
- Credit
Ref - Who made a sound or a track.
Constants§
- BAKED_
MUSIC_ DIR - Where a music file goes in a package whose target bakes its audio.
- BAKED_
SOUND_ DIR - Where a sound file goes in a package whose target bakes its audio (the
.pdx):sfx/x.wavisaudio/sfx/xthere. - LENGTH_
TOLERANCE_ MS - How far a music cue’s
length_msmay be from its file’s real length, in milliseconds. - LICENSES
- Licenses a credit may have (game ADR-0013, game ADR-0027).
Ownis work we made. - MAX_
SOUND_ BYTES - The most bytes a sound or music file may have: 64 MiB, six minutes of
stereo WAV at
SAMPLE_RATE. - MAX_
VOLUME - Highest cue volume, in percent of the file’s own loudness.
- OWN
- The license of work we made ourselves.
- SAMPLE_
RATE - The sample rate every file must have: quad-snd (native) plays at 44.1 kHz and resamples anything else crudely (game ADR-0026).
Functions§
- format_
problem - Why
bytes(a file namedname) isn’t something the game can play: its content must match its extension (OGG Vorbis for.ogg, PCM or float WAV for.wav), with one or two channels atSAMPLE_RATE. quad-snd panics on native, and never finishes loading on the web, on a file it can’t read, so this runs before any file ships. - from_
source - Parses and validates manifest
source, attributing errors tofile. - ogg_
length_ ms - How long an OGG Vorbis file plays, in milliseconds (to the nearest): the
granule position of its last page, which for Vorbis is the number of
samples in the stream, over the sample rate in its header.
Noneifbytesisn’t a whole OGG Vorbis file. - without_
extension filewithout its extension, as a device that bakes its audio opens it.
Type Aliases§
- Bytes
- A file’s contents, or
Noneif it’s missing.