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

Accumulator a MIDI conversion fills, and the one implementation of LevelData. More...

#include <levelbuilder.h>

Inheritance diagram for LevelBuilder:
Collaboration diagram for LevelBuilder:

Public Member Functions

 LevelBuilder (unsigned nTrackCount)
 Construct an empty builder.
virtual ~LevelBuilder ()
virtual int TrackCount ()
virtual int BackingTrackCount ()
virtual TrackData * OwnTrack ()
virtual TrackData * TrackAt (int nIndex)
 Return one track.
virtual TrackData * BackingTrackAt (int nIndex)
 Return one backing track.
virtual Sch::TempoMap * GetTempoMap ()
virtual PlayMap * GetPlayMap ()
virtual int GetEndBar ()
 Report the play map's extent.
TrackData * GetTrack (int nIndex)
 Return one gameplay track, without dispatch.
void SelectTrack (int nKind, int nIndex)
 Make one track the current track, creating it on first use.
void Print (std::ostream &stream)
 Write every track of the three collections to a diagnostic stream.
void SetBarCount (int nBarCount)
 Forward a bar count to PlayMap::SetBarCount().
TrackData * IntroTrackAt (int nIndex)
 Return one intro track.
void SetChannel (unsigned char nChannel)
 Set the MIDI channel of the current track.
void SetKind (int nKind)
 Set the TrackMode of the current track.
void SetInstrument (int nInstrument, const HxStr &name)
 Set the instrument index and the name of the current track.
void AddEvent (int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2, unsigned char nChannel)
 Append one MIDI event to the current track.
void AddNoteMsg (int nTick, unsigned char nNote, unsigned char nVelocity, int nLength, unsigned char nChannel)
 Forward to TrackData::AddNoteMsg() on the current track.
void SetQuant (int nTick, int nQuant)
 Forward to TrackData::SetQuant() on the current track.
void AddRiff (int nTick, Riff *pRiff)
 Forward to TrackData::AddRiff() on the current track.
void AddGem (int nTick, int nGem, Riff *pRiff)
 Forward to TrackData::AddGem() on the current track.
void AddHarmony (int nTick, const Harmony &harmony)
 Start a harmony on the current track.
void SetActive (int nTick, int bActive)
 Forward an activeness change to TrackData::SetActive() on the current track.
void AddTempo (int nTick, int nMicrosecondsPerQuarter)
 Replace the tempo map at +0x30 with one built from a tempo meta event.
void DoneLoading ()
 Run TrackData::ScoreBars() on every score track.
Public Member Functions inherited from LevelData
virtual ~LevelData ()

Public Attributes

std::vector< TrackData * > mIntroTracks
 The intro tracks.

Detailed Description

Accumulator a MIDI conversion fills, and the one implementation of LevelData.

Its RTTI descriptor is at 0x008efc40. It has LevelData as its one base at offset 0. Its table is at 0x007e79f8 and has ten entries with a zero terminator at index 10, the same length as the base table. The class adds no virtual. It implements all eight of LevelData's pure slots and supplies the destructor.

LevelConverter drives it. LevelConverter::Convert() stores the builder at its own +0x50, each MIDI event handler forwards to AddEvent() with the status byte for the event, and LevelConverter::Tempo() forwards to AddTempo().

The object is at least 0x38 bytes. Three vectors of pointers occupy +0x04 through +0x27, and the destructor clears each one with a std::for_each over the deleting function at 0x001ec328, so all three manage their elements. That function deletes a TrackData, which is what fixes the element type of all three. The two scalars at +0x30 and +0x34 are managed as well, the first through Attachment::Release() and the second through its own table slot 1.

The forwarding members below all reach the object at +0x2c, which the destructor does not release. That object is the one the conversion appends to, and its routines sit in the same address range as TrackData's own destructor and appenders, so it is a TrackData.

Every method name here is inferred from the body behind it.

Constructor & Destructor Documentation

◆ LevelBuilder()

LevelBuilder::LevelBuilder ( unsigned nTrackCount)
explicit

Construct an empty builder.

It creates the tempo map at mTempoMap at 500000 microseconds per quarter note and the PlayMapLinear at mPlayMap. The map takes its steps and labels from configuration codes 0x396 and 0x3a0 and its sections from code 0x39d. The builder then creates nTrackCount score tracks, and runs PlayMap::StartLoop() with bar 0xe when code 0x3a1 is set. GrooveWorld::StartLoad() passes the configuration value the query at 0x00509110 reports for the identifier 0x384.

