Skip to Content
The Alchemy Project

src/sound/sound_test.c

The sound test, which nothing in the game calls; the heard-sound flags the link lobby offers its tunes by; and the fixed 31536 Hz output rate the game sets at start-up. More…

Enumerations

NameDescription
enumanonymous enum { SOUND_FLAG_COUNT }The sound ids SoundFlags has a bit for.
enumanonymous enum { SOUND_FIXED_RATE, SOUND_FIXED_SAMPLES_PER_VBLANK }The fixed output rate sySoundInit sets for the whole game.

Functions

NameDescription
voidsySoundTestUnusedDummyFunction (void)Unused: the sound test's own empty function, as games/common/sdk/sound/sound.c keeps UnusedDummyFunc; nothing calls it.
voidsySoundTestRun (void)Unused: the sound test, which never returns.
voidsySoundUpdateCommandMask (Uint32 command)Unused: replaces SoundCommandMask, or flips the bits named with AUDIO_COMMAND_TOGGLE.
Uint16sySoundGetCurrentBGM (void)Returns the music sySoundPlay last started: MUS_SILENCE before any and after a fade.
BoolsySoundFlagTest (Sint32 sound)Returns sound sound's bit in SoundFlags, one bit for each of the SOUND_FLAG_COUNT sound ids.
voidsySoundFlagSet (Sint32 sound)Sets sound sound's bit in SoundFlags.
voidsySoundFlagClear (Sint32 sound)Clears sound sound's bit in SoundFlags.
voidsySoundSetFixedSampleFrequency (Uint32 mode)Sets direct sound to the fixed SOUND_FIXED_RATE with SOUND_FIXED_SAMPLES_PER_VBLANK samples a frame, keeping mode's rate nibble, clears the two PCM buffers and points DMA 1 and 2 at them, then restarts timer 0 as the screen's last line begins.

Variables

NameDescription
static const SOUND_TEST_SOUNDSSoundTestSoundsThe sounds the test's three selectors start on: one each for music, jingles and sound effects.

Description

The sound test, which nothing in the game calls; the heard-sound flags the link lobby offers its tunes by; and the fixed 31536 Hz output rate the game sets at start-up. Linked after sySoundPlay's object, with the BIOS sound call between them.

Enumerations in detail

anonymous enum

enum { SOUND_FLAG_COUNT }

The sound ids SoundFlags has a bit for.

EnumeratorValueDescription
SOUND_FLAG_COUNT1024

Definition at line 114 of file sound_test.c.

anonymous enum

enum { SOUND_FIXED_RATE, SOUND_FIXED_SAMPLES_PER_VBLANK }

The fixed output rate sySoundInit sets for the whole game.

EnumeratorValueDescription
SOUND_FIXED_RATE31536Samples a second: SOUND_MODE_FREQ_GAME's rate.
SOUND_FIXED_SAMPLES_PER_VBLANK528SOUND_FIXED_RATE over the 59.7275 frames a second, rounded.

Definition at line 159 of file sound_test.c.

Functions in detail

sySoundTestUnusedDummyFunction

void sySoundTestUnusedDummyFunction(void)

Unused: the sound test's own empty function, as games/common/sdk/sound/sound.c keeps UnusedDummyFunc; nothing calls it.

Definition at line 12 of file sound_test.c.

sySoundTestRun

void sySoundTestRun(void)

Unused: the sound test, which never returns. Up and Down choose a selector (music, jingles, sound effects), Left and Right step its sound by 1 and L and R by 10, A plays it, B silences the music and Start fades it, and Select fades the action sounds and steps the reverb code, from SOUND_REVERB_LONG, which this game's sySoundLoadReverbCode ignores.

References BuildStampWork, PerWork, Sint32, SoundMixerClipped, SoundTestSounds, SoundVBlankStateWork, sySoundLoadReverbCode(), sySoundPlay() and sySynch().

Definition at line 27 of file sound_test.c.

sySoundUpdateCommandMask

void sySoundUpdateCommandMask(Uint32 command)

Unused: replaces SoundCommandMask, or flips the bits named with AUDIO_COMMAND_TOGGLE. Nothing calls it and nothing reads the mask.

References SoundCommandMask.

Definition at line 95 of file sound_test.c.

sySoundGetCurrentBGM

Uint16 sySoundGetCurrentBGM(void)

Returns the music sySoundPlay last started: MUS_SILENCE before any and after a fade.

References CurrentBgm.

Definition at line 108 of file sound_test.c.

sySoundFlagTest

Bool sySoundFlagTest(Sint32 sound)

Returns sound sound's bit in SoundFlags, one bit for each of the SOUND_FLAG_COUNT sound ids.

References Sint32 and SoundFlags.

Referenced by scLinkLobbyTakeSongRequest().

Definition at line 121 of file sound_test.c.

sySoundFlagSet

void sySoundFlagSet(Sint32 sound)

Sets sound sound's bit in SoundFlags.

References Sint32 and SoundFlags.

Referenced by sySoundPlay().

Definition at line 135 of file sound_test.c.

sySoundFlagClear

void sySoundFlagClear(Sint32 sound)

Clears sound sound's bit in SoundFlags.

References Sint32 and SoundFlags.

Definition at line 147 of file sound_test.c.

sySoundSetFixedSampleFrequency

void sySoundSetFixedSampleFrequency(Uint32 mode)

Sets direct sound to the fixed SOUND_FIXED_RATE with SOUND_FIXED_SAMPLES_PER_VBLANK samples a frame, keeping mode's rate nibble, clears the two PCM buffers and points DMA 1 and 2 at them, then restarts timer 0 as the screen's last line begins.

References __divsi3(), MixerPcmBuffer and syWordsClear().

Referenced by sySoundInit().

Definition at line 171 of file sound_test.c.

Variables in detail

SoundTestSounds

static const SOUND_TEST_SOUNDS SoundTestSounds

The sounds the test's three selectors start on: one each for music, jingles and sound effects.

Referenced by sySoundTestRun().

Definition at line 18 of file sound_test.c.