resonance 1.0.1
Loading...
Searching...
No Matches
TickTask Class Referenceabstract

Task the scheduler runs again every fixed number of MIDI ticks. More...

#include <ticktask.h>

Inheritance diagram for TickTask:
Collaboration diagram for TickTask:

Public Member Functions

 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.
virtual int Tick (int nElapsedTicks)=0
 Run the task.
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.

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 Attachment
int mRefs

Detailed Description

Task the scheduler runs again every fixed number of MIDI ticks.

Its RTTI descriptor is at 0x00901b80. It has Attachment as its one base, and it is named after AppTickTask.cpp, the translation unit its file-local Cmd class records. Its vtable is at 0x007d30c8 and runs five entries. Slot 2 retains Attachment::Destroy() and slot 4 addresses the shared pure-virtual stub at 0x005381a8, which is what makes the class abstract.

The object is 0x20 bytes. The Attachment base supplies the reference count at +0x00 and the vptr at +0x04.

Run() is what fixes the meaning of the members. It subtracts mEpoch from mNextTick, saturates the difference against Sch::Tick's two infinity bounds, hands the result to Tick(), and returns without rescheduling unless Tick() reports 1. Otherwise it advances mNextTick by mPeriod, saturates again, and posts a fresh file-local Cmd against the clock under mCommand.

Pitcher, BarSequencer, WahEffector, StutterEffector, GamePowerupPlacer, and the file-local NoteDestroyer of AppPlaySoundPS2.cpp all derive from this class.

Constructor & Destructor Documentation

◆ TickTask()

TickTask::TickTask ( Sch::TickClock * pClock,
int nPeriod,
int bAligned )
Parameters
pClockThe clock the task is posted against.
nPeriodTicks between one run and the next.
bAlignedNon-zero to delay the first run to the next multiple of nPeriod. Every recovered caller passes zero.
Ghidra address:
NTSC-U/C: 0x0013ad88
Ghidra address:
PAL: 0x0013b6d0

◆ ~TickTask()

virtual TickTask::~TickTask ( )
virtual

Withdraw the queued command.

Ghidra address:
NTSC-U/C: 0x0013adc8
Ghidra address:
PAL: 0x0013b710

Member Function Documentation

◆ Print()

virtual void TickTask::Print ( std::ostream & stream)
virtual

Write the task to a diagnostic stream.

Table slot 3. This class writes the literal {TickTask} and nothing else. The body is shared with every subclass that does not override it.

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

Reimplemented in BarSequencer.

◆ Tick()

virtual int TickTask::Tick ( int nElapsedTicks)
pure virtual

Run the task.

Table slot 4, and the one pure member of the class.

Parameters
nElapsedTicksTicks between the epoch and the run now due, saturated against Sch::Tick's infinity bounds.
Returns
1 to be run again after mPeriod further ticks, anything else to stop.

Implemented in BarSequencer, GamePowerupPlacer, NotePitcher, Scratcher, StutterEffector, Voxer, and WahEffector.

◆ Start()

void TickTask::Start ( int nEpochOffset)

Post the task on its clock.

Reads the song position into mNextTick and measures mEpoch from it. A task with mAligned clear then runs at once through Run(). An aligned task instead posts a command that runs it at the next multiple of mPeriod. The title is inferred.

Parameters
nEpochOffsetTicks the epoch lies before the current position, or Sch::Tick's infinity sentinel for an epoch at zero.
Ghidra address:
NTSC-U/C: 0x0013a860
Ghidra address:
PAL: 0x0013b1a8

◆ Run()

void TickTask::Run ( )

Run Tick() for the run now due and post the next one.

The file-local Cmd's Execute() is the caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0013aa38
Ghidra address:
PAL: 0x0013b380

◆ Stop()

void TickTask::Stop ( )

Withdraw the queued command and forget its handle.

The destructor, GamePowerupPlacer, StutterEffector, PitchingSTG, and VoxingSTG call it. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0013ae10
Ghidra address:
PAL: 0x0013b758

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