docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface ITimedDataBuffer<T>

    Represents a buffer of data samples ordered by the FrameTime of each sample.

    Inherited Members
    ITimedDataBuffer.Count
    ITimedDataBuffer.Capacity
    ITimedDataBuffer.FrameRate
    ITimedDataBuffer.Clear()
    ITimedDataBuffer.TryGetBufferRange(out FrameTime, out FrameTime)
    ITimedDataBuffer.GetStatus(FrameTime)
    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 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>

    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
    Type Description
    (FrameTime frameTime, T 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.

    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.

    Extension Methods

    TimedBufferExtensions.Add<T>(ITimedDataBuffer<T>, in T, double)
    TimedBufferExtensions.Add<T>(ITimedDataBuffer<T>, in T, in FrameTimeWithRate)
    TimedBufferExtensions.GetSamplesInRange<T>(ITimedDataBuffer<T>, FrameTime, FrameTime)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)