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

One song: its configuration from the song text file and the tracks its MIDI file builds. More...

#include <song.h>

Classes

class  PatternFile
 One pattern file of a remix or a duel while it is read. More...

Public Types

enum  TrackType {
  kTrackTypeAxe = 1 , kTrackTypePitch = 2 , kTrackTypeScratch = 3 , kTrackTypeVox = 4 ,
  kTrackTypeCatch = 5
}
 Types of an instrument track. More...
enum  LoadState { kLoadStateParse = 0 , kLoadStateSetup = 1 , kLoadStatePatterns = 2 , kLoadStateDone = 3 }
 Values of mState. More...

Public Member Functions

 Song (DataArray *pSongConfig, int nSkillLevel, int nRuleSet)
 Read the configuration of a song for a difficulty and a rule set.
 ~Song ()
 Release the song and its tracks.
void Load ()
 Start loading the song without checking it for authoring errors.
void PollLoad ()
 Advance the load Load() started.
bool IsLoaded ()
 Report whether the load Load() started is complete.
void ApplySavedRemix ()
 Replace the tracks with the saved remix the game database selects.
void ApplySynthSettings ()
 Apply the effects buses of the song, and set controller 16 of every MIDI channel to the level of the channel's instrument.
int GetNumTracks () const
 Report the number of instrument tracks.
int GetTrackType (int nTrack) const
 Report the type of an instrument track.
int GetTrackInstrument (int nTrack) const
 Report the instrument of a track.
DuelPatternTable * GetDuelPatterns ()
 Report the duel patterns of the song.
CatchTrackData * GetCatchTrackData (int nTrack) const
 Report the gems of a catch track.
ScratchTrackData * GetScratchData (int nTrack) const
 Report the patterns of a turntable track.
AxeTrackData * GetAxeData (int nTrack) const
 Report the notes of a guitar track.
PitchTrackRiffData * GetTrackRiffData (int nTrack) const
 Report the riffs of a track.
CatchTrackData * GetVoxData (int nTrack) const
 Report the gems of a vocal track.
int GetTrackFlags (int nTrack) const
 Report the flags of a track.
int GetNumBackMusic () const
 Report the number of background music tracks.
BackMusic * GetBackMusic (int nIndex) const
 Report one background music track.
int GetBackMusicMaster (int nIndex) const
 Report the catch track a background music track plays along with.
int GetNumIntroMuses () const
 Report the number of performances of the tracks named "INTRO".
Muse * GetIntroMuse (int nIndex) const
 Report the performance of one track named "INTRO".
ScriptTrackData * GetScriptTrack (const char *pszName) const
 Find a track named "SCRIPT" of the MIDI file by the name of its commands.
SectionBoundaries * GetSections () const
 Report the sections.
float * GetMsPerTick () const
 Report the duration of one tick.
PlayMap * GetPlayMap () const
 Report the map of the song positions.
BankLoader * GetBankTrack () const
 Report the track named "BANK".
WorldTrack * GetWorldTrack () const
 Report the events of the track named "WORLD".
Lyric * GetLyric () const
 Report the lyrics.
FXMgr * GetFXMgr () const
 Report the effect sets.
float GetSpeed () const
 Report the speed of the song.
SlotGrid * GetSlotGrid () const
 Report the slot grid of the song.
std::vector< std::unique_ptr< PitchTrackGems > > * GetTrackPitchData (int nTrack)
 Report the gem patterns of a pitch track.
const std::vector< std::vector< int > > & GetEnableOrder () const
 Report the steps of the catch tracks to enable, each a list of track indices.
bool HasLowVolumes (int nChannel) const
 Report whether the song sets the low volumes of a mixer channel.
const std::vector< unsigned char > * GetLowVolumes (int nChannel) const
 Report the low volumes of a mixer channel.
bool HasTrackVolumes (int nTrack) const
 Report whether a track has a volume list.
const std::vector< unsigned char > & GetTrackVolumes (int nTrack) const
 Report the volumes of a track.
bool HasFreestyleLowVolumes () const
 Report whether the song sets the low volumes of the freestyle track.
