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