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

    Struct FrameRate

    A struct that stores a frame rate in Hz as a fractional number to avoid imprecision.

    Namespace: Unity.LiveCapture
    Syntax
    [Serializable]
    public struct FrameRate : IComparable, IComparable<FrameRate>, IEquatable<FrameRate>

    Constructors

    FrameRate(Int32)

    Creates a new FrameRate instance.

    Declaration
    public FrameRate(int frameRate)
    Parameters
    Type Name Description
    Int32 frameRate

    The frame rate in Hz.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if frameRate is negative.

    FrameRate(Int32, Int32, Boolean)

    Creates a new FrameRate instance.

    Declaration
    public FrameRate(int numerator, int denominator, bool isDropFrame)
    Parameters
    Type Name Description
    Int32 numerator

    The fraction numerator.

    Int32 denominator

    The fraction denominator.

    Boolean isDropFrame

    Should drop frame calculations be performed when converting between clock time and frame time using this frame rate.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if numerator or Denominator is negative.

    Properties

    Denominator

    The frame rate fraction denominator.

    Declaration
    public readonly int Denominator { get; }
    Property Value
    Type Description
    Int32

    FrameInterval

    Gets the length of time between frames in seconds.

    Declaration
    public readonly double FrameInterval { get; }
    Property Value
    Type Description
    Double

    IsDropFrame

    Should drop frame calculations be performed when converting between clock time and frame time using this frame rate.

    Declaration
    public readonly bool IsDropFrame { get; }
    Property Value
    Type Description
    Boolean
    Remarks

    This can only be true for NTSC frame rates.

    IsValid

    Is the frame rate valid.

    Declaration
    public readonly bool IsValid { get; }
    Property Value
    Type Description
    Boolean

    Numerator

    The frame rate fraction numerator.

    Declaration
    public readonly int Numerator { get; }
    Property Value
    Type Description
    Int32

    Reciprocal

    Gets the reciprocal of the frame rate fraction.

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

    Methods

    AsDouble()

    Gets the frame rate as a Double.

    Declaration
    public readonly double AsDouble()
    Returns
    Type Description
    Double

    The frame rate in Hz.

    AsFloat()

    Gets the frame rate as a Single.

    Declaration
    public readonly float AsFloat()
    Returns
    Type Description
    Single

    The frame rate in Hz.

    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 FrameRate 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(FrameRate)

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

    Declaration
    public readonly int CompareTo(FrameRate other)
    Parameters
    Type Name Description
    FrameRate 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 FrameRate and equals the value of this instance; otherwise, false.

    Overrides
    ValueType.Equals(Object)

    Equals(FrameRate)

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

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

    A value to compare with this instance.

    Returns
    Type Description
    Boolean

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

    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()

    IsFactorOf(FrameRate)

    Checks if this FrameRate is a factor of another.

    Declaration
    public readonly bool IsFactorOf(FrameRate other)
    Parameters
    Type Name Description
    FrameRate other

    The frame rate to compare against.

    Returns
    Type Description
    Boolean

    true if this frame rate is a factor of other; otherwise, false.

    Remarks

    This is based on the time between frames, so 48 fps is considered a factor of 24 fps.

    IsMultipleOf(FrameRate)

    Checks if this FrameRate is a multiple of another.

    Declaration
    public readonly bool IsMultipleOf(FrameRate other)
    Parameters
    Type Name Description
    FrameRate other

    The frame rate to compare against.

    Returns
    Type Description
    Boolean

    true if this frame rate is a multiple of other; otherwise, false.

    Remarks

    This is based on the time between frames, so 24 fps is considered a multiple of 48 fps.

    IsNtsc(Int32, Int32)

    Checks if a frame rate is an NTSC frame rate (23.976, 29.970, 59.94).

    Declaration
    public static bool IsNtsc(int numerator, int denominator)
    Parameters
    Type Name Description
    Int32 numerator

    The frame rate fraction numerator.

    Int32 denominator

    The frame rate fraction denominator.

    Returns
    Type Description
    Boolean

    true if the given fraction corresponds to an NTSC frame rate; otherwise, false.

    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()

    Operators

    Division(FrameRate, FrameRate)

    Computes the division of two FrameRate values.

    Declaration
    public static FrameRate operator /(FrameRate a, FrameRate b)
    Parameters
    Type Name Description
    FrameRate a

    The dividend.

    FrameRate b

    The divisor.

    Returns
    Type Description
    FrameRate

    The quotient.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting frame rate is not representable using the FrameRate type.

    Equality(FrameRate, FrameRate)

    Indicates whether two specified instances of FrameRate are equal.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    Explicit(FrameRate to Double)

    Gets the value of a FrameRate in Hz as a Double.

    Declaration
    public static explicit operator double (FrameRate rate)
    Parameters
    Type Name Description
    FrameRate rate

    The value to cast.

    Returns
    Type Description
    Double

    The frame rate in Hz.

    Explicit(FrameRate to Single)

    Gets the value of a FrameRate in Hz as a Single.

    Declaration
    public static explicit operator float (FrameRate rate)
    Parameters
    Type Name Description
    FrameRate rate

    The value to cast.

    Returns
    Type Description
    Single

    The frame rate in Hz.

    GreaterThan(FrameRate, FrameRate)

    Indicates whether one specified FrameRate is greater than another specified FrameRate.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    GreaterThanOrEqual(FrameRate, FrameRate)

    Indicates whether one specified FrameRate is greater than or the same as another specified FrameRate.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    Implicit(StandardFrameRate to FrameRate)

    Declaration
    public static implicit operator FrameRate(StandardFrameRate rate)
    Parameters
    Type Name Description
    StandardFrameRate rate
    Returns
    Type Description
    FrameRate

    Inequality(FrameRate, FrameRate)

    Indicates whether two specified instances of FrameRate are not equal.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    LessThan(FrameRate, FrameRate)

    Indicates whether one specified FrameRate is less than another specified FrameRate.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    LessThanOrEqual(FrameRate, FrameRate)

    Indicates whether one specified FrameRate is less than or the same as another specified FrameRate.

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

    The first instance to compare.

    FrameRate b

    The second instance to compare.

    Returns
    Type Description
    Boolean

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

    Multiply(FrameRate, FrameRate)

    Computes the multiple of two FrameRate values.

    Declaration
    public static FrameRate operator *(FrameRate a, FrameRate b)
    Parameters
    Type Name Description
    FrameRate a

    The first operand.

    FrameRate b

    The second operand.

    Returns
    Type Description
    FrameRate

    The multiplied frame rate.

    Exceptions
    Type Condition
    OverflowException

    Thrown if the resulting frame rate is not representable using the FrameRate type.

    Extension Methods

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