42 : mCommand(command), mTime(fTime), mTick(nTick), mId(id), mRecordable(nRecordable) {
194 std::unique_ptr<BinStream> mStream;
247 std::unique_ptr<BinStream> mStream;
277 void Reset(
const float *pTickDuration,
int nTick);
292 void ResetForRecording(
const float *pTickDuration,
const char *pszFile,
int nDevice,
int nTick);
516 return mTickDuration;
541 return mPrevFrameTime;
546 return mPrevFrameTick;
550 std::unique_ptr<std::multiset<CommandInfo>> mCommands;
551 std::unique_ptr<Recorder> mRecorder;
552 std::unique_ptr<Playbacker> mPlaybacker;
553 const float *mTickDuration;
558 float mPrevFrameTime;
575 void Insert(
Command *pCommand,
float fTime,
int nTick,
const CommandId &
id,
bool bRecordable);
586 void RemoveIf(
const CancelPred &pred);
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Tag that a Scheduler stores beside each queued command.
Definition commandid.h:8
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Owner of one reference to an Attachment.
Definition ptr.h:16
Clock that runs at a settable rate on the cycles the system clock accumulates.
Definition schedulerclock.h:9
ByCommand(Command *pCommand)
Construct the test of a command.
Definition scheduler.h:135
bool operator()(const CommandInfo &info) const override
Report whether a run is of the command.
Test that selects the runs Cancel() withdraws.
Definition scheduler.h:111
virtual bool operator()(const CommandInfo &info) const =0
Report whether a run is withdrawn.
One queued run of a command.
Definition scheduler.h:29
const Ptr< Command > & GetCommand() const
Definition scheduler.h:74
float GetTime() const
Definition scheduler.h:79
void Save(BinStream &stream) const
Write the run to a recording.
bool operator<(const CommandInfo &other) const
Report whether this run comes before another.
CommandInfo(Ptr< Command > command, float fTime, int nTick, const CommandId &id, int nRecordable)
Construct a run.
Definition scheduler.h:40
void Load(BinStream &stream)
Read a run Save() wrote.
int GetTick() const
Definition scheduler.h:84
CommandId GetId() const
Definition scheduler.h:89
int GetRecordable() const
Definition scheduler.h:94
Playbacker(const char *pszFile, Scheduler *pScheduler)
Open a recording in a file.
void QueueAll()
Queue every run of the recording.
~Playbacker()
Release the stream.
Playbacker(char *pBuffer, int nSize, Scheduler *pScheduler)
Open a recording in a buffer.
Writer of the recordable runs to a file of a memory card, in parts.
Definition scheduler.h:158
~Recorder()
Save the runs not yet saved and release the stream.
void Flush()
Save the runs not yet saved, when a memory card is set.
void Record(const CommandInfo &info)
Write a run to the stream.
Queue of commands that run when the song clock reaches their tick.
Definition scheduler.h:20
float GetPrevFrameTime() const
Definition scheduler.h:540
float GetFrameTime() const
Definition scheduler.h:530
void Poll()
Advance the clock to the current time and run the commands it passed.
void Resume()
Restart the clock after Pause().
void PostAtTime(Command *pCommand, float fTime, bool bRecordable)
Run a command at a time.
void Reset(const float *pTickDuration, int nTick)
Stop the clock, drop every command, and set the clock to a tick at normal speed.
Scheduler()
Construct a stopped scheduler with no command.
void Cancel(Command *pCommand)
Withdraw every queued run of a command.
void PostIn(Command *pCommand, int nDelayTicks, const CommandId &id, bool bRecordable)
Run a command a number of ticks from now.
float GetClockTime()
Report the clock time.
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 PostAfter(Command *pCommand, float fDelay, const CommandId &id, bool bRecordable)
Run a command a time from now, with a tag stored beside the entry.
const std::multiset< CommandInfo > & GetCommands() const
Definition scheduler.h:510
bool IsRunning()
Report whether the clock runs.
const float * GetTickDuration() const
Definition scheduler.h:515
void ResetForPlayback(const float *pTickDuration, const char *pszFile, int nTick)
Reset the clock and replay the commands a file recorded.
float GetSpeed()
Report the rate of the clock.
void PostIn(Command *pCommand, int nDelayTicks, bool bRecordable)
Run a command a number of ticks from now.
int GetFrameTick() const
Definition scheduler.h:535
float GetTime() const
Definition scheduler.h:520
int GetClockTick()
Report the clock tick.
void PostAt(Command *pCommand, int nTick, bool bRecordable)
Run a command at a tick.
int GetTick() const
Definition scheduler.h:525
int GetPrevFrameTick() const
Definition scheduler.h:545
void ResetForPlayback(const float *pTickDuration, char *pBuffer, int nSize, int nTick)
Reset the clock and replay the commands a buffer recorded.
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 Clear()
Drop every queued command.
~Scheduler()
Release the queued commands, the recorder, and the playback.
void SetSpeed(float fSpeed)
Set the rate of the clock.
void Pause()
Stop the clock, and save what the recorder holds.
void ResetForRecording(const float *pTickDuration, const char *pszFile, int nDevice, int nTick)
Reset the clock for a recorded song.
Growable text buffer that is also a PrnStream.
Definition string.h:19
BinStream & operator<<(BinStream &stream, Command *pCommand)
Write a command to a recording: 1, its serial identifier, and what Command::Save() writes,...
BinStream & operator>>(BinStream &stream, Command *&pCommand)
Read a command operator<<() wrote, building it through Factory<Command>.
Scheduler TheMetaScheduler
The scheduler of the front end clock, which times the menu music.
Scheduler TheSongScheduler
The scheduler of the song clock.