Class TimedBufferExtensions
A set of extensiom methods for ITimed
Namespace: Unity.LiveCapture
Assembly: Unity.LiveCapture.dll
Syntax
public static class TimedBufferExtensions
Methods
Add<T>(ITimedDataBuffer<T>, in T, double)
Adds a new sample to the buffer.
Declaration
public static void Add<T>(this ITimedDataBuffer<T> buffer, in T value, double time)
Parameters
Type | Name | Description |
---|---|---|
ITimed |
buffer | The buffer to add to. |
T | value | The sample value. |
double | time | The time of the sample in seconds. |
Type Parameters
Name | Description |
---|---|
T | The datatype of the samples. |
Remarks
When the buffer is full, the oldest sample in the buffer is discarded. The sample is inserted into the buffer so that the samples are ordered by increasing time. If a sample with the specified time already exists in the buffer, its value is updated with the new value.
Add<T>(ITimedDataBuffer<T>, in T, in FrameTimeWithRate)
Adds a new sample to the buffer.
Declaration
public static void Add<T>(this ITimedDataBuffer<T> buffer, in T value, in FrameTimeWithRate frameTime)
Parameters
Type | Name | Description |
---|---|---|
ITimed |
buffer | The buffer to add to. |
T | value | The sample value. |
Frame |
frameTime | The time of the sample in frames. |
Type Parameters
Name | Description |
---|---|
T | The datatype of the samples. |
Remarks
When the buffer is full, the oldest sample in the buffer is discarded. The sample is inserted into the buffer so that the samples are ordered by increasing time. If a sample with the specified time already exists in the buffer, its value is updated with the new value.
GetSamplesInRange<T>(ITimedDataBuffer<T>, FrameTime, FrameTime)
Retrieves the buffered samples that lie in a time range.
Declaration
public static IEnumerable<(FrameTime time, T value)> GetSamplesInRange<T>(this ITimedDataBuffer<T> buffer, FrameTime from, FrameTime to)
Parameters
Type | Name | Description |
---|---|---|
ITimed |
buffer | The buffer to add to. |
Frame |
from | The start time of the range, expressed relative to the Frame |
Frame |
to | The end time of the range, expressed relative to the Frame |
Returns
Type | Description |
---|---|
IEnumerable<(Frame |
An iterator that returns all samples in the specified range. |
Type Parameters
Name | Description |
---|---|
T | The datatype of the samples. |
Remarks
The range bounds are inclusive.