|
resonance 1.0.1
|
Task the scheduler runs again every fixed number of MIDI ticks. More...
#include <ticktask.h>


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 |
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.
| TickTask::TickTask | ( | Sch::TickClock * | pClock, |
| int | nPeriod, | ||
| int | bAligned ) |
| pClock | The clock the task is posted against. |
| nPeriod | Ticks between one run and the next. |
| bAligned | Non-zero to delay the first run to the next multiple of nPeriod. Every recovered caller passes zero. |
|
virtual |
Withdraw the queued command.
|
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.
| stream | The stream to write to. |
Reimplemented in BarSequencer.
|
pure virtual |
Run the task.
Table slot 4, and the one pure member of the class.
| nElapsedTicks | Ticks between the epoch and the run now due, saturated against Sch::Tick's infinity bounds. |
Implemented in BarSequencer, GamePowerupPlacer, NotePitcher, Scratcher, StutterEffector, Voxer, and WahEffector.
| 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.
| nEpochOffset | Ticks the epoch lies before the current position, or Sch::Tick's infinity sentinel for an epoch at zero. |
| 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.
| void TickTask::Stop | ( | ) |
Withdraw the queued command and forget its handle.
The destructor, GamePowerupPlacer, StutterEffector, PitchingSTG, and VoxingSTG call it. The title is inferred.