resonance 1.0.1
Loading...
Searching...
No Matches
TrackData Class Reference

Converted events of one track of a level. More...

#include <trackdata.h>

Collaboration diagram for TrackData:

Classes

class  Bar
 One bar of a track, with its scoring values and the sorted lists of what starts in it. More...

Public Member Functions

void * operator new (size_t nSize)
 Allocate a track from the tagged heap under the tag TrackData.
void operator delete (void *pBlock)
 Release a track to the tagged heap.
 TrackData (int nIndex, PlayMap *pMap)
 Construct an empty track over a play map.
 ~TrackData ()
 Delete every riff set and harmony the track created, then the bars.
void AddRiff (int nTick, Riff *pRiff)
 Give a riff a place in the riff set at a song position.
void AddHarmony (int nTick, const Harmony &harmony)
 Start a harmony at a song position.
void AddGem (int nTick, int nGem, Riff *pRiff)
 Add a gem at a song position, with a riff set of its own when a riff is given.
void AddMidiMsg (int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2)
 Add a StdMidiMsg built from three bytes to the bar at a song position.
void AddNoteMsg (int nTick, unsigned char nNote, unsigned char nVelocity, int nLength, unsigned char nChannel)
 Add a NoteMsg built from four values to the bar at a song position.
void ScoreBars ()
 Give every bar its point value and its configured word.
int FindGemAtOrBefore (int nTick, int *pTick, int *pGem) const
 Find the last gem at or before a song position, looking back into the previous bar when the position's own bar has none.
int FindGemAtOrAfter (int nTick, int *pTick, int *pGem) const
 Find the first gem at or after a song position within mGemSearchBars bars.
void Print (std::ostream &stream)
 Write the track and every bar to a diagnostic stream.
void Locate (int nTick, Bar *&pBar, Sch::Tick &offset)
 Split a song position into its bar and the offset within the bar.
void LocateMapped (int nTick, const Bar *&pBar, Sch::Tick &offset) const
 Split a song position into its bar, mapped through PlayMap::MapBar(), and the offset.
void AddPhrases (PhraseDatabase *pDatabase)
 Add every gem of every phrase of a database, one phrase per step, and score each bar.
void SetQuant (int nTick, int nQuant)
 Set the quantisation of the bar at a song position.
void SetActive (int nTick, int bActive)
 Do nothing.
void SetOwner (Player *pPlayer, int nBar) const
 Report a player for a bar to the gamer, with this track's index.
Harmony * GetHarmony (int nTick) const
Riff * GetRiff (int nTick, int nLevel) const
Riff * GetRiffInMappedBar (int nBar, int nOffset, int nLevel) const
Riff * GetRiffInBar (int nBar, int nOffset, int nLevel) const
int GetGemAt (int nTick) const
int GetQuant (int nBar) const
int IsStepStart (int nBar) const
int StepStartBar (int nBar) const
int NextStepBar (int nBar) const
int FollowingStepBar (int nBar) const
int QueryBar (int nBar) const
 Ask the gamer about a bar, with this track's index.
int GetPoints (int nBar) const
int GetJuice (int nBar) const
const std::vector< TickObj< MuseMsg * > > * GetMidiInBar (int nBar) const
const std::vector< TickObj< int > > * GetGemsInBar (int nBar) const
const std::vector< TickObj< MuseMsg * > > * GetMidi (int nBar) const
const std::vector< TickObj< int > > * GetGems (int nBar) const
void Locate (int nTick, Bar *&pBar)
 Find the bar of a song position, discarding the offset.
void LocateMapped (int nTick, const Bar *&pBar) const
 Find the mapped bar of a song position, discarding the offset.
void GetBar (int nBar, const Bar *&pBar) const
 Find a bar by its bar number, mapped through PlayMap::MapBar().
int FindStepIndex (int nBar) const

Public Attributes

Gamer * mGamer
int mIndex
unsigned char mChannel
unsigned char mPaddingByte
unsigned short mPaddingHalf
int mKind
int mInstrument
 Instrument index from 0 to 5.

Friends

class Catcher
class LevelBuilder

Detailed Description

Converted events of one track of a level.

The class emits no RTTI descriptor and is not polymorphic. Its name is attested rather than inferred. The image records Catcher's constructor signature, whose third parameter is const TrackData *, and the LevelBuilder constructor allocates it under the tag TrackData.

The LevelBuilder allocation measures the object at 0x54 bytes. The constructor sizes mBars to the last step of the play map, one Bar per bar of the level, and every position the class accepts is split into a bar and an offset within the bar by Locate() or LocateMapped(), the second mapping the bar through PlayMap::MapBar() first.

The destructor deletes every riff set and every harmony the track created. A bar refers to them only through its sorted lists.

The members mIndex, mChannel, and mKind are public because every stage class reads them directly and no accessor exists. Overlay reads mInstrument the same way. The rest are private.

The queries are const. The mangled Catcher constructor attests a const TrackData *, every stage class and Quantizer store the track in that form, and Quantizer::GetQuantum() calls GetQuant() through the const pointer.

Constructor & Destructor Documentation

◆ TrackData()

TrackData::TrackData ( int nIndex,
PlayMap * pMap )

Construct an empty track over a play map.

Parameters
nIndexThe track's index, stored in mIndex.
pMapThe play map whose last step sizes mBars.
Ghidra address:
NTSC-U/C: 0x001d35a8
Ghidra address:
PAL: 0x001d9460

◆ ~TrackData()

TrackData::~TrackData ( )

Delete every riff set and harmony the track created, then the bars.

LevelBuilder's deleter at 0x001ec328 passes an in-charge value of 3.

Ghidra address:
NTSC-U/C: 0x001d3900
Ghidra address:
PAL: 0x001d97d0

Member Function Documentation

◆ operator new()

void * TrackData::operator new ( size_t nSize)
inline

Allocate a track from the tagged heap under the tag TrackData.

No out-of-line body exists. The LevelBuilder constructor and LevelBuilder::SelectTrack() expand the call inline.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void TrackData::operator delete ( void * pBlock)
inline

Release a track to the tagged heap.

No out-of-line body exists. The deleting destructor expands the call inline.

Parameters
pBlockThe block.

◆ AddRiff()

void TrackData::AddRiff ( int nTick,
Riff * pRiff )

Give a riff a place in the riff set at a song position.

A position other than the one the current riff set was created for starts a new set. The new set is stored at that position in its bar and at offset zero in every later bar. A position at or past the end of the track is ignored.

Parameters
nTickThe song position, in MIDI ticks.
pRiffThe riff, stored at the index given by its mId.
Ghidra address:
NTSC-U/C: 0x001d3b18
Ghidra address:
PAL: 0x001d99f8

◆ AddHarmony()

void TrackData::AddHarmony ( int nTick,
const Harmony & harmony )

Start a harmony at a song position.

The harmony is stored at that position in its bar and at offset zero in every later bar. A position at or past the end of the track is ignored.

Parameters
nTickThe song position, in MIDI ticks.
harmonyThe harmony, copied onto the heap.
Ghidra address:
NTSC-U/C: 0x001d3d10
Ghidra address:
PAL: 0x001d9bf0

◆ AddGem()

void TrackData::AddGem ( int nTick,
int nGem,
Riff * pRiff )

Add a gem at a song position, with a riff set of its own when a riff is given.

A position at or past the end of the track is ignored.

Parameters
nTickThe song position, in MIDI ticks.
nGemThe gem.
pRiffThe riff, or null.
Ghidra address:
NTSC-U/C: 0x001d3ee0
Ghidra address:
PAL: 0x001d9dc0

◆ AddMidiMsg()

void TrackData::AddMidiMsg ( int nTick,
unsigned char nStatus,
unsigned char nData1,
unsigned char nData2 )

Add a StdMidiMsg built from three bytes to the bar at a song position.

The message is allocated under the message tag and inserted into Bar::mMidi at its offset in the bar. A position at or past the end of the track is ignored.

Parameters
nTickThe song position, in MIDI ticks.
nStatusThe status byte.
nData1The first data byte.
nData2The second data byte.
Ghidra address:
NTSC-U/C: 0x001d4088
Ghidra address:
PAL: 0x001d9f68

◆ AddNoteMsg()

void TrackData::AddNoteMsg ( int nTick,
unsigned char nNote,
unsigned char nVelocity,
int nLength,
unsigned char nChannel )

Add a NoteMsg built from four values to the bar at a song position.

Placed the same way as AddMidiMsg().

Parameters
nTickThe song position, in MIDI ticks.
nNoteThe note number.
nVelocityThe note-on velocity.
nLengthThe length of the note, in MIDI ticks.
nChannelThe MIDI channel.
Ghidra address:
NTSC-U/C: 0x001d41c0
Ghidra address:
PAL: 0x001da0a0

◆ ScoreBars()

void TrackData::ScoreBars ( )

Give every bar its point value and its configured word.

A track in one of the modes 1 through 3 takes a flat configured value for every bar, and any other track scores each bar from its gems. The game mode is read and discarded.

Ghidra address:
NTSC-U/C: 0x001d4308
Ghidra address:
PAL: 0x001da1e8

◆ FindGemAtOrBefore()

int TrackData::FindGemAtOrBefore ( int nTick,
int * pTick,
int * pGem ) const

Find the last gem at or before a song position, looking back into the previous bar when the position's own bar has none.

Parameters
nTickThe song position, in MIDI ticks.
pTickReceives the gem's song position.
pGemReceives the gem.
Returns
Non-zero when a gem was found.
Ghidra address:
NTSC-U/C: 0x001d4428
Ghidra address:
PAL: 0x001da308

◆ FindGemAtOrAfter()

int TrackData::FindGemAtOrAfter ( int nTick,
int * pTick,
int * pGem ) const

Find the first gem at or after a song position within mGemSearchBars bars.

Parameters
nTickThe song position, in MIDI ticks.
pTickReceives the gem's song position.
pGemReceives the gem.
Returns
Non-zero when a gem was found.
Ghidra address:
NTSC-U/C: 0x001d46f0
Ghidra address:
PAL: 0x001da5d0

◆ Print()

void TrackData::Print ( std::ostream & stream)

Write the track and every bar to a diagnostic stream.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x001d4978
Ghidra address:
PAL: 0x001da858

◆ Locate() [1/2]

void TrackData::Locate ( int nTick,
Bar *& pBar,
Sch::Tick & offset )

Split a song position into its bar and the offset within the bar.

Parameters
nTickThe song position, in MIDI ticks.
pBarReceives the bar.
offsetReceives the offset within the bar.
Ghidra address:
NTSC-U/C: 0x001d4b40
Ghidra address:
PAL: 0x001daa20

◆ LocateMapped() [1/2]

void TrackData::LocateMapped ( int nTick,
const Bar *& pBar,
Sch::Tick & offset ) const

Split a song position into its bar, mapped through PlayMap::MapBar(), and the offset.

Parameters
nTickThe song position, in MIDI ticks.
pBarReceives the bar.
offsetReceives the offset within the bar.
Ghidra address:
NTSC-U/C: 0x001d4c58
Ghidra address:
PAL: 0x001dab38

◆ AddPhrases()

void TrackData::AddPhrases ( PhraseDatabase * pDatabase)

Add every gem of every phrase of a database, one phrase per step, and score each bar.

GrooveWorld's setup path is the recovered caller.

Parameters
pDatabaseThe database.
Ghidra address:
NTSC-U/C: 0x001d4d90
Ghidra address:
PAL: 0x001dac70

◆ SetQuant()

void TrackData::SetQuant ( int nTick,
int nQuant )

Set the quantisation of the bar at a song position.

A position at or past the end of the track is ignored.

Parameters
nTickThe song position, in MIDI ticks.
nQuantThe quantisation, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x001d7688
Ghidra address:
PAL: 0x001dd568

◆ SetActive()

void TrackData::SetActive ( int nTick,
int bActive )

Do nothing.

LevelBuilder::SetActive() forwards an activeness controller change here.

The title is inferred from the forwarder's callers.

