|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Frame-accurate timing system for visual processing domain. More...
#include <Clock.hpp>
Inheritance diagram for MayaFlux::Vruta::FrameClock:
Collaboration diagram for MayaFlux::Vruta::FrameClock:Public Member Functions | |
| FrameClock (uint32_t target_fps=60) | |
| Constructs a FrameClock with target frame rate. | |
| void | tick (uint64_t forced_frames=0) override |
| Advance clock by computing elapsed frames since last tick. | |
| uint64_t | current_position () const override |
| Get current frame position (thread-safe read) | |
| uint64_t | current_frame () const |
| Get current frame number (alias for current_position) | |
| double | current_time () const override |
| Convert current frame to seconds. | |
| uint32_t | rate () const override |
| Get target frame rate. | |
| uint32_t | frame_rate () const |
| double | get_measured_fps () const |
| Get actual measured FPS (exponentially smoothed) | |
| std::chrono::nanoseconds | time_until_next_frame () const |
| Get time until next frame should occur. | |
| void | wait_for_next_frame () |
| Wait (sleep) until next frame should occur. | |
| bool | is_frame_late () const |
| Check if we're running behind target frame rate. | |
| uint64_t | get_frame_lag () const |
| Get how many frames behind we are (if any) | |
| void | reset () override |
| Reset clock to initial state. | |
| void | set_target_fps (uint32_t new_fps) |
| Set new target frame rate (runtime adjustment) | |
Public Member Functions inherited from MayaFlux::Vruta::IClock | |
| virtual | ~IClock ()=default |
Private Member Functions | |
| void | update_fps_measurement (std::chrono::steady_clock::time_point now) |
| Update measured FPS based on tick interval Called internally during tick() | |
| uint64_t | calculate_elapsed_frames (std::chrono::steady_clock::time_point now) const |
| Calculate frames elapsed based on wall-clock time. | |
| void | recalculate_frame_duration () |
| Recalculate frame duration when target FPS changes. | |
Private Attributes | |
| uint32_t | m_target_fps |
| std::chrono::nanoseconds | m_frame_duration |
| std::atomic< uint64_t > | m_current_frame |
| std::chrono::steady_clock::time_point | m_start_time |
| std::chrono::steady_clock::time_point | m_last_tick_time |
| std::chrono::steady_clock::time_point | m_next_frame_time |
| std::atomic< double > | m_measured_fps |
Static Private Attributes | |
| static constexpr double | FPS_SMOOTHING_ALPHA = 0.1 |
Frame-accurate timing system for visual processing domain.
Self-driven clock: Manages its own timing and advances autonomously. Unlike SampleClock which is driven by external audio callbacks, FrameClock actively manages frame timing and vsync coordination.
Threading Model:
Timing Characteristics: