libsidplayfp
0.3.5
|
#include <event.h>
Public Member Functions | |
void | reset (void) |
void | clock (void) |
event_clock_t | getTime (const event_phase_t phase) const |
event_clock_t | getTime (const event_clock_t clock, const event_phase_t phase) const |
event_phase_t | phase () const |
Protected Member Functions | |
void | schedule (Event &event, const event_clock_t cycles, const event_phase_t phase) |
void | schedule (Event &event, const event_clock_t cycles) |
void | cancel (Event &event) |
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 cycle. (This behavior may be a bug of the original EventScheduler specification. Likely reason is to avoid scheduling an event into past.)
Getting a phi1 time when system is in phi2 causes the next phi1 clock to be returned.
To make scheduling even faster, I am considering making event cancellation before rescheduling mandatory, as caller is generally in position to automatically know if the event needs to be canceled first.
|
protectedvirtual |
|
inline |
Fire next event, advance system time to that event
|
inlinevirtual |
Get time with respect to a specific clock phase
phase | the phase |
Implements EventContext.
|
inlinevirtual |
Get clocks since specified clock in given phase.
clock | the time to compare to |
phase | the phase to comapre to |
Implements EventContext.
|
inlinevirtual |
void EventScheduler::reset | ( | void | ) |
Cancel all pending events and reset time.
|
inlineprotectedvirtual |
Add event to pending queue.
event | the event to add |
cycles | the clock to fire |
phase | when to fire the event |
Implements EventContext.
|
inlineprotectedvirtual |
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 |
Implements EventContext.