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

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

#include <stdmidimsg.h>

Inheritance diagram for StdMidiMsg:
Collaboration diagram for StdMidiMsg:

Public Member Functions

 StdMidiMsg ()
 Construct a message with the song position at kTickInfinity and the three bytes unset.
 StdMidiMsg (int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2)
 Construct one channel message at a song position.
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 to a stream, one byte each through OBStream::Write().
virtual void restoreGuts (IBStream &stream)
 Read the three bytes back in place, one byte each through IBStream::Read().
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 mStatus
 The three bytes of one Standard MIDI channel message.
unsigned char mData1
unsigned char mData2
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 0x008ef3f0. It has MuseMsg as its one base. The object is 0xc bytes and its vtable is at 0x00812ed8. 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(), so the offsets and widths are recovered but the purpose of each field is not. Readers of the fields have not been traced, so they are private by default.

Clone() copies only as far as 0xb of the 0xc bytes it allocates, so the remaining 1 are either alignment padding or a field the copy omits.

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

Constructor & Destructor Documentation

◆ StdMidiMsg() [1/2]

StdMidiMsg::StdMidiMsg ( )
inline

Construct a message with the song position at kTickInfinity and the three bytes unset.

Inline. New() and the Mixer's stack builds expand it. A declaration is required because the class declares a second constructor.

◆ StdMidiMsg() [2/2]

StdMidiMsg::StdMidiMsg ( int nTick,
unsigned char nStatus,
unsigned char nData1,
unsigned char nData2 )
inline

Construct one channel message at a song position.

Inline, with no address of its own. NotePlayer::NoteOn() at 0x001b3fb8 expands it on its stack, storing the position and then the three bytes in order.

Parameters
nTickThe song position, in MIDI ticks.
nStatusThe status byte.
nData1The first data byte.
nData2The second data byte.

Member Function Documentation

◆ New()

Message * StdMidiMsg::New ( )
static

Produce a default-constructed message on the heap.

The translation unit at 0x003d9818 registers this factory. Only the song position is initialised, by the MuseMsg constructor, and the three bytes are left unset.

Returns
The message.
Ghidra address:
NTSC-U/C: 0x003d6d40
Ghidra address:
PAL: 0x0040ec30

◆ Clone()

virtual Message * StdMidiMsg::Clone ( )
virtual

Produce a heap copy of this message.

Returns
The copy.
Ghidra address:
NTSC-U/C: 0x003dbfa0
Ghidra address:
PAL: 0x004143d8

Implements Message.

◆ Type()

virtual int StdMidiMsg::Type ( )
virtual

Report this message's registered identity.

Returns
sID.
Ghidra address:
NTSC-U/C: 0x003dc010
Ghidra address:
PAL: 0x00414448

Implements Message.

◆ GetName()

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

Report this message's class name.

Returns
The literal StdMidiMsg.
Ghidra address:
NTSC-U/C: 0x003dc020
Ghidra address:
PAL: 0x00414458

Implements Message.

◆ PrintExtra()

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

Write the message to a diagnostic stream.

Writes the song position, a short label for the kind in the status byte's high nibble, both data bytes as numbers, and the channel from its low nibble after n. The labels are off, on, poly, ctl, prg, pres, pb, and sys for the kinds 0x80 through 0xf0 in order.

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

Reimplemented from Message.

◆ saveGuts()

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

Write the three bytes to a stream, one byte each through OBStream::Write().

The song position is not written.

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

Reimplemented from Message.

◆ restoreGuts()

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

Read the three bytes back in place, one byte each through IBStream::Read().

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

Reimplemented from Message.

Member Data Documentation

◆ sID

unsigned int StdMidiMsg::sID
static

Identity that Type() reports.

Ghidra address:
NTSC-U/C: 0x006d01c4
Ghidra address:
PAL: 0x0071395c

◆ mStatus

unsigned char StdMidiMsg::mStatus

The three bytes of one Standard MIDI channel message.

+0x08, +0x09, and +0x0a

Public because SynthSustainer reads the first two through a StdMidiMsg pointer from outside the hierarchy at 0x001d20f8 and 0x001d2100, and the image exposes no accessor. A friend declaration fits equally well.

The first byte is the status, a message kind in its high nibble over a channel in its low one, which four inlined constructions in the sequencer confirm by composing it as a kind combined with a channel. The two that follow are the data bytes, and their meaning depends on that kind: a control-change status makes them a controller number and a value, while a note status makes the first a note number. Their titles use the MIDI specification's terms, the first and second data bytes, because a single meaning for either would be wrong.

◆ mData1

unsigned char StdMidiMsg::mData1

◆ mData2

unsigned char StdMidiMsg::mData2

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