const std::vector< unsigned char > * GetFreestyleLowVolumes () const
 Report the low volumes of the freestyle track.
int GetRemixEffectsBus () const
 Report the effects bus of a remix.
const char * GetRemixEffectsName () const
 Report the localised name of the effects of a remix.
const char * GetSectionLabel (int nIndex) const
 Report the label of a remix section.
int GetDifficulty () const
LevelMidiBuilder * GetBuilder () const
int GetTicksPerBar () const
int GetNumBars () const
int GetIntroBars () const
const std::vector< int > & GetSkippedBars () const
const std::vector< int > & GetDuelTrackOrder () const

Static Public Attributes

static constexpr int kNumMixerChannels = 16
 Number of mixer channels the song can set the low volumes of.
static constexpr int kNumPatternFiles = 3
 Number of pattern files a remix or a duel reads, and of gem patterns of a pitch track.

Detailed Description

One song: its configuration from the song text file and the tracks its MIDI file builds.

The class is not polymorphic and has no RTTI. The name is inferred from the song text file it reads. The object is 0x370 bytes. Load() reads the configuration and starts the MIDI file, and PollLoad() advances the load through the states of LoadState until IsLoaded() reports it done. A remix or a duel also reads the gem patterns of its sections from three pattern files.

Member Enumeration Documentation

◆ TrackType

Types of an instrument track.

Enumerator
kTrackTypeAxe 

A guitar freestyle track.

kTrackTypePitch 

A pitch track.

kTrackTypeScratch 

A turntable freestyle track.

kTrackTypeVox 

A vocal track.

kTrackTypeCatch 

A catch track.

◆ LoadState

Values of mState.

Enumerator
kLoadStateParse 

The MIDI file is parsed.

kLoadStateSetup 

The MIDI file is parsed, and the track settings are read next.

kLoadStatePatterns 

The pattern files are read.

kLoadStateDone 

The song is loaded.

Constructor & Destructor Documentation

◆ Song()

Song::Song ( DataArray * pSongConfig,
int nSkillLevel,
int nRuleSet )

Read the configuration of a song for a difficulty and a rule set.

Parameters
pSongConfigThe entry of the song in the "songs" section.
nSkillLevelThe difficulty.
nRuleSetThe rule set the song is played under, one of GameDb::RuleSet.
Ghidra address:
NTSC-U/C: 0x00118e00
Ghidra address:
PAL: 0x0011a598

◆ ~Song()

Song::~Song ( )

Release the song and its tracks.

Ghidra address:
NTSC-U/C: 0x00119008
Ghidra address:
PAL: 0x0011a7a0

Member Function Documentation

◆ Load()

void Song::Load ( )

Start loading the song without checking it for authoring errors.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x001194b0
Ghidra address:
PAL: 0x0011ac48

◆ PollLoad()

void Song::PollLoad ( )

Advance the load Load() started.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00119568
Ghidra address:
PAL: 0x0011ad00

◆ IsLoaded()

bool Song::IsLoaded ( )

Report whether the load Load() started is complete.

The name is inferred.

Returns
Whether the song is loaded.
Ghidra address:
NTSC-U/C: 0x001197d8
Ghidra address:
PAL: 0x0011af68

◆ ApplySavedRemix()

void Song::ApplySavedRemix ( )

Replace the tracks with the saved remix the game database selects.

The name is inferred. The pitch tracks lose their pattern gems, every instrument track is enabled in one step, and the song splits into four sections at the quarter points.

Ghidra address:
NTSC-U/C: 0x0011e880
Ghidra address:
PAL: 0x00120010

◆ ApplySynthSettings()

void Song::ApplySynthSettings ( )

Apply the effects buses of the song, and set controller 16 of every MIDI channel to the level of the channel's instrument.

The name is inferred. A guitar or turntable track gets 50, a channel without a track the level of the channel before it, and channel 16 gets 70.

Ghidra address:
NTSC-U/C: 0x0011e738
Ghidra address:
PAL: 0x0011fec8

◆ GetNumTracks()

int Song::GetNumTracks ( ) const

