|
resonance 1.0.1
|
One-shot sound playback by registered name. More...
#include "app/hudutil.h"
Go to the source code of this file.
Functions | |
| void | LookupSound (const HxStr &name, int *pNote, int *pNote2, int *pVelocity, int *pAutoStop) |
| Look up the synthesiser notes, the velocity, and the auto-stop flag registered under one name. | |
| void | PlaySoundByName (const char *pszName) |
| Play the sound registered under one name. | |
| void | StopSoundByName (const char *pszName) |
| Silence the sound registered under one name. | |
| void | PlaySynthSound (int nNote, int nNote2, int nVelocity, int bAutoStop) |
| Play one sound of the hardware synthesiser. | |
| void | CreateNoteDestroyer () |
| Build the note destroyer that releases the auto-stop notes PlaySynthSound() starts. | |
| void | StartNoteDestroyer () |
| Start the note destroyer on the song clock with its epoch at zero. | |
| void | StopNoteDestroyer () |
| Withdraw the note destroyer's queued run. | |
| void | DestroyNoteDestroyer () |
| Delete the note destroyer and clear the pointer to it. | |
| void | PlayActivateSound () |
| Play the note 100 at full velocity with no second note and no release. | |
| void | PlayPowerupSound (PowerupType kind) |
| Play the sound of a captured powerup. | |
One-shot sound playback by registered name.
The PlayStation 2 body lives in AppPlaySoundPS2.cpp, which the mangled name of a file-scope class in the same translation unit records at 0x0012f190. The declaration sits here rather than in a platform header, so a port supplies its own body for the same prototype.
| void LookupSound | ( | const HxStr & | name, |
| int * | pNote, | ||
| int * | pNote2, | ||
| int * | pVelocity, | ||
| int * | pAutoStop ) |
Look up the synthesiser notes, the velocity, and the auto-stop flag registered under one name.
The four outputs start at -1, -1, 127, and 0, and a name in the table overwrites the ones it sets. Most names set one note. SND_MET_MUSIC1, SND_MET_MUSIC2, and SND_MET_SLIDE set a second note, the two music names also set the velocity to 75, and the in-game deploy, erase section, caught powerup, win, and crippler-hit names set the auto-stop flag. A name outside the table leaves all four at their starting values. PlaySoundByName() and StopSoundByName() are the callers. The title is inferred.
| name | The registered name. |
| pNote | Receives the note, or is left at -1. |
| pNote2 | Receives the second note, or is left at -1. |
| pVelocity | Receives the velocity, or is left at 127. |
| pAutoStop | Receives 1 for a sound that releases itself, or is left at 0. |
| void PlaySoundByName | ( | const char * | pszName | ) |
Play the sound registered under one name.
The routine wraps the name in an HxStr, looks its notes, velocity, and auto-stop flag up through LookupSound(), and plays them through PlaySynthSound(). Every metagame screen sound arrives at the synthesiser through this one entry point.
| pszName | The registered name, such as SND_MET_SLIDE. |
| void StopSoundByName | ( | const char * | pszName | ) |
Silence the sound registered under one name.
Looks the name up through LookupSound() and sends a note-off for each of its notes to Globals::GetSynth() on the last MIDI channel. The first note is skipped when it is 1, not when it is -1 as for the second. The binary compares against those values. MetRenderer::Stop() is the one caller, and it stops SND_MET_MUSIC1. The title is inferred from the note-off.
| pszName | The registered name. |
| void PlaySynthSound | ( | int | nNote, |
| int | nNote2, | ||
| int | nVelocity, | ||
| int | bAutoStop ) |
Play one sound of the hardware synthesiser.
Sends a note-on for nNote on the last MIDI channel through Globals::GetSynth() with the velocity, and when bAutoStop is set queues its release 480 ticks later on the song clock with the note destroyer CreateNoteDestroyer() builds. nNote2 then sounds the same way when it is not -1, and is never queued for release. The first note is skipped when it is 1, not when it is -1, which matches StopSoundByName(). The title is inferred.
| nNote | The first note. |
| nNote2 | The second note, or -1 for none. |
| nVelocity | The velocity, from 0 to 127. |
| bAutoStop | Non-zero to release the first note after 480 ticks. |
| void CreateNoteDestroyer | ( | ) |
Build the note destroyer that releases the auto-stop notes PlaySynthSound() starts.
The destroyer is a file-local TickTask that runs every 120 ticks on the song clock and sends a note-off for each queued note whose release tick has arrived. It is stored in a file-scope pointer. GrooveWorld::StartPlay() is the caller. The title is inferred.
| void StartNoteDestroyer | ( | ) |
Start the note destroyer on the song clock with its epoch at zero.
GrooveWorld::StartPlay() is the caller. The title is inferred.
| void StopNoteDestroyer | ( | ) |
Withdraw the note destroyer's queued run.
GrooveWorld::Shutdown() is the caller. The title is inferred.
| void DestroyNoteDestroyer | ( | ) |
Delete the note destroyer and clear the pointer to it.
GrooveWorld::Shutdown() is the caller, after StopNoteDestroyer(). The title is inferred.
| void PlayActivateSound | ( | ) |
Play the note 100 at full velocity with no second note and no release.
The script commands that activate listen mode, practice mode, and team freqs are among the callers. The title is inferred from them.
| void PlayPowerupSound | ( | PowerupType | kind | ) |
Play the sound of a captured powerup.
The neutralizer, crippler, freestyler, autocatcher, bumper, and multiplier each have a sound. The effect powerups and the guides have none. LocalPlayer::DispatchPriv() and the routine at 0x00122ab8 are the callers. The title is inferred.
| kind | The captured powerup. |