docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TimedBufferExtensions

    A set of extensiom methods for ITimedDataBuffer<T>.

    Inheritance
    object
    TimedBufferExtensions
    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
    ITimedDataBuffer<T> 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
    ITimedDataBuffer<T> buffer

    The buffer to add to.

    T value

    The sample value.

    FrameTimeWithRate 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
    ITimedDataBuffer<T> buffer

    The buffer to add to.

    FrameTime from

    The start time of the range, expressed relative to the FrameRate.

    FrameTime to

    The end time of the range, expressed relative to the FrameRate.

    Returns
    Type Description
    IEnumerable<(FrameTime time, T value)>

    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.

    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)