wavelength 1.0.0
Loading...
Searching...
No Matches
Scheduler Class Reference

Queue of commands that run when the song clock reaches their tick. More...

#include <scheduler.h>

Classes

class  CommandInfo
 One queued run of a command. More...
class  CancelPred
 Test that selects the runs Cancel() withdraws. More...
class  ByCommand
 Test that selects the runs of one command. More...
class  Recorder
 Writer of the recordable runs to a file of a memory card, in parts. More...
class  Playbacker
 Reader of a recording that queues its runs on a scheduler. More...

Public Member Functions

 Scheduler ()
 Construct a stopped scheduler with no command.
 ~Scheduler ()
 Release the queued commands, the recorder, and the playback.
void Reset (const float *pTickDuration, int nTick)
 Stop the clock, drop every command, and set the clock to a tick at normal speed.
void ResetForRecording (const float *pTickDuration, const char *pszFile, int nDevice, int nTick)
 Reset the clock for a recorded song.
void ResetForPlayback (const float *pTickDuration, const char *pszFile, int nTick)
 Reset the clock and replay the commands a file recorded.
void ResetForPlayback (const float *pTickDuration, char *pBuffer, int nSize, int nTick)
 Reset the clock and replay the commands a buffer recorded.
void Resume ()
 Restart the clock after Pause().
void Pause ()
 Stop the clock, and save what the recorder holds.
bool IsRunning ()
 Report whether the clock runs.
void SetSpeed (float fSpeed)
 Set the rate of the clock.
float GetSpeed ()
 Report the rate of the clock.
void PostAtTime (Command *pCommand, float fTime, const CommandId &id, bool bRecordable)
 Run a command at a time, with a tag stored beside the entry.
void PostAtTime (Command *pCommand, float fTime, bool bRecordable)
 Run a command at a time.
void PostAfter (Command *pCommand, float fDelay, const CommandId &id, bool bRecordable)
 Run a command a time from now, with a tag stored beside the entry.
void PostAfter (Command *pCommand, float fDelay, bool bRecordable)
 Run a command a time from now.
void PostAt (Command *pCommand, int nTick, const CommandId &id, bool bRecordable)
 Run a command at a tick, with a tag stored beside the entry.
void PostAt (Command *pCommand, int nTick, bool bRecordable)
 Run a command at a tick.
void PostIn (Command *pCommand, int nDelayTicks, const CommandId &id, bool bRecordable)
 Run a command a number of ticks from now.
void PostIn (Command *pCommand, int nDelayTicks, bool bRecordable)
 Run a command a number of ticks from now.
float GetClockTime ()
 Report the clock time.
int GetClockTick ()
 Report the clock tick.
void Clear ()
 Drop every queued command.
void Cancel (Command *pCommand)
 Withdraw every queued run of a command.
void Poll ()
 Advance the clock to the current time and run the commands it passed.
const std::multiset< CommandInfo > & GetCommands () const
const float * GetTickDuration () const
float GetTime () const
int GetTick () const
float GetFrameTime () const
int GetFrameTick () const
float GetPrevFrameTime () const
int GetPrevFrameTick () const

Detailed Description

Queue of commands that run when the song clock reaches their tick.

The RTTI includes the name in the nested classes CommandInfo, ByCommand, ByID, and CancelPred. The class is not polymorphic. A recordable command can be written to a recording as it runs, and a recording replays its commands into the queue.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( )

Construct a stopped scheduler with no command.

Ghidra address:
NTSC-U/C: 0x002820c0
Ghidra address:
PAL: 0x0028b978

◆ ~Scheduler()

Scheduler::~Scheduler ( )

Release the queued commands, the recorder, and the playback.

Ghidra address:
NTSC-U/C: 0x00282198
Ghidra address:
PAL: 0x0028ba50

Member Function Documentation

◆ Reset()

void Scheduler::Reset ( const float * pTickDuration,
int nTick )

Stop the clock, drop every command, and set the clock to a tick at normal speed.

The name is inferred.

