docs.unity3d.com
    目次を表示する/隠す

    Struct FrameTimeWithRate

    A struct that represents a time in a frame sequence.

    Namespace: Unity.LiveCapture
    Syntax
    public readonly struct FrameTimeWithRate : IComparable, IComparable<FrameTimeWithRate>, IEquatable<FrameTimeWithRate>
    Remarks

    A time specified relative to a frame sequence cannot be converted to other representations or generally compared unless the frame rate of the sequence is also known. This struct stores both pieces of data needed to fully represent the time.

    Constructors

    FrameTimeWithRate(FrameRate, FrameTime)

    Creates a new FrameTimeWithRate instance.

    Declaration
    public FrameTimeWithRate(FrameRate rate, FrameTime time)
    Parameters
    Type Name Description
    FrameRate rate

    The rate of the frame sequence in Hz.

    FrameTime time

    The time relative to the frame sequence.

    Properties

    Rate

    The rate of the frame sequence in Hz.

    Declaration
    public readonly FrameRate Rate { get; }
    Property Value
    Type Description
    FrameRate

    Time

    The time relative to the frame sequence.

    Declaration
    public readonly FrameTime Time { get; }
    Property Value
    Type Description
    FrameTime

    Methods

    CompareTo(Object)

    Compares this instance to a specified object and returns an indication of their relative values.

    Declaration
    public readonly int CompareTo(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare with this instance.

    Returns
    Type Description
    Int32

    A signed number indicating the relative values of this instance and obj.

    • Returns a negative value when obj is not a valid FrameTimeWithRate instance or this instance is less than obj.
    • Returns zero when this instance is the same as obj.
    • Returns a positive value when this instance is greater than obj.

    CompareTo(FrameTimeWithRate)

    Compares this instance to a specified FrameTimeWithRate and returns an indication of their relative values.

    Declaration
    public readonly int CompareTo(FrameTimeWithRate other)
    Parameters
    Type Name Description
    FrameTimeWithRate other

    The value to compare with this instance.

    Returns
    Type Description
    Int32

    A signed number indicating the relative values of this instance and other.

    • Returns a negative value when this instance is less than other.
    • Returns zero when this instance is the same as other.
    • Returns a positive value when this instance is greater than other.

    Equals(Object)

    Returns a value indicating whether this instance is equal to a specified object.

    Declaration
    public override readonly bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    An object to compare with this instance.

    Returns
    Type Description
    Boolean

    true if obj is an instance of FrameTimeWithRate and equals the value of this instance; otherwise, false.

    Overrides
    ValueType.Equals(Object)

    Equals(FrameTimeWithRate)

    Returns a value indicating whether this instance is equal to a specified FrameTimeWithRate.

    Declaration
    public readonly bool Equals(FrameTimeWithRate other)
    Parameters
    Type Name Description
    FrameTimeWithRate other

    A value to compare with this instance.

    Returns
    Type Description
    Boolean

    true if other has the same value as this instance; otherwise, false.

    FromSeconds(FrameRate, Double)

    Creates a new FrameTimeWithRate instance from a time in seconds and a frame rate.

    Declaration
    public static FrameTimeWithRate FromSeconds(FrameRate frameRate, double time)
    Parameters
    Type Name Description
    FrameRate frameRate

    The frame rate of the frame sequence.

    Double time

    The time in seconds.

    Returns
    Type Description
    FrameTimeWithRate

    A new FrameTimeWithRate that represents the given time.

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override readonly int GetHashCode()
    Returns
    Type Description
    Int32

    The hash code for this instance.

    Overrides
    ValueType.GetHashCode()

    Remap(FrameRate)

    Gets this time represented using a different FrameRate.

    Declaration
    public readonly FrameTimeWithRate Remap(FrameRate frameRate)
    Parameters
    Type Name Description
    FrameRate frameRate

    The frame rate to convert to.

    Returns
    Type Description
    FrameTimeWithRate

    A new FrameTimeWithRate remapped to the the target frame rate, or langword_csharp_default if frameRate is invalid.

    ToSeconds()

    Gets the time represented by this FrameTimeWithRate in seconds.

    Declaration
    public readonly double ToSeconds()
    Returns
    Type Description
    Double

    The time in seconds since the start of the frame sequence, or langword_csharp_default if Rate is invalid.

    ToString()

    Returns a string that represents the current instance.

    Declaration
    public override readonly string ToString()
    Returns
    Type Description
    String

    A string that represents the current instance.

    Overrides
    ValueType.ToString()

    ToTimecode()

    Gets the time represented by this FrameTimeWithRate as a Timecode.

    Declaration
    public readonly Timecode ToTimecode()
    Returns
    Type Description
    Timecode

    A new Timecode that represents this time, or langword_csharp_default if Rate is invalid.

    Remarks

    If the total time is greater than 24 hours, the time is wrapped around to zero.

    Operators

    Addition(FrameTimeWithRate, FrameTimeWithRate)

    Calculates the sum of two specified FrameTimeWithRate values.

    Declaration
    public static FrameTimeWithRate operator +(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first frame time.

    FrameTimeWithRate b

    The second frame time.

    Returns
    Type Description
    FrameTimeWithRate

    The sum of a and b.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type.

    Decrement(FrameTimeWithRate)

    Decrements a FrameTimeWithRate by a single frame.

    Declaration
    public static FrameTimeWithRate operator --(FrameTimeWithRate a)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The frame time to Decrement.

    Returns
    Type Description
    FrameTimeWithRate

    The decremented frame time.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type.

    Equality(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether two specified instances of FrameTimeWithRate are equal.

    Declaration
    public static bool operator ==(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a and b represent the same value; otherwise, false.

    GreaterThan(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether one specified FrameTimeWithRate is later than another specified FrameTimeWithRate.

    Declaration
    public static bool operator>(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a is later than b; otherwise, false.

    GreaterThanOrEqual(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether one specified FrameTimeWithRate is later than or the same as another specified FrameTimeWithRate.

    Declaration
    public static bool operator >=(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a is later than or the same as b; otherwise, false.

    Increment(FrameTimeWithRate)

    Increments a FrameTimeWithRate by a single frame.

    Declaration
    public static FrameTimeWithRate operator ++(FrameTimeWithRate a)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The frame time to increment.

    Returns
    Type Description
    FrameTimeWithRate

    The incremented frame time.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type.

    Inequality(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether two specified instances of FrameTimeWithRate are not equal.

    Declaration
    public static bool operator !=(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a and b do not represent the same value; otherwise, false.

    LessThan(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether one specified FrameTimeWithRate is earlier than another specified FrameTimeWithRate.

    Declaration
    public static bool operator <(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a is earlier than b; otherwise, false.

    LessThanOrEqual(FrameTimeWithRate, FrameTimeWithRate)

    Determines whether one specified FrameTimeWithRate is earlier than or the same as another specified FrameTimeWithRate.

    Declaration
    public static bool operator <=(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The first instance to compare.

    FrameTimeWithRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

    true if a is earlier than or the same as b; otherwise, false.

    Subtraction(FrameTimeWithRate, FrameTimeWithRate)

    Calculates the difference between two specified FrameTimeWithRate values.

    Declaration
    public static FrameTimeWithRate operator -(FrameTimeWithRate a, FrameTimeWithRate b)
    Parameters
    Type Name Description
    FrameTimeWithRate a

    The frame time.

    FrameTimeWithRate b

    The frame time to subtract.

    Returns
    Type Description
    FrameTimeWithRate

    The difference of a from b.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting value is outside the range representable by the FrameTimeWithRate type.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)