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

Owner of the players that are sounding, and the sink that starts them. More...

#include <musesynth.h>

Inheritance diagram for MuseSynth:
Collaboration diagram for MuseSynth:

Public Member Functions

 MuseSynth (Sch::TickClock *pClock)
virtual ~MuseSynth ()
 Release every player and then the splitter.
void AddSink (MsgSink *pSink)
 Register a sink with the splitter every player sends to.
void CreateSustainer ()
 Build the sustain filter this synthesiser feeds through.
virtual void RetainOnly (MusePlayer *pPlayer)
virtual void PlayerFinished (MusePlayer *pPlayer)
int IsActive () const
 Report whether any player is sounding.
void ReleaseAllPlayers ()
 Stop and release every player.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the tagged heap under the tag "MsgSink".
void operator delete (void *pBlock)
 Release a sink to the tagged heap.
virtual ~MsgSink ()
virtual void Dispatch (Message *pMsg)
 Accept a message.

Protected Member Functions

void StartNotePlayer (Message *pMsg)
 Start a note player for one NoteMsg.
void StartMultiMusePlayer (Message *pMsg)
 Start a MultiMusePlayer for one MultiMuseMsg.
virtual void DispatchPriv (Message *pMsg)
 Act on a message.
void OnAllNotesOff ()
 The out-of-line copy of the AllNotesOffMsg branch DispatchPriv() expands inline.
void OnStdMidi (StdMidiMsg *pMsg)
 The out-of-line copy of the StdMidiMsg branch DispatchPriv() expands inline.
void OnSustainNote (SustainNoteMsg *pMsg)
 The out-of-line copy of the SustainNoteMsg branch DispatchPriv() expands inline.

Protected Attributes

Sch::TickClock * mClock
MsgSplitter mSplitter
SynthSustainer * mSustainer
MsgSink * mOutput
std::list< MusePlayer * > mPlayers

Detailed Description

Owner of the players that are sounding, and the sink that starts them.

Its RTTI descriptor is at 0x00902290. It has MsgSink at offset 0 and MuseParent at offset 4. MultiMusePlayer's MusePlayer base at offset 48 confirms the object size of 0x30 bytes. Its primary table is at 0x007e0008 and its MuseParent table at 0x007dffe8.

It is a MsgSink that creates a player per message. A NoteMsg creates a 0x20-byte NotePlayer through the constructor at 0x001b4328, a MultiMuseMsg creates a MultiMusePlayer, and an AllNotesOffMsg releases every player. A StdMidiMsg or a SustainNoteMsg is instead forwarded straight to mOutput, so a message that needs no scheduling bypasses the player list. Every other message is discarded.

Every player it creates is started against mOutput, which addresses its own embedded MsgSplitter, or the sustainer CreateSustainer() places in front of it. AddSink() registers a sink with that splitter, so a caller that wants the sound registers once here rather than with each player.

The name comes from the RTTI descriptor.

Constructor & Destructor Documentation

◆ MuseSynth()

MuseSynth::MuseSynth ( Sch::TickClock * pClock)
Parameters
pClockThe clock every player it creates is scheduled against.
Ghidra address:
NTSC-U/C: 0x001aa4d8
Ghidra address:
PAL: 0x001b0240

◆ ~MuseSynth()

virtual MuseSynth::~MuseSynth ( )
virtual

Release every player and then the splitter.

Ghidra address:
NTSC-U/C: 0x001aa5d8
Ghidra address:
PAL: 0x001b0340

Member Function Documentation

◆ AddSink()

void MuseSynth::AddSink ( MsgSink * pSink)

Register a sink with the splitter every player sends to.

Parameters
pSinkThe sink to register.
Ghidra address:
NTSC-U/C: 0x001ab038
Ghidra address:
PAL: 0x001b0da0

◆ CreateSustainer()

void MuseSynth::CreateSustainer ( )

Build the sustain filter this synthesiser feeds through.

The routine allocates a SynthSustainer under the tag MsgSink, stores it at both +0x24 and +0x28, and points its downstream sink at this object's +0x0c. AxingSTG is the only caller. The title is inferred from that body.

