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

Store of one phrase per step of a play map, and one jam effect mask per step. More...

#include <phrasedatabase.h>

Inheritance diagram for PhraseDatabase:
Collaboration diagram for PhraseDatabase:

Public Member Functions

void * operator new (size_t nSize)
 Allocate a database from the tagged heap under the tag PhraseDatabase.
void operator delete (void *pBlock)
 Release a database to the tagged heap.
 PhraseDatabase (PlayMap *pMap)
 Construct an empty database over a play map.
virtual ~PhraseDatabase ()
 Release every phrase.
void SetOwners (Player *pPlayer)
 Give every step a phrase owned by one player, creating the phrases that do not exist yet.
void Save (OBStream &stream)
 Write the database behind a version byte of 1.
void Load (IBStream &stream)
 Read the database back after releasing its contents.
void Clear ()
 Release every phrase and zero every value.
void ClearOwners ()
 Return every existing phrase to the stand-in player, logging entry and exit on the console.
Phrase * GetPhraseAt (int nBar)
Phrase * GetPhrase (int nIndex)
void SetPhraseAt (Phrase *pPhrase, int nTick)
 Store a phrase at the step the play map places a song position in.
void SetPhrase (Phrase *pPhrase, int nIndex)
 Store a phrase at a step, releasing the phrase it replaces and taking a reference.
void ClearPhraseAt (int nTick)
 Release the phrase at the step the play map places a song position in.
void ClearPhrase (int nIndex)
 Release the phrase at a step.
void SetOwnerAt (Player *pPlayer, int nTick)
 Give the phrase at the step the play map places a song position in an owner.
void SetOwner (Player *pPlayer, int nIndex)
 Give the phrase at a step an owner, creating the phrase when the step has none.
Player * GetOwner (int nIndex)
void SetPhraseByte (int nIndex, char cValue)
 Set Phrase::mScore of the phrase at a step, when the step has one.
unsigned char GetPhraseByte (int nIndex)
long long * GetStepValue (int nBar)
void Print (std::ostream &stream)
 Write every phrase to a diagnostic stream, eight to a line, with [null] for an empty step.
Public Member Functions inherited from MsgSource
virtual ~MsgSource ()
virtual void AddSink (MsgSink *pSink)
 Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink (MsgSink *pSink)
 Unregister the first occurrence of a sink.
void Send (Message *pMsg) const
 Deliver a message to every registered sink, in registration order.
void ClearSinks ()
 Unregister every sink.

Additional Inherited Members

Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.

Detailed Description

Store of one phrase per step of a play map, and one jam effect mask per step.

It has MsgSource as its one base. The object is 0x30 bytes: the MsgSource subobject over +0x00 through +0x13, then the three members below. Its vtable at 0x007e1db0 runs four entries (the type function, the destructor, and the retained MsgSource::AddSink() and MsgSource::RemoveSink()). The class declares no virtual beyond the destructor.

The constructor sizes the phrase vector to the last step of the play map and the mask vector to one less than the step count. A phrase is addressed either by index or by a song position, which PlayMap::MapBar() maps to an index.

Every member is private. Only this class's routines address them.

Constructor & Destructor Documentation

◆ PhraseDatabase()

PhraseDatabase::PhraseDatabase ( PlayMap * pMap)

Construct an empty database over a play map.

Parameters
pMapThe play map whose steps size both vectors.
Ghidra address:
NTSC-U/C: 0x001b72d8
Ghidra address:
PAL: 0x001bd0b0

◆ ~PhraseDatabase()

virtual PhraseDatabase::~PhraseDatabase ( )
virtual

Release every phrase.

Ghidra address:
NTSC-U/C: 0x001b75e8
Ghidra address:
PAL: 0x001bd3c0

Member Function Documentation

◆ operator new()

void * PhraseDatabase::operator new ( size_t nSize)

Allocate a database from the tagged heap under the tag PhraseDatabase.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.
Ghidra address:
NTSC-U/C: 0x001b8cc8
Ghidra address:
PAL: 0x001beaa0

◆ operator delete()

void PhraseDatabase::operator delete ( void * pBlock)

Release a database to the tagged heap.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x001b8ce8
Ghidra address:
PAL: 0x001beac0

◆ SetOwners()

void PhraseDatabase::SetOwners ( Player * pPlayer)

Give every step a phrase owned by one player, creating the phrases that do not exist yet.

Parameters
pPlayerThe owner.
Ghidra address:
NTSC-U/C: 0x001b77a0
Ghidra address:
PAL: 0x001bd578

◆ Save()

void PhraseDatabase::Save ( OBStream & stream)

Write the database behind a version byte of 1.

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

◆ Load()

void PhraseDatabase::Load ( IBStream & stream)