Report the number of instrument tracks.

Returns
The number of tracks.
Ghidra address:
NTSC-U/C: 0x0011ede0
Ghidra address:
PAL: 0x00120570

◆ GetTrackType()

int Song::GetTrackType ( int nTrack) const

Report the type of an instrument track.

Parameters
nTrackThe track.
Returns
One of TrackType.
Ghidra address:
NTSC-U/C: 0x0011ee00
Ghidra address:
PAL: 0x00120590

◆ GetTrackInstrument()

int Song::GetTrackInstrument ( int nTrack) const

Report the instrument of a track.

Parameters
nTrackThe track.
Returns
The instrument.
Ghidra address:
NTSC-U/C: 0x0011ee20
Ghidra address:
PAL: 0x001205b0

◆ GetDuelPatterns()

DuelPatternTable * Song::GetDuelPatterns ( )

Report the duel patterns of the song.

The name is inferred.

Returns
The patterns.
Ghidra address:
NTSC-U/C: 0x0011ee40
Ghidra address:
PAL: 0x001205d0

◆ GetCatchTrackData()

CatchTrackData * Song::GetCatchTrackData ( int nTrack) const

Report the gems of a catch track.

Parameters
nTrackThe track.
Returns
The gems.
Ghidra address:
NTSC-U/C: 0x0011ee48
Ghidra address:
PAL: 0x001205d8

◆ GetScratchData()

ScratchTrackData * Song::GetScratchData ( int nTrack) const

Report the patterns of a turntable track.

Parameters
nTrackThe track.
Returns
The patterns.
Ghidra address:
NTSC-U/C: 0x0011ee68
Ghidra address:
PAL: 0x001205f8

◆ GetAxeData()

AxeTrackData * Song::GetAxeData ( int nTrack) const

Report the notes of a guitar track.

Parameters
nTrackThe track.
Returns
The notes.
Ghidra address:
NTSC-U/C: 0x0011ee88
Ghidra address:
PAL: 0x00120618

◆ GetTrackRiffData()

PitchTrackRiffData * Song::GetTrackRiffData ( int nTrack) const

Report the riffs of a track.

Parameters
nTrackThe track.
Returns
The riffs, or null for a track without riffs.
Ghidra address:
NTSC-U/C: 0x0011eea8
Ghidra address:
PAL: 0x00120638

◆ GetVoxData()

CatchTrackData * Song::GetVoxData ( int nTrack) const

Report the gems of a vocal track.

Parameters
nTrackThe track.
Returns
The gems, or null for another type of track.
Ghidra address:
NTSC-U/C: 0x0011eec8
Ghidra address:
PAL: 0x00120658

◆ GetTrackFlags()

int Song::GetTrackFlags ( int nTrack) const

Report the flags of a track.

Parameters
nTrackThe track.
Returns
The flags.
Ghidra address:
NTSC-U/C: 0x0011eee8
Ghidra address:
PAL: 0x00120678

◆ GetNumBackMusic()

int Song::GetNumBackMusic ( ) const

Report the number of background music tracks.

Returns
The number of tracks.
Ghidra address:
NTSC-U/C: 0x0011ef08
Ghidra address:
PAL: 0x00120698

◆ GetBackMusic()

BackMusic * Song::GetBackMusic ( int nIndex) const

Report one background music track.

Parameters
nIndexThe index.
Returns
The track.
Ghidra address:
NTSC-U/C: 0x0011ef28
Ghidra address:
PAL: 0x001206b8

◆ GetBackMusicMaster()

int Song::GetBackMusicMaster ( int nIndex) const

Report the catch track a background music track plays along with.

Parameters
nIndexThe index of the background music track.
Returns
The catch track, or -1 for music that plays by itself.
Ghidra address:
NTSC-U/C: 0x0011ef48
Ghidra address:
PAL: 0x001206d8

◆ GetNumIntroMuses()

int Song::GetNumIntroMuses ( ) const

Report the number of performances of the tracks named "INTRO".

Returns
The number of performances.
Ghidra address:
NTSC-U/C: 0x0011ef60
Ghidra address:
PAL: 0x001206f0

