Skip to Content
The Alchemy Project

include/sound/sound.h

The game's sound over the development kit's sound driver (sdk/sound_driver.h): its state and the sound module's functions.

Included by battle_effect_internal.h, sound.c and script.h.

Functions

NameDescription
voidm4aSoundMain (void)The sound module's functions in the order of its stub table (src/sound/stubs.s).
voidsySoundInit (void)Starts the sound driver at power-on, with the music at full volume and its own tempo, and no music chosen yet.
voidsySoundPlay (Sint32 id)Plays a sound number, the game's one way of playing a sound: a fade control, a sound effect, a jingle or music, as the README's "What a sound number means" describes.
voidsySoundUpdateBGMRamps (void)Runs once a VBlank: brings the music back after a jingle and steps its volume and its tempo and pitch toward their targets, stopping on each.
voidsySoundSetBGMTempo (Uint16 tempoScale)Plays the music at a tempo scale at once, BGM_UNITY_SCALE its own; its pitch stays.
voidsySoundSetBGMPitch (Uint16 pitch)Unused: transposes the music's tracks 0 to 7 by pitch, in 1/256 semitone.
voidsySoundSetBGMTempoPitchTarget (Uint16 targetScale, Uint16 step)Unused: ramps the music's tempo and pitch together toward targetScale (BGM_UNITY_SCALE its own) by step a frame.
voidsySoundSetBGMVolume (Sint16 volume)Unused: sets the music's volume at once (BGM_UNITY_SCALE full), ending any fade toward another.
voidsySoundSetBGMVolumeTarget (Uint16 targetVolume, Uint16 step)Unused: fades the music toward targetVolume (BGM_UNITY_SCALE full) by step a frame.
Sint32sySoundGetBGMRestoreDelay (void)Returns nonzero while a jingle holds the music: from its start until its player falls silent and the music begins to fade back in.
voidsySoundTestRun (void)Unused: a sound test that never returns.
voidsySoundStopAllMusicPlayers (void)Unused: stops every music player where it is, for sySoundResumeAllMusicPlayers to go on from.
voidsySoundResumeAllMusicPlayers (void)Unused: resumes every music player from where sySoundStopAllMusicPlayers stopped it.
voidsySoundUpdateCommandMask (Uint32 command)Unused: sets SoundCommandMaskWork, or with SOUND_COMMAND_MASK_TOGGLE flips the bits given; nothing reads the mask.
Sint32sySoundGetCurrentBGM (void)Returns the music sySoundPlay last chose: BGM_NONE before any, MUS_SILENCE after a fade.
voidsySoundWaitForBGMRestore (void)Waits until the music has begun to come back after a jingle, giving up after BGM_WAIT_TIMEOUT_TICKS.
Sint32sySoundGetReverbCode (Sint32 command)Unused: returns the reverb code sySoundPlay gives music command: SOUND_REVERB_LONG for MUS_THE_BROKEN_SEAL_ENDING, MUS_MAIN_THEME_TITLE and MUS_TO_BE_CONTINUED, SOUND_REVERB_NORMAL for the rest.

Variables

NameDescription
extern Uint8BgmFadeRequestedNonzero once SOUND_FADE_OUT_BGM has started the music's fade; further fade requests are ignored until the next music clears it.
extern Sint32SoundMixerClippedSet by the resident mixer whenever it clips a sample: when a sum overflows, its normalize step (resident_mixer.s) saturates the samples and stores the clip mask (0x80008000) here.
extern Uint8SoundUnreadByteAn EWRAM byte sySoundInit clears and nothing else names.

Description

The game's sound over the development kit's sound driver (sdk/sound_driver.h): its state and the sound module's functions.

Functions in detail

m4aSoundMain

void m4aSoundMain(void)

The sound module's functions in the order of its stub table (src/sound/stubs.s).

Definition at line 24 of file sound.h.

Variables in detail

BgmFadeRequested

extern Uint8 BgmFadeRequested

Nonzero once SOUND_FADE_OUT_BGM has started the music's fade; further fade requests are ignored until the next music clears it.

Referenced by sySoundInit() and sySoundPlay().

Definition at line 14 of file sound.h.

SoundMixerClipped

extern Sint32 SoundMixerClipped

Set by the resident mixer whenever it clips a sample: when a sum overflows, its normalize step (resident_mixer.s) saturates the samples and stores the clip mask (0x80008000) here. Only the unused sound test reads it.

Referenced by sySoundTestRun().

Definition at line 18 of file sound.h.

SoundUnreadByte

extern Uint8 SoundUnreadByte

An EWRAM byte sySoundInit clears and nothing else names.

Referenced by sySoundInit().

Definition at line 20 of file sound.h.