FastLED
3.9.15
Loading...
Searching...
No Matches
frame_tracker.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdint.h>
4
5
#include "
fl/namespace.h
"
6
7
// #include <iostream>
8
9
// using namespace std;
10
11
namespace
fl
{
12
13
// Tracks the current frame number based on the time elapsed since the start of the animation.
14
class
FrameTracker
{
15
public
:
16
FrameTracker
(
float
fps);
17
18
// Gets the current frame and the next frame number based on the current time.
19
void
get_interval_frames
(uint32_t now, uint32_t* frameNumber, uint32_t* nextFrameNumber, uint8_t* amountOfNextFrame =
nullptr
)
const
;
20
21
// Given a frame number, returns the exact timestamp in milliseconds that the frame should be displayed.
22
uint32_t
get_exact_timestamp_ms
(uint32_t frameNumber)
const
;
23
24
25
uint32_t
microsecondsPerFrame
()
const
{
26
return
mMicrosSecondsPerInterval
;
27
}
28
29
private
:
30
uint32_t
mMicrosSecondsPerInterval
;
31
uint32_t
mStartTime
= 0;
32
};
33
34
35
}
// namespace fl
fl::FrameTracker::get_exact_timestamp_ms
uint32_t get_exact_timestamp_ms(uint32_t frameNumber) const
Definition
frame_tracker.cpp:46
fl::FrameTracker::get_interval_frames
void get_interval_frames(uint32_t now, uint32_t *frameNumber, uint32_t *nextFrameNumber, uint8_t *amountOfNextFrame=nullptr) const
Definition
frame_tracker.cpp:22
fl::FrameTracker::mMicrosSecondsPerInterval
uint32_t mMicrosSecondsPerInterval
Definition
frame_tracker.h:30
fl::FrameTracker::FrameTracker
FrameTracker(float fps)
Definition
frame_tracker.cpp:17
fl::FrameTracker::microsecondsPerFrame
uint32_t microsecondsPerFrame() const
Definition
frame_tracker.h:25
fl::FrameTracker::mStartTime
uint32_t mStartTime
Definition
frame_tracker.h:31
namespace.h
Implements the FastLED namespace macros.
fl
Implements a simple red square effect for 2D LED grids.
Definition
crgb.h:16
fx
video
frame_tracker.h
Generated on Fri Apr 18 2025 03:39:31 for FastLED by
1.13.2