◆ GetIntroMuse()

Muse * Song::GetIntroMuse ( int nIndex) const

Report the performance of one track named "INTRO".

Parameters
nIndexThe index.
Returns
The performance.
Ghidra address:
NTSC-U/C: 0x0011ef80
Ghidra address:
PAL: 0x00120710

◆ GetScriptTrack()

ScriptTrackData * Song::GetScriptTrack ( const char * pszName) const

Find a track named "SCRIPT" of the MIDI file by the name of its commands.

Parameters
pszNameThe name.
Returns
The commands, or null.
Ghidra address:
NTSC-U/C: 0x0011efa0
Ghidra address:
PAL: 0x00120730

◆ GetSections()

SectionBoundaries * Song::GetSections ( ) const

Report the sections.

Returns
The sections.
Ghidra address:
NTSC-U/C: 0x0011efc0
Ghidra address:
PAL: 0x00120750

◆ GetMsPerTick()

float * Song::GetMsPerTick ( ) const

Report the duration of one tick.

Returns
The duration in milliseconds.
Ghidra address:
NTSC-U/C: 0x0011efc8
Ghidra address:
PAL: 0x00120758

◆ GetPlayMap()

PlayMap * Song::GetPlayMap ( ) const

Report the map of the song positions.

Returns
The map.
Ghidra address:
NTSC-U/C: 0x0011efd0
Ghidra address:
PAL: 0x00120760

◆ GetBankTrack()

BankLoader * Song::GetBankTrack ( ) const

Report the track named "BANK".

Returns
The track.
Ghidra address:
NTSC-U/C: 0x0011efe0
Ghidra address:
PAL: 0x00120770

◆ GetWorldTrack()

WorldTrack * Song::GetWorldTrack ( ) const

Report the events of the track named "WORLD".

Returns
The events.
Ghidra address:
NTSC-U/C: 0x0011eff0
Ghidra address:
PAL: 0x00120780

◆ GetLyric()

Lyric * Song::GetLyric ( ) const

Report the lyrics.

Returns
The lyrics.
Ghidra address:
NTSC-U/C: 0x0011f000
Ghidra address:
PAL: 0x00120790

◆ GetFXMgr()

FXMgr * Song::GetFXMgr ( ) const

Report the effect sets.

Returns
The effect sets, or null.
Ghidra address:
NTSC-U/C: 0x0011f010
Ghidra address:
PAL: 0x001207a0

◆ GetSpeed()

float Song::GetSpeed ( ) const

Report the speed of the song.

Returns
The speed.
Ghidra address:
NTSC-U/C: 0x0011f020
Ghidra address:
PAL: 0x001207b0

◆ GetSlotGrid()

SlotGrid * Song::GetSlotGrid ( ) const

Report the slot grid of the song.

Returns
The patterns of the sections.
Ghidra address:
NTSC-U/C: 0x0011f030
Ghidra address:
PAL: 0x001207c0

◆ GetTrackPitchData()

std::vector< std::unique_ptr< PitchTrackGems > > * Song::GetTrackPitchData ( int nTrack)

Report the gem patterns of a pitch track.

The body also calls GetTrackType() and discards the result.

Parameters
nTrackThe track.
Returns
The kNumPatternFiles patterns of the track, null for another type of track.
Ghidra address:
NTSC-U/C: 0x0011f038
Ghidra address:
PAL: 0x001207c8

◆ GetEnableOrder()

const std::vector< std::vector< int > > & Song::GetEnableOrder ( ) const

Report the steps of the catch tracks to enable, each a list of track indices.

Returns
The steps.
Ghidra address:
NTSC-U/C: 0x0011f078
Ghidra address:
PAL: 0x00120808

◆ HasLowVolumes()

bool Song::HasLowVolumes ( int nChannel) const

Report whether the song sets the low volumes of a mixer channel.

Parameters
nChannelThe channel.
Returns
Whether the volumes are set.
Ghidra address:
NTSC-U/C: 0x0011f080
Ghidra address:
PAL: 0x00120810

