C++ wrapper for the Voyant playback system with timing capabilities.
More...
#include <voyant_playback.hpp>
|
void | applyTiming (uint64_t currentTimestamp) |
| Applies timing based on the current frame and playback rate.
|
|
void | resetTiming () |
| Resets the timing when starting a new loop.
|
|
bool | parseCurrentFrame () |
|
void | setError (const std::string &message) |
| Sets an error message and invalidates the frame.
|
|
C++ wrapper for the Voyant playback system with timing capabilities.
◆ VoyantPlayback() [1/2]
VoyantPlayback::VoyantPlayback |
( |
double |
rate = 1.0 , |
|
|
bool |
loop = false , |
|
|
bool |
filter_points = false |
|
) |
| |
Constructor
- Parameters
-
rate | Playback rate (1.0 = real-time, 0 = as fast as possible) |
loop | Whether to loop when reaching the end of file |
filter_points | Whether to filter out invalid points during playback. When true, invalid points will be removed from frames. When false, all points including invalid ones will be included. |
◆ ~VoyantPlayback()
VoyantPlayback::~VoyantPlayback |
( |
| ) |
|
◆ VoyantPlayback() [2/2]
◆ applyTiming()
void VoyantPlayback::applyTiming |
( |
uint64_t |
currentTimestamp | ) |
|
|
private |
Applies timing based on the current frame and playback rate.
◆ currentFrame() [1/2]
Gets the current frame (mutable version)
- Returns
- Mutable reference to the current frame
- Warning
- Only valid if nextFrame() returned true and no error occurred
◆ currentFrame() [2/2]
Gets the current frame (const version)
- Returns
- Const reference to the current frame
- Warning
- Only valid if nextFrame() returned true and no error occurred
◆ currentFrameIndex()
size_t VoyantPlayback::currentFrameIndex |
( |
| ) |
|
Gets the current frame index (0-based)
- Returns
- Current frame index, 0 if invalid
- Warning
- Only valid if nextFrame() returned true and no error occurred
◆ currentFrameTimestamp()
uint64_t VoyantPlayback::currentFrameTimestamp |
( |
| ) |
|
Gets the current frame timestamp in nanoseconds
- Returns
- Timestamp in nanoseconds, 0 if invalid
- Warning
- Only valid if nextFrame() returned true and no error occurred
◆ getFramesProcessed()
size_t VoyantPlayback::getFramesProcessed |
( |
| ) |
const |
Gets the number of frames processed
- Returns
- Number of frames processed
◆ getLastError()
std::string VoyantPlayback::getLastError |
( |
| ) |
const |
Gets the last error message
- Returns
- Last error message or empty string if no error
◆ getLoopsCompleted()
size_t VoyantPlayback::getLoopsCompleted |
( |
| ) |
const |
Gets the number of loops completed
- Returns
- Number of loops completed
◆ isValid()
bool VoyantPlayback::isValid |
( |
| ) |
const |
Checks if the playback handle is valid
- Returns
- true if valid, false otherwise
◆ nextFrame()
bool VoyantPlayback::nextFrame |
( |
| ) |
|
Reads the next frame, automatically applying timing and handling loopback and parses the frame data into the pre-allocated frame wrapper
- Returns
- true if a frame was successfully read, false if at end of file or error
◆ openFile()
bool VoyantPlayback::openFile |
( |
const std::string & |
filePath | ) |
|
Opens a file for playback
- Parameters
-
filePath | Path to the recording file |
- Returns
- true if successful, false otherwise
◆ operator=()
◆ parseCurrentFrame()
bool VoyantPlayback::parseCurrentFrame |
( |
| ) |
|
|
private |
Parses the current frame from the C API
- Returns
- true if successful, false otherwise
◆ resetTiming()
void VoyantPlayback::resetTiming |
( |
| ) |
|
|
private |
Resets the timing when starting a new loop.
◆ setError()
void VoyantPlayback::setError |
( |
const std::string & |
message | ) |
|
|
private |
Sets an error message and invalidates the frame.
◆ BUFFER_SIZE
constexpr size_t VoyantPlayback::BUFFER_SIZE = 4 * 1024 * 1024 |
|
staticconstexprprivate |
◆ currentFrameData
◆ firstFrame
bool VoyantPlayback::firstFrame |
|
private |
◆ firstFrameTimestamp
uint64_t VoyantPlayback::firstFrameTimestamp |
|
private |
◆ frameBuffer
uint8_t* VoyantPlayback::frameBuffer |
|
private |
◆ framesProcessed
size_t VoyantPlayback::framesProcessed |
|
private |
◆ lastErrorMsg
std::string VoyantPlayback::lastErrorMsg |
|
private |
◆ looping
bool VoyantPlayback::looping |
|
private |
◆ loopsCompleted
size_t VoyantPlayback::loopsCompleted |
|
private |
◆ playbackHandle
void* VoyantPlayback::playbackHandle |
|
private |
◆ playbackRate
double VoyantPlayback::playbackRate |
|
private |
◆ prevTimestamp
uint64_t VoyantPlayback::prevTimestamp |
|
private |
◆ startTime
std::chrono::steady_clock::time_point VoyantPlayback::startTime |
|
private |
The documentation for this class was generated from the following file: