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

Player that sounds one note for a fixed length and then releases it. More...

#include <noteplayer.h>

Inheritance diagram for NotePlayer:
Collaboration diagram for NotePlayer:

Public Member Functions

 NotePlayer (unsigned char nNote, unsigned char nVelocity, int nDuration, unsigned char nChannel, MuseParent *pParent, Sch::TickClock *pClock)
 Retain the note and shorten its length by two ticks, keeping at least one.
virtual ~NotePlayer ()
 Stop the note through this class's Stop().
virtual void Start (MsgSink *pSink)
 Send the note-on to a sink and schedule the note-off.
virtual void Stop ()
 Send the note-off now and withdraw the scheduled command, when the note is sounding.
virtual int DisplacesSiblings ()
void OnCommand (int nTick)
 Send the note-off at a song position and report the player finished to mParent.
Public Member Functions inherited from MusePlayer
void * operator new (size_t nSize)
 Allocate a player from the untagged heap.
void operator delete (void *pBlock)
 Release a player to the untagged heap.
 MusePlayer ()
 Construct a player with the next serial number.
virtual ~MusePlayer ()
 Inline.

Detailed Description

Player that sounds one note for a fixed length and then releases it.

It has MusePlayer as its one base. Its table at 0x007e17b8 runs the type function, the destructor, and the three MusePlayer verbs. MuseSynth::StartNotePlayer() measures the object at 0x20 bytes. That routine passes a NoteMsg's bytes at +0x09, +0x0a, and +0x08, its word at +0x0c, the MuseParent half of the synth, and the synth's clock.

Start() sends the note-on and schedules the file-local command Cmd of GsNotePlayer.cpp (Q233_GLOBAL_$N$GsNotePlayer.cppdKuhgb3Cmd in the RTTI) at the end of the note. That command runs OnCommand(), which sends the note-off and reports the player finished to its parent. Stop() sends the note-off early and withdraws the command.

The note-on and note-off are StdMidiMsg objects built on the stack and delivered through MsgSink::Dispatch() on mSink.

Constructor & Destructor Documentation

◆ NotePlayer()

NotePlayer::NotePlayer ( unsigned char nNote,
unsigned char nVelocity,
int nDuration,
unsigned char nChannel,
MuseParent * pParent,
Sch::TickClock * pClock )

Retain the note and shorten its length by two ticks, keeping at least one.

Parameters
nNoteThe MIDI note number.
nVelocityThe note-on velocity.
nDurationThe length of the note, in MIDI ticks.
nChannelThe MIDI channel. Only the low four bits are kept.
pParentThe owner the player reports to.
pClockThe clock the note-off is scheduled against.
Ghidra address:
NTSC-U/C: 0x001b4328
Ghidra address:
PAL: 0x001ba100

◆ ~NotePlayer()

virtual NotePlayer::~NotePlayer ( )
virtual

Stop the note through this class's Stop().

Ghidra address:
NTSC-U/C: 0x001b4460
Ghidra address:
PAL: 0x001ba238

Member Function Documentation

◆ Start()

virtual void NotePlayer::Start ( MsgSink * pSink)
virtual

Send the note-on to a sink and schedule the note-off.

mParent is told to retain this player alone before the note-on is sent.

Parameters
pSinkThe sink both messages go to.
Ghidra address:
NTSC-U/C: 0x001b3d58
Ghidra address:
PAL: 0x001b9b30

Implements MusePlayer.

◆ Stop()

virtual void NotePlayer::Stop ( )
virtual

Send the note-off now and withdraw the scheduled command, when the note is sounding.

The note-off is a StdMidiMsg with status 0x80 ORed with mChannel, mNote, and velocity 0 at the current song position. mSink is cleared whether or not the note was sounding.

Ghidra address:
NTSC-U/C: 0x001b3ee0
Ghidra address:
PAL: 0x001b9cb8

Implements MusePlayer.

◆ DisplacesSiblings()

virtual int NotePlayer::DisplacesSiblings ( )
virtual
Returns
Zero. A note never displaces its sibling players.
Ghidra address:
NTSC-U/C: 0x001b41c0
Ghidra address:
PAL: 0x001b9f98

Implements MusePlayer.

◆ OnCommand()

void NotePlayer::OnCommand ( int nTick)

Send the note-off at a song position and report the player finished to mParent.

The file-local Cmd runs it. mSink is cleared between the two steps.

Parameters
nTickThe song position the command was scheduled for.
Ghidra address:
NTSC-U/C: 0x001b4040
Ghidra address:
PAL: 0x001b9e18

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