Ghidra address:
NTSC-U/C: 0x001aafb0
Ghidra address:
PAL: 0x001b0d18

◆ RetainOnly()

virtual void MuseSynth::RetainOnly ( MusePlayer * pPlayer)
virtual
Ghidra address:
NTSC-U/C: 0x001aa908
Ghidra address:
PAL: 0x001b0670

Implements MuseParent.

Reimplemented in MultiMusePlayer.

◆ PlayerFinished()

virtual void MuseSynth::PlayerFinished ( MusePlayer * pPlayer)
virtual
Ghidra address:
NTSC-U/C: 0x001aa9f0
Ghidra address:
PAL: 0x001b0758

Implements MuseParent.

Reimplemented in MultiMusePlayer.

◆ IsActive()

int MuseSynth::IsActive ( ) const

Report whether any player is sounding.

The body counts the nodes of mPlayers. The image has no caller.

Returns
Non-zero while mPlayers is not empty.
Ghidra address:
NTSC-U/C: 0x001aaf68
Ghidra address:
PAL: 0x001b0cd0

◆ ReleaseAllPlayers()

void MuseSynth::ReleaseAllPlayers ( )

Stop and release every player.

Ghidra address:
NTSC-U/C: 0x001ab0d8
Ghidra address:
PAL: 0x001b0e40

◆ StartNotePlayer()

void MuseSynth::StartNotePlayer ( Message * pMsg)
protected

Start a note player for one NoteMsg.

Creates a 0x20-byte NotePlayer from the message's three payload bytes and its word at +0x0c, stores it, and starts it against mOutput.

Parameters
pMsgThe NoteMsg.
Ghidra address:
NTSC-U/C: 0x001aa690
Ghidra address:
PAL: 0x001b03f8

◆ StartMultiMusePlayer()

void MuseSynth::StartMultiMusePlayer ( Message * pMsg)
protected

Start a MultiMusePlayer for one MultiMuseMsg.

Creates a 0x50-byte MultiMusePlayer over the message's sequence, stores its MusePlayer subobject, and starts it against mOutput. A null player is stored as a null pointer rather than as the fixed subobject displacement, which is the compiler's own null check on the base-class conversion.

Parameters
pMsgThe MultiMuseMsg.
Ghidra address:
NTSC-U/C: 0x001aa7c0
Ghidra address:
PAL: 0x001b0528

◆ DispatchPriv()

virtual void MuseSynth::DispatchPriv ( Message * pMsg)
protectedvirtual

Act on a message.

Primary table slot 3. MultiMusePlayer retains this body unchanged.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x001ab170
Ghidra address:
PAL: 0x001b0ed8

Implements MsgSink.

◆ OnAllNotesOff()

void MuseSynth::OnAllNotesOff ( )
protected

The out-of-line copy of the AllNotesOffMsg branch DispatchPriv() expands inline.

The message is not read.

Ghidra address:
NTSC-U/C: 0x001ab0b8
Ghidra address:
PAL: 0x001b0e20

◆ OnStdMidi()

void MuseSynth::OnStdMidi ( StdMidiMsg * pMsg)
protected

The out-of-line copy of the StdMidiMsg branch DispatchPriv() expands inline.

Ghidra address:
NTSC-U/C: 0x001ab058
Ghidra address:
PAL: 0x001b0dc0

◆ OnSustainNote()

void MuseSynth::OnSustainNote ( SustainNoteMsg * pMsg)
protected

The out-of-line copy of the SustainNoteMsg branch DispatchPriv() expands inline.

Its body compiles to the same bytes as OnStdMidi().

Ghidra address:
NTSC-U/C: 0x001ab088
Ghidra address:
PAL: 0x001b0df0

Member Data Documentation

◆ mClock

Sch::TickClock* MuseSynth::mClock
protected

◆ mSplitter

MsgSplitter MuseSynth::mSplitter
protected

◆ mSustainer

SynthSustainer* MuseSynth::mSustainer
protected

◆ mOutput

MsgSink* MuseSynth::mOutput
protected

◆ mPlayers

std::list<MusePlayer *> MuseSynth::mPlayers
protected

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