libsidplayfp
2.0.2
|
#include <EventScheduler.h>
Public Member Functions | |
void | schedule (Event &event, unsigned int cycles, event_phase_t phase) |
void | schedule (Event &event, unsigned int cycles) |
void | cancel (Event &event) |
void | reset () |
void | clock () |
bool | isPending (Event &event) const |
event_clock_t | getTime (event_phase_t phase) const |
event_clock_t | getTime (event_clock_t clock, event_phase_t phase) const |
event_phase_t | phase () const |
Fast EventScheduler, which maintains a linked list of Events. This scheduler takes neglible time even when it is used to schedule events for nearly every clock.
Events occur on an internal clock which is 2x the visible clock. The visible clock is divided to two phases called phi1 and phi2.
The phi1 clocks are used by VIC and CIA chips, phi2 clocks by CPU.
Scheduling an event for a phi1 clock when system is in phi2 causes the event to be moved to the next phi1 cycle. Correspondingly, requesting a phi1 time when system is in phi2 returns the value of the next phi1.
void libsidplayfp::EventScheduler::cancel | ( | Event & | event | ) |
Cancel event if pending.
event | the event to cancel |
|
inline |
Fire next event, advance system time to that event.
|
inline |
Get clocks since specified clock in given phase.
clock | the time to compare to |
phase | the phase to comapre to |
|
inline |
Get time with respect to a specific clock phase.
phase | the phase |
bool libsidplayfp::EventScheduler::isPending | ( | Event & | event | ) | const |
Check if an event is in the queue.
event | the event |
|
inline |
Return current clock phase.
void libsidplayfp::EventScheduler::reset | ( | ) |
Cancel all pending events and reset time.
|
inline |
Add event to pending queue in the same phase as current event.
event | the event to add |
cycles | how many cycles from now to fire |
|
inline |
Add event to pending queue.
At PHI2, specify cycles=0 and Phase=PHI1 to fire on the very next PHI1.
event | the event to add |
cycles | how many cycles from now to fire |
phase | the phase when to fire the event |