Read the database back after releasing its contents.

The version byte is read and ignored. Neither vector is resized, so the stream is trusted to match the play map.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x001b7a28
Ghidra address:
PAL: 0x001bd800

◆ Clear()

void PhraseDatabase::Clear ( )

Release every phrase and zero every value.

Ghidra address:
NTSC-U/C: 0x001b8d60
Ghidra address:
PAL: 0x001beb38

◆ ClearOwners()

void PhraseDatabase::ClearOwners ( )

Return every existing phrase to the stand-in player, logging entry and exit on the console.

The routine writes its own name in both log lines.

Ghidra address:
NTSC-U/C: 0x001b8dc8
Ghidra address:
PAL: 0x001beba0

◆ GetPhraseAt()

Phrase * PhraseDatabase::GetPhraseAt ( int nBar)
Parameters
nBarThe bar, mapped through PlayMap::MapBar().
Returns
The phrase of the mapped bar, or null.
Ghidra address:
NTSC-U/C: 0x001b8e50
Ghidra address:
PAL: 0x001bec28

◆ GetPhrase()

Phrase * PhraseDatabase::GetPhrase ( int nIndex)
Parameters
nIndexThe step.
Returns
The phrase of the step, or null.
Ghidra address:
NTSC-U/C: 0x001b8e98
Ghidra address:
PAL: 0x001bec70

◆ SetPhraseAt()

void PhraseDatabase::SetPhraseAt ( Phrase * pPhrase,
int nTick )

Store a phrase at the step the play map places a song position in.

Parameters
pPhraseThe phrase, or null.
nTickThe song position, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x001b8eb0
Ghidra address:
PAL: 0x001bec88

◆ SetPhrase()

void PhraseDatabase::SetPhrase ( Phrase * pPhrase,
int nIndex )

Store a phrase at a step, releasing the phrase it replaces and taking a reference.

Parameters
pPhraseThe phrase, or null.
nIndexThe step.
Ghidra address:
NTSC-U/C: 0x001b8f08
Ghidra address:
PAL: 0x001bece0

◆ ClearPhraseAt()

void PhraseDatabase::ClearPhraseAt ( int nTick)

Release the phrase at the step the play map places a song position in.

Parameters
nTickThe song position, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x001b8f78
Ghidra address:
PAL: 0x001bed50

◆ ClearPhrase()

void PhraseDatabase::ClearPhrase ( int nIndex)

Release the phrase at a step.

Parameters
nIndexThe step.
Ghidra address:
NTSC-U/C: 0x001b8fc0
Ghidra address:
PAL: 0x001bed98

◆ SetOwnerAt()

void PhraseDatabase::SetOwnerAt ( Player * pPlayer,
int nTick )

Give the phrase at the step the play map places a song position in an owner.

Parameters
pPlayerThe owner.
nTickThe song position, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x001b9018
Ghidra address:
PAL: 0x001bedf0

◆ SetOwner()

void PhraseDatabase::SetOwner ( Player * pPlayer,
int nIndex )

Give the phrase at a step an owner, creating the phrase when the step has none.

Parameters
pPlayerThe owner.
nIndexThe step.
Ghidra address:
NTSC-U/C: 0x001b9070
Ghidra address:
PAL: 0x001bee48

◆ GetOwner()

Player * PhraseDatabase::GetOwner ( int nIndex)
Parameters
nIndexThe step.
Returns
The owner of the phrase at the step, or the stand-in player when the step has none.
Ghidra address:
NTSC-U/C: 0x001b9130
Ghidra address:
PAL: 0x001bef08

◆ SetPhraseByte()

void PhraseDatabase::SetPhraseByte ( int nIndex,
char cValue )

Set Phrase::mScore of the phrase at a step, when the step has one.

Parameters
nIndexThe step.
cValueThe score.
Ghidra address:
NTSC-U/C: 0x001b9158
Ghidra address:
PAL: 0x001bef30

◆ GetPhraseByte()

unsigned char PhraseDatabase::GetPhraseByte ( int nIndex)
Parameters
nIndexThe step.
Returns
Phrase::mScore of the phrase at the step, or zero when the step has none.
Ghidra address:
NTSC-U/C: 0x001b9178
Ghidra address:
PAL: 0x001bef50

◆ GetStepValue()

long long * PhraseDatabase::GetStepValue ( int nBar)
Parameters
nBarThe bar.
Returns
The jam effect mask of the step at or before the bar PlayMap::MapBar() maps nBar to.
Ghidra address:
NTSC-U/C: 0x001b91a0
Ghidra address:
PAL: 0x001bef78

◆ Print()

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

Write every phrase to a diagnostic stream, eight to a line, with [null] for an empty step.

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

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