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

Pitcher that drives a note track. More...

#include <notepitcher.h>

Inheritance diagram for NotePitcher:
Collaboration diagram for NotePitcher:

Public Member Functions

 NotePitcher (PhraseMgr *pPhraseMgr, Quantizer *pQuantizer, Sch::TickClock *pClock, const TrackData *pTrackData, int bPlayModeOne, int bAllowOwnedBars, int nUnreadOption)
 Construct a note pitcher for one track.
virtual ~NotePitcher ()
virtual int Tick (int nElapsedTicks)
 Advance to the bar the elapsed tick count falls in.
Public Member Functions inherited from Pitcher
 Pitcher (Sch::TickClock *pClock)
 Construct the three bases, the TickTask one to run every bar.
virtual ~Pitcher ()
 Inline.
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.
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.
Public Member Functions inherited from TickTask
 TickTask (Sch::TickClock *pClock, int nPeriod, int bAligned)
virtual ~TickTask ()
 Withdraw the queued command.
virtual void Print (std::ostream &stream)
 Write the task to a diagnostic stream.
void Start (int nEpochOffset)
 Post the task on its clock.
void Run ()
 Run Tick() for the run now due and post the next one.
void Stop ()
 Withdraw the queued command and forget its handle.
Public Member Functions inherited from Attachment
 Attachment ()
virtual ~Attachment ()
int Release ()
 Give back one reference and destroy the object once the last one is gone.
virtual void Destroy ()
 Destroy the object.

Protected Member Functions

void PostPitchMsg (PitchRiffMsg *pMsg)
 React to a PitchRiffMsg for this track and player.
void PostAllNotesOffMsg (EraseMsg *pMsg)
 Erase this player's phrases at an EraseMsg's position, outside play mode 1.
void PostSeekerMsg (TrackSelectMsg *pMsg)
 Install the player a TrackSelectMsg for this track selects.
void PostPhraseCapturedMsg (int nGem, int nTick)
 Record a caught gem.
void PostSeekerMsgSecond (int nBar, int bForce)
 Post the seeker for mPlayer at the first playable bar of the eight from nBar.
virtual void DispatchPriv (Message *pMsg)
 Act on a message.

Additional Inherited Members

Static Public Member Functions inherited from Attachment
static void ReleaseIfSet (Attachment *pAttachment)
 Give back one reference to an object that may be null.
Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.
Public Attributes inherited from Attachment
int mRefs
Static Public Attributes inherited from Pitcher
static constexpr int kBarPeriod = 1920
 The TickTask period, one bar of 1920 ticks.

Detailed Description

Pitcher that drives a note track.

Its RTTI descriptor is at 0x008eef68. It has Pitcher as its one base. Its three tables are at 0x007e14a0, 0x007e1478, and 0x007e1448, and it overrides exactly the two slots Pitcher declares pure. PitchingSTG's tagged allocation measures the object at 0x70 bytes, and PitchingSTG builds one of these when the track's kind word is 2 and a Scratcher when it is 3.

It ignores an EraseOffMsg rather than forwarding it, which is the one message the three Pitcher subclasses treat differently from each other.

The names of the routines DispatchPriv() and Tick() dispatch to come from the message each routine posts rather than from the message it receives.

Constructor & Destructor Documentation

◆ NotePitcher()

NotePitcher::NotePitcher ( PhraseMgr * pPhraseMgr,
Quantizer * pQuantizer,
Sch::TickClock * pClock,
const TrackData * pTrackData,
int bPlayModeOne,
int bAllowOwnedBars,
int nUnreadOption )

Construct a note pitcher for one track.

The seven arguments arrive in a1 through a3 and t0 through t3, which is the register convention this target uses for arguments five through eight.

Parameters
pPhraseMgrThe phrase manager for the track.
pQuantizerThe quantiser for the track.
pClockThe clock the producer schedules against.
pTrackDataThe track description.
bPlayModeOneNon-zero when the game manager reports play mode 1.
bAllowOwnedBarsNon-zero to let the player replay a bar it is already the owner of. PitchingSTG passes 1.
nUnreadOptionStored and never read. PitchingSTG passes zero.
Ghidra address:
NTSC-U/C: 0x001b1ce0
Ghidra address:
PAL: 0x001b7ab8

