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

Event the game passes between a MsgSource and a MsgSink. More...

#include <notemsg.h>

Inheritance diagram for NoteMsg:
Collaboration diagram for NoteMsg:

Public Member Functions

 NoteMsg ()
 Construct a message with the position and the length at kTickInfinity.
 NoteMsg (int nTick, unsigned char nChannel, unsigned char nNote, unsigned char nVelocity, Sch::Tick length)
 Report one note.
virtual Message * Clone ()
 Produce a heap copy of this message.
virtual int Type ()
 Report this message's registered identity.
virtual const char * GetName () const
 Report this message's class name.
virtual void PrintExtra (std::ostream &stream) const
 Write the message to a diagnostic stream.
virtual void saveGuts (OBStream &stream) const
 Write the three bytes and the low sixteen bits of the second position to a stream.
virtual void restoreGuts (IBStream &stream)
 Read the three bytes and the second position back from a stream.
Public Member Functions inherited from MuseMsg
 MuseMsg ()
 Start the song position at kTickInfinity.
 MuseMsg (int nTick)
 Start the song position at a tick.
MuseMsg * CloneAndShift (int nTick)
 Copy this message and move the copy to a song position.
Public Member Functions inherited from Message
void * operator new (size_t nSize)
 Allocate a message from the tagged heap under the tag MSG.
void operator delete (void *pBlock)
 Release a message to the tagged heap under the tag MSG.
virtual ~Message ()
 Vtable slot 1.
std::ostream & Print (std::ostream &stream) const
 Write this message to a diagnostic stream as {GetName() PrintExtra()}.

Static Public Member Functions

static Message * New ()
 Produce a default-constructed message on the heap.
Static Public Member Functions inherited from Message
static Message * NewMessage (int nType)
 Produce a message of the identified class through the factory list.

Public Attributes

unsigned char mChannel
 The MIDI channel.
unsigned char mNote
 The note number.
unsigned char mVelocity
 The note-on velocity.
Sch::Tick mLength
 The length of the note, in MIDI ticks.
Public Attributes inherited from MuseMsg
int mTick
 The song position, in MIDI ticks.

Static Public Attributes

static unsigned int sID
 Identity that Type() reports.

Detailed Description

Event the game passes between a MsgSource and a MsgSink.

Its RTTI descriptor is at 0x008f0000. It has MuseMsg as its one base. The object is 0x10 bytes and its vtable is at 0x00812e90. The members below are the whole of the class. No other routine in the image refers to this type by anything but its vtable. The fields through +0x07 belong to MuseMsg and are declared there.

The payload layout comes from the run of field copies in Clone(). AxePhraseMaker::OnStdMidi() builds one on its stack at 0x0019bad4 from its channel, a held note's number and velocity, and the note's clamped length, which identifies the fields. PrintExtra() writes mChannel after the label n, the label StdMidiMsg::PrintExtra() places ahead of its channel. mLength at +0x0c is a tick count, handed to Sch::Tick::Print() in place and initialised to kTickInfinity by New(). saveGuts() and restoreGuts() move only its low sixteen bits.

The destructor at 0x003dc0e8 is compiler-generated and has no declaration here.

Constructor & Destructor Documentation

◆ NoteMsg() [1/2]

NoteMsg::NoteMsg ( )
inline

Construct a message with the position and the length at kTickInfinity.

Inline. New() expands it. A declaration is required because the class declares a second constructor.

◆ NoteMsg() [2/2]

NoteMsg::NoteMsg ( int nTick,
unsigned char nChannel,
unsigned char nNote,
unsigned char nVelocity,
Sch::Tick length )
inline

Report one note.

Inline, with no address of its own. AxePhraseMaker::OnStdMidi() expands it on its stack at 0x0019bad4, and AxePhraseMaker::FinishPhrase() at 0x0019c270.

Parameters
nTickThe song position of the note-on, in MIDI ticks.
nChannelThe MIDI channel.
nNoteThe note number.
nVelocityThe note-on velocity.
lengthThe length of the note.

Member Function Documentation

◆ New()

Message * NoteMsg::New ( )
static

Produce a default-constructed message on the heap.

The translation unit at 0x003d9818 registers this factory.

Returns
The message.
Ghidra address:
NTSC-U/C: 0x003d6d80
Ghidra address:
PAL: 0x0040ec70

◆ Clone()

virtual Message * NoteMsg::Clone ( )
virtual

Produce a heap copy of this message.

Returns
The copy.
Ghidra address:
NTSC-U/C: 0x003dc208
Ghidra address:
PAL: 0x00414640

Implements Message.

◆ Type()

virtual int NoteMsg::Type ( )
virtual

Report this message's registered identity.

Returns
sID.
Ghidra address:
NTSC-U/C: 0x003dc280
Ghidra address:
PAL: 0x004146b8

Implements Message.

◆ GetName()

virtual const char * NoteMsg::GetName ( ) const
virtual

Report this message's class name.

Returns
The literal NoteMsg.
Ghidra address:
NTSC-U/C: 0x003dc290
Ghidra address:
PAL: 0x004146c8

Implements Message.

◆ PrintExtra()

virtual void NoteMsg::PrintExtra ( std::ostream & stream) const
virtual

Write the message to a diagnostic stream.

Writes the song position, both data bytes as numbers, the second position, and the byte at +0x08 after n.

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

Reimplemented from Message.

◆ saveGuts()

virtual void NoteMsg::saveGuts ( OBStream & stream) const
virtual

Write the three bytes and the low sixteen bits of the second position to a stream.

The bytes go one at a time through OBStream::Write() and the position through OBStream::WriteLE(). The song position MuseMsg provides is not written.

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

Reimplemented from Message.

◆ restoreGuts()

virtual void NoteMsg::restoreGuts ( IBStream & stream)
virtual

Read the three bytes and the second position back from a stream.

The position arrives as an unsigned sixteen-bit value and is widened into the member.

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

Reimplemented from Message.

Member Data Documentation

◆ sID

unsigned int NoteMsg::sID
static

Identity that Type() reports.

Ghidra address:
NTSC-U/C: 0x006d01cc
Ghidra address:
PAL: 0x00713964

◆ mChannel

unsigned char NoteMsg::mChannel

The MIDI channel.

+0x08

Public because MuseSynth::StartNotePlayer() at 0x001aa6bc reads it directly.

◆ mNote

unsigned char NoteMsg::mNote

The note number.

+0x09

Public because RiffRangeFinder::DispatchPriv() at 0x001c4574 reads it directly with lbu, with no accessor in the image, widening its range of notes to include it.

◆ mVelocity

unsigned char NoteMsg::mVelocity

The note-on velocity.

+0x0a

Public because MuseSynth::StartNotePlayer() at 0x001aa6c8 reads it directly.

◆ mLength

Sch::Tick NoteMsg::mLength

The length of the note, in MIDI ticks.

+0x0c

Public because NoteFinder::DispatchPriv() at 0x001023b0 reads it directly with no accessor in the image, adding it to the inherited mTick to find where the note ends.


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