Parameters
pTickDurationThe duration of one tick in milliseconds, which the scheduler retains.
nTickThe tick.
Ghidra address:
NTSC-U/C: 0x00282298
Ghidra address:
PAL: 0x0028bb50

◆ ResetForRecording()

void Scheduler::ResetForRecording ( const float * pTickDuration,
const char * pszFile,
int nDevice,
int nTick )

Reset the clock for a recorded song.

The shipped body passes only the tick duration and the tick to Reset(). The name is inferred.

Parameters
pTickDurationThe duration of one tick in milliseconds.
pszFileThe file to record to.
nDeviceThe memory card to record to, or -1 for the host.
nTickThe tick.
Ghidra address:
NTSC-U/C: 0x00282360
Ghidra address:
PAL: 0x0028bc18

◆ ResetForPlayback() [1/2]

void Scheduler::ResetForPlayback ( const float * pTickDuration,
const char * pszFile,
int nTick )

Reset the clock and replay the commands a file recorded.

The name is inferred.

Parameters
pTickDurationThe duration of one tick in milliseconds.
pszFileThe recording.
nTickThe tick.
Ghidra address:
NTSC-U/C: 0x00282380
Ghidra address:
PAL: 0x0028bc38

◆ ResetForPlayback() [2/2]

void Scheduler::ResetForPlayback ( const float * pTickDuration,
char * pBuffer,
int nSize,
int nTick )

Reset the clock and replay the commands a buffer recorded.

The name is inferred.

Parameters
pTickDurationThe duration of one tick in milliseconds.
pBufferThe recording.
nSizeThe size of the recording in bytes.
nTickThe tick.
Ghidra address:
NTSC-U/C: 0x002823d8
Ghidra address:
PAL: 0x0028bc90

◆ Resume()

void Scheduler::Resume ( )

Restart the clock after Pause().

Ghidra address:
NTSC-U/C: 0x00282440
Ghidra address:
PAL: 0x0028bcf8

◆ Pause()

void Scheduler::Pause ( )

Stop the clock, and save what the recorder holds.

Ghidra address:
NTSC-U/C: 0x00282478
Ghidra address:
PAL: 0x0028bd30

◆ IsRunning()

bool Scheduler::IsRunning ( )

Report whether the clock runs.

Returns
Whether the clock runs.
Ghidra address:
NTSC-U/C: 0x002824c0
Ghidra address:
PAL: 0x0028bd78

◆ SetSpeed()

void Scheduler::SetSpeed ( float fSpeed)

Set the rate of the clock.

Parameters
fSpeedThe rate, 1 for real time.
Ghidra address:
NTSC-U/C: 0x002824e0
Ghidra address:
PAL: 0x0028bd98

◆ GetSpeed()

float Scheduler::GetSpeed ( )

Report the rate of the clock.

The name is inferred.

Returns
The rate.
Ghidra address:
NTSC-U/C: 0x00282500
Ghidra address:
PAL: 0x0028bdb8

◆ PostAtTime() [1/2]

void Scheduler::PostAtTime ( Command * pCommand,
float fTime,
const CommandId & id,
bool bRecordable )

Run a command at a time, with a tag stored beside the entry.

Parameters
pCommandThe command.
fTimeThe time, in milliseconds.
idThe tag stored with the entry.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x002825b0
Ghidra address:
PAL: 0x0028be68

◆ PostAtTime() [2/2]

void Scheduler::PostAtTime ( Command * pCommand,
float fTime,
bool bRecordable )

Run a command at a time.

The name is inferred.

Parameters
pCommandThe command.
fTimeThe time, in milliseconds.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x002825f0
Ghidra address:
PAL: 0x0028bea8

◆ PostAfter() [1/2]

void Scheduler::PostAfter ( Command * pCommand,
float fDelay,
const CommandId & id,
bool bRecordable )

Run a command a time from now, with a tag stored beside the entry.

Parameters
pCommandThe command.
fDelayThe delay, in milliseconds.
idThe tag stored with the entry.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x00282618
Ghidra address:
PAL: 0x0028bed0

