wavelength 1.0.0
Loading...
Searching...
No Matches
SongPreview Class Reference

The streamed clip of a song that plays while the song screen shows the song. More...

#include <songpreview.h>

Public Types

enum  State {
  kStateStarting = 0 , kStateReady = 1 , kStateEnding = 2 , kStateRestoring = 3 ,
  kStateMenu = 4
}
 The states of the clip, the values of sState. More...

Static Public Member Functions

static void Stop (float fFadeStep)
 Mute the menu music and prepare the sound output for clips.
static void End (bool bRestoreMusic)
 Fade out the clip, forget the clip to play, and enter kStateEnding.
static bool IsWaiting ()
 Report whether the clip is in kStateReady.
static void Load (const char *pszSong, bool bMetaClip)
 Choose the clip of a song and fade out the clip that plays.
static void FadeOut ()
 Start fading the clip out.
static bool IsIdle ()
 Report whether no clip plays and none is chosen.
static bool IsPlaying ()
 Report whether the clip is in kStateMenu, the state before Stop().
static void Poll ()
 Advance the clip, fading its volume and starting or stopping its stream as requested.

Static Public Attributes

static const char * sLevelEncrypt
 The stream that stands in for the clip of a locked song.
static const char * sBonusEncrypt
 The stream that stands in for the clip of a locked bonus song.

Detailed Description

The streamed clip of a song that plays while the song screen shows the song.

The class is not polymorphic and has no RTTI. The name is inferred. The clip is a state machine whose state is stored in globals, and every member is static. While the menu music plays the state is kStateMenu. Stop() switches the sound output to the effects of the clip, and a job the output runs afterwards sets kStateReady. Load() chooses a clip, and Poll() plays it, fading its volume in and out. End() fades the clip out. Once the clip has stopped, Poll() restores the effects of the menu music, and a job the output runs afterwards sets kStateMenu again.

Member Enumeration Documentation

◆ State

The states of the clip, the values of sState.

Enumerator
kStateStarting 

Stop() waits for the output to take the effects of the clip.

kStateReady 

A clip may be chosen and played.

kStateEnding 

End() waits for the clip to stop.

kStateRestoring 

Poll() waits for the output to take the effects of the menu.

kStateMenu 

The menu music plays, and no clip does.

Member Function Documentation

◆ Stop()

void SongPreview::Stop ( float fFadeStep)
static

Mute the menu music and prepare the sound output for clips.

In kStateMenu the output level drops to 0 and the song_preview_effects entry of the metagame configuration applies. The state becomes kStateStarting until the output runs a job that sets kStateReady.

Parameters
fFadeStepThe volume a clip gains or loses on each Poll().
Ghidra address:
NTSC-U/C: 0x00196570
Ghidra address:
PAL: 0x0019da00

◆ End()

void SongPreview::End ( bool bRestoreMusic)
static

Fade out the clip, forget the clip to play, and enter kStateEnding.

Parameters
bRestoreMusicWhether the effects of the menu music return once the clip has stopped.
Ghidra address:
NTSC-U/C: 0x00196668
Ghidra address:
PAL: 0x0019daf8

◆ IsWaiting()

bool SongPreview::IsWaiting ( )
static

Report whether the clip is in kStateReady.

Returns
Whether a clip may play.
Ghidra address:
NTSC-U/C: 0x001966a0
Ghidra address:
PAL: 0x0019db30

◆ Load()

void SongPreview::Load ( const char * pszSong,
bool bMetaClip )
static

Choose the clip of a song and fade out the clip that plays.

The two encrypted songs name their stream file directly. Any other song plays Songs/<song>/<song>_metaclip.str when bMetaClip is set, and audio/<song>.str, with the song name cut to eight characters, otherwise. In the PAL build a tutorial song (one whose name includes "TUT") plays Songs/<song>/<language>/<song>_metaclip.str in a language other than English.

Parameters
pszSongThe song, or one of the encrypted streams.
bMetaClipWhether the song's own clip plays.
Ghidra address:
NTSC-U/C: 0x001966b8
Ghidra address:
PAL: 0x0019db48

◆ FadeOut()

void SongPreview::FadeOut ( )
static

Start fading the clip out.

Ghidra address:
NTSC-U/C: 0x00196798
Ghidra address:
PAL: 0x0019dcb8

◆ IsIdle()

bool SongPreview::IsIdle ( )
static

Report whether no clip plays and none is chosen.

Returns
Whether the clip is idle.
Ghidra address:
NTSC-U/C: 0x001967b0
Ghidra address:
PAL: 0x0019dcd0

◆ IsPlaying()

bool SongPreview::IsPlaying ( )
static

Report whether the clip is in kStateMenu, the state before Stop().

Returns
Whether the menu music plays.
Ghidra address:
NTSC-U/C: 0x001967d8
Ghidra address:
PAL: 0x0019dcf8

◆ Poll()

void SongPreview::Poll ( )
static

Advance the clip, fading its volume and starting or stopping its stream as requested.

Ghidra address:
NTSC-U/C: 0x001967f0
Ghidra address:
PAL: 0x0019dd10

Member Data Documentation

◆ sLevelEncrypt

const char* SongPreview::sLevelEncrypt
static

The stream that stands in for the clip of a locked song.

Ghidra address:
NTSC-U/C: 0x003af8a8

◆ sBonusEncrypt

const char* SongPreview::sBonusEncrypt
static

The stream that stands in for the clip of a locked bonus song.

Ghidra address:
NTSC-U/C: 0x003af8ac

The documentation for this class was generated from the following file: