Interface ITimedDataBuffer<T>
Represents a buffer of data samples ordered by the FrameTime of each sample.
Inherited Members
Namespace: Unity.LiveCapture
Syntax
public interface ITimedDataBuffer<T> : ITimedDataBuffer, IEnumerable<(FrameTime frameTime, T value)>, IEnumerable
Type Parameters
| Name | Description |
|---|---|
| T | The datatype of the samples. |
Properties
Interpolator
The interpolator used when TryGetSample(FrameTime, out T) is called for a time which lies between two samples.
Declaration
IInterpolator<T> Interpolator { get; set; }
Property Value
| Type | Description |
|---|---|
| IInterpolator<T> |
Item[Int32]
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 |
|---|---|---|
| Int32 | index |
Property Value
| Type | Description |
|---|---|
| (T1, T2)<FrameTime, T> |
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. |
| FrameTime | 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 |
|---|---|---|
| FrameTime | frame | The time to retrieve the sample data for, expressed relative to the FrameRate. |
| T | sampleValue | The retrieved sample, if successful. |
Returns
| Type | Description |
|---|---|
| TimedSampleStatus | 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 DataMissing and sets sampleValue to default.