◆ GetLowVolumes()

const std::vector< unsigned char > * Song::GetLowVolumes ( int nChannel) const

Report the low volumes of a mixer channel.

The body also calls HasLowVolumes() and discards the result.

Parameters
nChannelThe channel.
Returns
The volumes.
Ghidra address:
NTSC-U/C: 0x0011f0a0
Ghidra address:
PAL: 0x00120830

◆ HasTrackVolumes()

bool Song::HasTrackVolumes ( int nTrack) const

Report whether a track has a volume list.

Parameters
nTrackThe track.
Returns
Whether the volume list of the track is not empty.
Ghidra address:
NTSC-U/C: 0x0011f0e0
Ghidra address:
PAL: 0x00120870

◆ GetTrackVolumes()

const std::vector< unsigned char > & Song::GetTrackVolumes ( int nTrack) const

Report the volumes of a track.

The body also calls HasTrackVolumes() and discards the result.

Parameters
nTrackThe track.
Returns
The volume list, with the volume of the playing track first and the volume of a muted track second.
Ghidra address:
NTSC-U/C: 0x0011f100
Ghidra address:
PAL: 0x00120890

◆ HasFreestyleLowVolumes()

bool Song::HasFreestyleLowVolumes ( ) const

Report whether the song sets the low volumes of the freestyle track.

Returns
Whether the volumes are set.
Ghidra address:
NTSC-U/C: 0x0011f140
Ghidra address:
PAL: 0x001208d0

◆ GetFreestyleLowVolumes()

const std::vector< unsigned char > * Song::GetFreestyleLowVolumes ( ) const

Report the low volumes of the freestyle track.

The body also calls HasFreestyleLowVolumes() and discards the result.

Returns
The volumes.
Ghidra address:
NTSC-U/C: 0x0011f158
Ghidra address:
PAL: 0x001208e8

◆ GetRemixEffectsBus()

int Song::GetRemixEffectsBus ( ) const

Report the effects bus of a remix.

Returns
remix_effects_bus, from 0 to 2.
Ghidra address:
NTSC-U/C: 0x0011f180
Ghidra address:
PAL: 0x00120910

◆ GetRemixEffectsName()

const char * Song::GetRemixEffectsName ( ) const

Report the localised name of the effects of a remix.

Returns
The name, or "no name".
Ghidra address:
NTSC-U/C: 0x0011f188
Ghidra address:
PAL: 0x00120918

◆ GetSectionLabel()

const char * Song::GetSectionLabel ( int nIndex) const

Report the label of a remix section.

Parameters
nIndexThe index of the label.
Returns
The label.
Ghidra address:
NTSC-U/C: 0x0011f190
Ghidra address:
PAL: 0x00120920

◆ GetDifficulty()

int Song::GetDifficulty ( ) const
inline
Returns
The difficulty. The duel coaches the players at 1.

◆ GetBuilder()

LevelMidiBuilder * Song::GetBuilder ( ) const
inline
Returns
The builder of the tracks.

◆ GetTicksPerBar()

int Song::GetTicksPerBar ( ) const
inline
Returns
The length of a bar in ticks.

◆ GetNumBars()

int Song::GetNumBars ( ) const
inline
Returns
song_bars, the length of the song in bars.

◆ GetIntroBars()

int Song::GetIntroBars ( ) const
inline
Returns
intro_bars, one more than the bars before bar 0.

◆ GetSkippedBars()

const std::vector< int > & Song::GetSkippedBars ( ) const
inline
Returns
The bars a duel passes over, ascending.

◆ GetDuelTrackOrder()

const std::vector< int > & Song::GetDuelTrackOrder ( ) const
inline
Returns
The tracks a duel plays, cycled by section.

Member Data Documentation

◆ kNumMixerChannels

int Song::kNumMixerChannels = 16
staticconstexpr

Number of mixer channels the song can set the low volumes of.

◆ kNumPatternFiles

int Song::kNumPatternFiles = 3
staticconstexpr

Number of pattern files a remix or a duel reads, and of gem patterns of a pitch track.


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