Parameters
nTickThe event position, not read.
bActiveWhether the controller value was non-zero, not read.
Ghidra address:
NTSC-U/C: 0x001d7758
Ghidra address:
PAL: 0x001dd638

◆ SetOwner()

void TrackData::SetOwner ( Player * pPlayer,
int nBar ) const

Report a player for a bar to the gamer, with this track's index.

Parameters
pPlayerThe player.
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x001d7760
Ghidra address:
PAL: 0x001dd640

◆ GetHarmony()

Harmony * TrackData::GetHarmony ( int nTick) const
Parameters
nTickThe song position, in MIDI ticks.
Returns
The harmony in force at the position, or null.
Ghidra address:
NTSC-U/C: 0x001d7788
Ghidra address:
PAL: 0x001dd668

◆ GetRiff()

Riff * TrackData::GetRiff ( int nTick,
int nLevel ) const
Parameters
nTickThe song position, in MIDI ticks.
nLevelThe difficulty level.
Returns
The riff of that level in the riff set in force at the position, or null.
Ghidra address:
NTSC-U/C: 0x001d77e0
Ghidra address:
PAL: 0x001dd6c0

◆ GetRiffInMappedBar()

Riff * TrackData::GetRiffInMappedBar ( int nBar,
int nOffset,
int nLevel ) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
nOffsetThe offset within the bar.
nLevelThe difficulty level.
Returns
The riff of that level in the riff set in force at the offset, or null.
Ghidra address:
NTSC-U/C: 0x001d7858
Ghidra address:
PAL: 0x001dd738

◆ GetRiffInBar()

Riff * TrackData::GetRiffInBar ( int nBar,
int nOffset,
int nLevel ) const
Parameters
nBarThe index into mBars, not mapped.
nOffsetThe offset within the bar.
nLevelThe difficulty level.
Returns
The riff of that level in the riff set in force at the offset, or null.
Ghidra address:
NTSC-U/C: 0x001d78d0
Ghidra address:
PAL: 0x001dd7b0

◆ GetGemAt()

int TrackData::GetGemAt ( int nTick) const
Parameters
nTickThe song position, in MIDI ticks.
Returns
The gem at exactly the position, or -1.
Ghidra address:
NTSC-U/C: 0x001d7948
Ghidra address:
PAL: 0x001dd828

◆ GetQuant()

int TrackData::GetQuant ( int nBar) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The bar's quantisation.
Ghidra address:
NTSC-U/C: 0x001d79a8
Ghidra address:
PAL: 0x001dd888

◆ IsStepStart()

int TrackData::IsStepStart ( int nBar) const
Parameters
nBarThe bar.
Returns
PlayMap::IsStepStart() for the bar.
Ghidra address:
NTSC-U/C: 0x001d79d0
Ghidra address:
PAL: 0x001dd8b0

◆ StepStartBar()

int TrackData::StepStartBar ( int nBar) const
Parameters
nBarThe bar.
Returns
PlayMap::StepStartBar() for the bar.
Ghidra address:
NTSC-U/C: 0x001d79f0
Ghidra address:
PAL: 0x001dd8d0

◆ NextStepBar()

int TrackData::NextStepBar ( int nBar) const
Parameters
nBarThe bar.
Returns
PlayMap::NextStepBar() for the bar.
Ghidra address:
NTSC-U/C: 0x001d7a10
Ghidra address:
PAL: 0x001dd8f0

◆ FollowingStepBar()

int TrackData::FollowingStepBar ( int nBar) const
Parameters
nBarThe bar.
Returns
PlayMap::FollowingStepBar() for the bar.
Ghidra address:
NTSC-U/C: 0x001d7a30
Ghidra address:
PAL: 0x001dd910

◆ QueryBar()

int TrackData::QueryBar ( int nBar) const

Ask the gamer about a bar, with this track's index.

Parameters
nBarThe bar.
Returns
The gamer's answer.
Ghidra address:
NTSC-U/C: 0x001d7a50
Ghidra address:
PAL: 0x001dd930

◆ GetPoints()

int TrackData::GetPoints ( int nBar) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The bar's points.
Ghidra address:
NTSC-U/C: 0x001d7a78
Ghidra address:
PAL: 0x001dd958

