acl/core/time_utils.h¶
#include "acl/core/time_utils.h"
The functions that calculate the number of samples and the duration of a track.
calculate_num_samples¶
uint32_t calculate_num_samples(float duration, float sample_rate)
Calculate the number of samples present from a duration and sample rate. Conceptually, a clip with 1 sample at any sample rate has a single static pose and as such no definite duration. A clip with 2 samples at 30 FPS has a sample at time 0.0 and another at time 1/30s for a duration of 1/30s. We consider a 0.0 duration as having no samples, an infinite duration as having 1 sample, and otherwise having at least 1 sample. This does not account for the repeating first sample when the wrap looping policy is used. See sample_looping_policy for details.
calculate_duration¶
float calculate_duration(uint32_t num_samples, float sample_rate)
Calculate a clip duration from its number of samples and sample rate. Conceptually, a clip with 1 sample at any sample rate has a single static pose and as such no definite duration. A clip with 2 samples at 30 FPS has a sample at time 0.0 and another at time 1/30s for a duration of 1/30s. We consider a 0.0 duration as having no samples, an infinite duration as having 1 sample, and otherwise having at least 1 sample. This does not account for the repeating first sample when the wrap looping policy is used. See sample_looping_policy for details.
calculate_finite_duration¶
float calculate_finite_duration(uint32_t num_samples, float sample_rate)
Calculate a clip duration from its number of samples and sample rate and returns a finite duration suitable for clamping. This does not account for the repeating first sample when the wrap looping policy is used. See sample_looping_policy for details.