◆ ~NotePitcher()

virtual NotePitcher::~NotePitcher ( )
virtual
Ghidra address:
NTSC-U/C: 0x001b39c0
Ghidra address:
PAL: 0x001b9798

Member Function Documentation

◆ Tick()

virtual int NotePitcher::Tick ( int nElapsedTicks)
virtual

Advance to the bar the elapsed tick count falls in.

Divides the elapsed count by mBarDivisor and hands the result to PostSeekerMsgSecond() with a second argument of zero.

Parameters
nElapsedTicksTicks since the epoch.
Returns
1 always.
Ghidra address:
NTSC-U/C: 0x001b3b98
Ghidra address:
PAL: 0x001b9970

Implements TickTask.

◆ PostPitchMsg()

void NotePitcher::PostPitchMsg ( PitchRiffMsg * pMsg)
protected

React to a PitchRiffMsg for this track and player.

The message's position is quantised. A bar CanPlayBar() rejects plays SND_INACTIVE. Otherwise, at a new position, the riff TrackData::GetRiff() reports goes out as a MultiMuseMsg, PostPhraseCapturedMsg() records the gem, a PitchMsg follows, and the position is stored in mLastPitchPosition.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x001b1f10
Ghidra address:
PAL: 0x001b7ce8

◆ PostAllNotesOffMsg()

void NotePitcher::PostAllNotesOffMsg ( EraseMsg * pMsg)
protected

Erase this player's phrases at an EraseMsg's position, outside play mode 1.

The bar, or with the message's last word set every bar of its step, is cleared wherever mPlayer is its owner, and clearing the message's bar also sends an AllNotesOffMsg. When anything was cleared, SND_ERASE_SECTION or SND_ERASE plays, a ShowEraseEffectMsg goes out, and the seeker is posted again. The position is stored in mLastErasePosition in both cases.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x001b20b0
Ghidra address:
PAL: 0x001b7e88

◆ PostSeekerMsg()

void NotePitcher::PostSeekerMsg ( TrackSelectMsg * pMsg)
protected

Install the player a TrackSelectMsg for this track selects.

A null player first turns the previous player's seeker off. A real player has its seeker posted at the message's bar with the force flag set.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x001b22f0
Ghidra address:
PAL: 0x001b80c8

◆ PostPhraseCapturedMsg()

void NotePitcher::PostPhraseCapturedMsg ( int nGem,
int nTick )
protected

Record a caught gem.

A new bar becomes mCapturedBar and is announced with a PhraseCapturedMsg worth the bar's points. In play mode 1 a phrase another player owns there is cleared first. Unless Player::IsLooping() reports non-zero, the gem goes to PhraseMgr::AddGem() for mCapturedBar alone. Otherwise it goes to every bar of the step that CanPlayBar() accepts and whose phrase PhraseMgr::PhrasesMatch() pairs with mCapturedBar, and then to mCapturedBar itself. The bar is then replayed from one tick after the gem.

Parameters
nGemThe gem, the PitchRiffMsg's first word.
nTickThe quantised song position.
Ghidra address:
NTSC-U/C: 0x001b2400
Ghidra address:
PAL: 0x001b81d8

◆ PostSeekerMsgSecond()

void NotePitcher::PostSeekerMsgSecond ( int nBar,
int bForce )
protected

Post the seeker for mPlayer at the first playable bar of the eight from nBar.

The routine does not send a message for the stand-in player. Without bForce, a player whose Player::GetPlace() reports non-zero has its seeker turned off. Outside play mode 1, a player whose Player::IsLooping() reports zero, or a search that does not find a bar CanPlayBar() accepts, also turns the seeker off. A found bar posts a seeker over the mStepBars bars of its step.

Parameters
nBarThe bar to search from, clamped to zero.
bForceNon-zero to skip the Player::GetPlace() test.
Ghidra address:
NTSC-U/C: 0x001b2710
Ghidra address:
PAL: 0x001b84e8

◆ DispatchPriv()

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

Act on a message.

Primary table slot 3.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x001b3bd0
Ghidra address:
PAL: 0x001b99a8

Implements MsgSink.


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