Parameters
nTrackCountThe number of tracks to prepare for.
Ghidra address:
NTSC-U/C: 0x001ea838
Ghidra address:
PAL: 0x001f0aa8

◆ ~LevelBuilder()

virtual LevelBuilder::~LevelBuilder ( )
virtual
Ghidra address:
NTSC-U/C: 0x001eafe8
Ghidra address:
PAL: 0x001f1270

Member Function Documentation

◆ TrackCount()

virtual int LevelBuilder::TrackCount ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ec430
Ghidra address:
PAL: 0x001f26b8

Implements LevelData.

◆ BackingTrackCount()

virtual int LevelBuilder::BackingTrackCount ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ec448
Ghidra address:
PAL: 0x001f26d0

Implements LevelData.

◆ OwnTrack()

virtual TrackData * LevelBuilder::OwnTrack ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ec6d0
Ghidra address:
PAL: 0x001f2958

Implements LevelData.

◆ TrackAt()

virtual TrackData * LevelBuilder::TrackAt ( int nIndex)
virtual

Return one track.

The index is not tested against the collection.

Ghidra address:
NTSC-U/C: 0x001ec6f0
Ghidra address:
PAL: 0x001f2978

Implements LevelData.

◆ BackingTrackAt()

virtual TrackData * LevelBuilder::BackingTrackAt ( int nIndex)
virtual

Return one backing track.

The index is not tested against the collection.

Ghidra address:
NTSC-U/C: 0x001ec708
Ghidra address:
PAL: 0x001f2990

Implements LevelData.

◆ GetTempoMap()

virtual Sch::TempoMap * LevelBuilder::GetTempoMap ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ec478
Ghidra address:
PAL: 0x001f2700

Implements LevelData.

◆ GetPlayMap()

virtual PlayMap * LevelBuilder::GetPlayMap ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ec480
Ghidra address:
PAL: 0x001f2708

Implements LevelData.

◆ GetEndBar()

virtual int LevelBuilder::GetEndBar ( )
virtual

Report the play map's extent.

Returns
PlayMap::GetLength() of the play map.
Ghidra address:
NTSC-U/C: 0x001ec738
Ghidra address:
PAL: 0x001f29c0

Implements LevelData.

◆ GetTrack()

TrackData * LevelBuilder::GetTrack ( int nIndex)

Return one gameplay track, without dispatch.

The body is the same as TrackAt(), but the member is not virtual. GrooveWorld calls it directly at 0x0018d284, 0x0018d714, and 0x0018df64. The title is inferred.

Parameters
nIndexThe position in mTracks.
Returns
The track.
Ghidra address:
NTSC-U/C: 0x001ec6d8
Ghidra address:
PAL: 0x001f2960

◆ SelectTrack()

void LevelBuilder::SelectTrack ( int nKind,
int nIndex )

Make one track the current track, creating it on first use.

A score track must already exist. A backing or intro collection grows to include nIndex. An empty slot, like an absent own track, receives a new TrackData with the index -1 over the play map at mPlayMap. The title is inferred.

Parameters
nKindThe collection, a LevelTrackKind.
nIndexThe position in the collection. The none and own kinds do not read it.
Ghidra address:
NTSC-U/C: 0x001eb200
Ghidra address:
PAL: 0x001f1488

◆ Print()

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

Write every track of the three collections to a diagnostic stream.

Each track is introduced by its collection's label, its position, and a colon. The routine has no caller in the image.

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

◆ SetBarCount()

void LevelBuilder::SetBarCount ( int nBarCount)

Forward a bar count to PlayMap::SetBarCount().

GrooveWorld::BuildGraphs() at 0x0018cd44 passes zero. The title is inferred.

Parameters
nBarCountThe value stored in the play map's bar count.
Ghidra address:
NTSC-U/C: 0x001ec498
Ghidra address:
PAL: 0x001f2720

◆ IntroTrackAt()

TrackData * LevelBuilder::IntroTrackAt ( int nIndex)

Return one intro track.

The index is not tested against the collection. GrooveWorld::BuildGraphs() at 0x0018d22c is the caller. The title is inferred.

Parameters
nIndexThe position in mIntroTracks.
Returns
The track, or null for a slot SelectTrack() passed over.
Ghidra address:
NTSC-U/C: 0x001ec720
Ghidra address:
PAL: 0x001f29a8

◆ SetChannel()

