Interface ITimedDataBuffer<T>
Represents a buffer of data samples ordered by the Frame
Inherited Members
Namespace: Unity.LiveCapture
Assembly: Unity.LiveCapture.dll
Syntax
public interface ITimedDataBuffer<T> : ITimedDataBuffer
Type Parameters
Name | Description |
---|---|
T | The datatype of the samples. |
Properties
Interpolator
The interpolator used when Try
Declaration
IInterpolator<T> Interpolator { get; set; }
Property Value
Type | Description |
---|---|
IInterpolator<T> |
this[int]
Gets the sample time and value at the specified index in the buffer.
Declaration
(FrameTime frameTime, T value) this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index |
Property Value
Methods
Add(in T, in FrameTime)
Adds a new sample to the buffer.
Declaration
void Add(in T value, in FrameTime frameTime)
Parameters
Type | Name | Description |
---|---|---|
T | value | The sample value. |
Frame |
frameTime | The time of the sample in frames. |
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.
TryGetSample(FrameTime, out T)
Retrieves a sample from the buffer at the specified time.
Declaration
TimedSampleStatus TryGetSample(FrameTime frame, out T sampleValue)
Parameters
Type | Name | Description |
---|---|---|
Frame |
frame | The time to retrieve the sample data for, expressed relative to the Frame |
T | sampleValue | The retrieved sample, if successful. |
Returns
Type | Description |
---|---|
Timed |
The status of the retrieved sample. |
Remarks
If there isn't a sample at the specified time, the following occurs:
a) if the time is bounded by the oldest and newest samples contained in the buffer,
sampleValue
is set to the nearest sample and returns Ok.
b) if the time is outside of the buffer but there is at least one buffered sample,
sampleValue
is set to the newest or oldest buffered sample (whichever is closer)
and returns Behind or Ahead respectively.
c) otherwise, returns DatasampleValue
to default.