◆ GetJuice()

int TrackData::GetJuice ( int nBar) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The bar's mCatchPoints, the juice a capture awards.
Ghidra address:
NTSC-U/C: 0x001d7aa0
Ghidra address:
PAL: 0x001dd980

◆ GetMidiInBar()

const std::vector< TickObj< MuseMsg * > > * TrackData::GetMidiInBar ( int nBar) const
Parameters
nBarThe index into mBars, not mapped.
Returns
The bar's MIDI messages.
Ghidra address:
NTSC-U/C: 0x001d7ac8
Ghidra address:
PAL: 0x001dd9a8

◆ GetGemsInBar()

const std::vector< TickObj< int > > * TrackData::GetGemsInBar ( int nBar) const
Parameters
nBarThe index into mBars, not mapped.
Returns
The bar's gems.
Ghidra address:
NTSC-U/C: 0x001d7ae0
Ghidra address:
PAL: 0x001dd9c0

◆ GetMidi()

const std::vector< TickObj< MuseMsg * > > * TrackData::GetMidi ( int nBar) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The bar's MIDI messages.
Ghidra address:
NTSC-U/C: 0x001d7af8
Ghidra address:
PAL: 0x001dd9d8

◆ GetGems()

const std::vector< TickObj< int > > * TrackData::GetGems ( int nBar) const
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The bar's gems.
Ghidra address:
NTSC-U/C: 0x001d7b20
Ghidra address:
PAL: 0x001dda00

◆ Locate() [2/2]

void TrackData::Locate ( int nTick,
Bar *& pBar )

Find the bar of a song position, discarding the offset.

Parameters
nTickThe song position, in MIDI ticks.
pBarReceives the bar.
Ghidra address:
NTSC-U/C: 0x001d7b48
Ghidra address:
PAL: 0x001dda28

◆ LocateMapped() [2/2]

void TrackData::LocateMapped ( int nTick,
const Bar *& pBar ) const

Find the mapped bar of a song position, discarding the offset.

Parameters
nTickThe song position, in MIDI ticks.
pBarReceives the bar.
Ghidra address:
NTSC-U/C: 0x001d7b70
Ghidra address:
PAL: 0x001dda50

◆ GetBar()

void TrackData::GetBar ( int nBar,
const Bar *& pBar ) const

Find a bar by its bar number, mapped through PlayMap::MapBar().

Parameters
nBarThe bar.
pBarReceives the bar.
Ghidra address:
NTSC-U/C: 0x001d7b98
Ghidra address:
PAL: 0x001dda78

◆ FindStepIndex()

int TrackData::FindStepIndex ( int nBar) const
Parameters
nBarThe bar.
Returns
The index of the step at or before the bar, through PlayMap::FindStepIndex().
Ghidra address:
NTSC-U/C: 0x001d7bf0
Ghidra address:
PAL: 0x001ddad0

◆ Catcher

friend class Catcher
friend

◆ LevelBuilder

friend class LevelBuilder
friend

Member Data Documentation

◆ mGamer

Gamer* TrackData::mGamer

The gamer the track reports to. Not written by the constructor. +0x00

◆ mIndex

int TrackData::mIndex

The track's index. Copied into ScoreTrackGraph's first member. +0x04

◆ mChannel

unsigned char TrackData::mChannel

MIDI channel the stage sends controller changes on. +0x08

◆ mPaddingByte

unsigned char TrackData::mPaddingByte

No recovered routine accesses it. +0x09

◆ mPaddingHalf

unsigned short TrackData::mPaddingHalf

No recovered routine accesses it. +0x0a

◆ mKind

int TrackData::mKind

A TrackMode. 2 selects a NotePitcher and 3 a Scratcher. +0x0c

◆ mInstrument

int TrackData::mInstrument

Instrument index from 0 to 5.

+0x10

Overlay's constructor reads it at 0x0041d0dc through LevelData::TrackAt() and selects DRUMS, BASS, SYNTH, GUITAR, VOCAL, or FX through the jump table at 0x00819080.


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