◆ PostAfter() [2/2]

void Scheduler::PostAfter ( Command * pCommand,
float fDelay,
bool bRecordable )

Run a command a time from now.

Parameters
pCommandThe command.
fDelayThe delay, in milliseconds.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x00282638
Ghidra address:
PAL: 0x0028bef0

◆ PostAt() [1/2]

void Scheduler::PostAt ( Command * pCommand,
int nTick,
const CommandId & id,
bool bRecordable )

Run a command at a tick, with a tag stored beside the entry.

Parameters
pCommandThe command.
nTickThe tick.
idThe tag stored with the entry.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x00282660
Ghidra address:
PAL: 0x0028bf18

◆ PostAt() [2/2]

void Scheduler::PostAt ( Command * pCommand,
int nTick,
bool bRecordable )

Run a command at a tick.

Parameters
pCommandThe command.
nTickThe tick.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x00282690
Ghidra address:
PAL: 0x0028bf48

◆ PostIn() [1/2]

void Scheduler::PostIn ( Command * pCommand,
int nDelayTicks,
const CommandId & id,
bool bRecordable )

Run a command a number of ticks from now.

The entry is stored with TheDefaultCommandId, whatever id is.

Parameters
pCommandThe command.
nDelayTicksThe delay.
idNot used.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x002826b8
Ghidra address:
PAL: 0x0028bf70

◆ PostIn() [2/2]

void Scheduler::PostIn ( Command * pCommand,
int nDelayTicks,
bool bRecordable )

Run a command a number of ticks from now.

Parameters
pCommandThe command.
nDelayTicksThe delay.
bRecordableThe command is recorded for replay.
Ghidra address:
NTSC-U/C: 0x002826e0
Ghidra address:
PAL: 0x0028bf98

◆ GetClockTime()

float Scheduler::GetClockTime ( )

Report the clock time.

Returns
The time, in milliseconds.
Ghidra address:
NTSC-U/C: 0x00282708
Ghidra address:
PAL: 0x0028bfc0

◆ GetClockTick()

int Scheduler::GetClockTick ( )

Report the clock tick.

Returns
The tick.
Ghidra address:
NTSC-U/C: 0x00282728
Ghidra address:
PAL: 0x0028bfe0

◆ Clear()

void Scheduler::Clear ( )

Drop every queued command.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00282768
Ghidra address:
PAL: 0x0028c020

◆ Cancel()

void Scheduler::Cancel ( Command * pCommand)

Withdraw every queued run of a command.

Parameters
pCommandThe command.
Ghidra address:
NTSC-U/C: 0x002827c0
Ghidra address:
PAL: 0x0028c078

◆ Poll()

void Scheduler::Poll ( )

Advance the clock to the current time and run the commands it passed.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x002827f0
Ghidra address:
PAL: 0x0028c0a8

◆ GetCommands()

const std::multiset< CommandInfo > & Scheduler::GetCommands ( ) const
inline
Returns
The queued runs.

◆ GetTickDuration()

const float * Scheduler::GetTickDuration ( ) const
inline
Returns
The duration of one tick Reset() was given.

◆ GetTime()

float Scheduler::GetTime ( ) const
inline
Returns
The song clock in milliseconds.

◆ GetTick()

int Scheduler::GetTick ( ) const
inline
Returns
The song clock in ticks.

◆ GetFrameTime()

float Scheduler::GetFrameTime ( ) const
inline
Returns
The clock time the last pump ran the commands up to.

◆ GetFrameTick()

int Scheduler::GetFrameTick ( ) const
inline
Returns
The clock tick the last pump ran the commands up to.

◆ GetPrevFrameTime()

float Scheduler::GetPrevFrameTime ( ) const
inline
Returns
The clock time the pump before the last ran up to.

◆ GetPrevFrameTick()

int Scheduler::GetPrevFrameTick ( ) const
inline
Returns
The clock tick the pump before the last ran up to.

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