void LevelBuilder::SetChannel ( unsigned char nChannel)

Set the MIDI channel of the current track.

Parameters
nChannelThe channel.
Ghidra address:
NTSC-U/C: 0x001ec488
Ghidra address:
PAL: 0x001f2710

◆ SetKind()

void LevelBuilder::SetKind ( int nKind)

Set the TrackMode of the current track.

Parameters
nKindThe TrackMode.
Ghidra address:
NTSC-U/C: 0x001ec5c0
Ghidra address:
PAL: 0x001f2848

◆ SetInstrument()

void LevelBuilder::SetInstrument ( int nInstrument,
const HxStr & name )

Set the instrument index and the name of the current track.

Parameters
nInstrumentThe instrument index.
nameThe track name, copied.
Ghidra address:
NTSC-U/C: 0x001ec5d0
Ghidra address:
PAL: 0x001f2858

◆ AddEvent()

void LevelBuilder::AddEvent ( int nTick,
unsigned char nStatus,
unsigned char nData1,
unsigned char nData2,
unsigned char nChannel )

Append one MIDI event to the current track.

The status and the channel arrive separately and the body combines them with a bitwise or before forwarding to TrackData::AddMidiMsg().

Parameters
nTickThe event position, in MIDI ticks.
nStatusThe MIDI status byte without its channel, 0x80 through 0xe0.
nData1The first data byte.
nData2The second data byte, or zero for a one-byte event.
nChannelThe channel, which the body ors into the status.
Ghidra address:
NTSC-U/C: 0x001ec4c8
Ghidra address:
PAL: 0x001f2750

◆ AddNoteMsg()

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

Forward to TrackData::AddNoteMsg() on the current track.

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: 0x001ec4f8
Ghidra address:
PAL: 0x001f2780

◆ SetQuant()

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

Forward to TrackData::SetQuant() on the current track.

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

◆ AddRiff()

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

Forward to TrackData::AddRiff() on the current track.

Parameters
nTickThe song position, in MIDI ticks.
pRiffThe riff.
Ghidra address:
NTSC-U/C: 0x001ec540
Ghidra address:
PAL: 0x001f27c8

◆ AddGem()

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

Forward to TrackData::AddGem() on the current track.

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

◆ AddHarmony()

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

Start a harmony on the current track.

Forwards to TrackData::AddHarmony() on mCurrentTrack. LevelConverter calls it at 0x001e6a60 and 0x001e7b04 with the harmony at its +0x7c.

Parameters
nTickThe song position, in MIDI ticks.
harmonyThe harmony, copied by the track.
Ghidra address:
NTSC-U/C: 0x001ec560
Ghidra address:
PAL: 0x001f27e8

◆ SetActive()

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

Forward an activeness change to TrackData::SetActive() on the current track.

LevelConverter::Controller() calls it for controller 0x6a with whether the value is non-zero, and LevelConverter::EndTrack() calls it with two zeroes. The title is inferred.

Parameters
nTickThe event position, in MIDI ticks.
bActiveWhether the controller value was non-zero.
Ghidra address:
NTSC-U/C: 0x001ec580
Ghidra address:
PAL: 0x001f2808

◆ AddTempo()

void LevelBuilder::AddTempo ( int nTick,
int nMicrosecondsPerQuarter )

Replace the tempo map at +0x30 with one built from a tempo meta event.

The body releases the map already there, allocates 0x28 bytes, and constructs a Sch::TempoMap from the tempo. The one caller, LevelConverter::Tempo() at 0x001ea570, passes its own two arguments through in the registers they arrive in.

Parameters
nTickThe event position. No instruction in the body reads it.
nMicrosecondsPerQuarterThe tempo the map is constructed from.
Ghidra address:
NTSC-U/C: 0x001ec5f8
Ghidra address:
PAL: 0x001f2880

◆ DoneLoading()

void LevelBuilder::DoneLoading ( )

Run TrackData::ScoreBars() on every score track.

LevelConverter::Convert() calls it once the reader has been built and before the file is read.

Ghidra address:
NTSC-U/C: 0x001ec680
Ghidra address:
PAL: 0x001f2908

Member Data Documentation

◆ mIntroTracks

std::vector<TrackData *> LevelBuilder::mIntroTracks

The intro tracks.

+0x1c

No slot of LevelData reads this collection. Public because GrooveWorld::BuildGraphs() reads its size directly as a loop bound at 0x0018d198, and the image has no accessor.


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