Class SOFTDeviceClock

java.lang.Object
org.lwjgl.openal.SOFTDeviceClock

public class SOFTDeviceClock extends Object
Native bindings to the SOFT_device_clock extension.

This extension allows applications to query the timing clock from the audio device. This clock lets applications measure the passage of time as the audio device sees it, which may be slightly different than the system clock's tick rate (the infamous timer drift).

If the SOFT_pause_device extension is available, the device clock does not increment while the device playback is paused. It is implementation-defined whether or not the device clock increments while no contexts are allocated. The initial clock time value of an opened device is also implementation-defined, except that it must not be negative and should be low enough to avoid wrapping during program execution.

Requires SOFT_source_latency

  • Field Details

    • ALC_DEVICE_CLOCK_SOFT

      public static final int ALC_DEVICE_CLOCK_SOFT
      Accepted as the pname parameter of GetInteger64vSOFT.
      See Also:
    • ALC_DEVICE_LATENCY_SOFT

      public static final int ALC_DEVICE_LATENCY_SOFT
      Accepted as the pname parameter of GetInteger64vSOFT.
      See Also:
    • ALC_DEVICE_CLOCK_LATENCY_SOFT

      public static final int ALC_DEVICE_CLOCK_LATENCY_SOFT
      Accepted as the pname parameter of GetInteger64vSOFT.
      See Also:
    • AL_SAMPLE_OFFSET_CLOCK_SOFT

      public static final int AL_SAMPLE_OFFSET_CLOCK_SOFT
      Accepted as the param parameter of GetSourcei64vSOFT.

      Returns the playback position, expressed in fixed-point samples, along with the device clock, expressed in nanoseconds. This attribute is read-only.

      The first value in the returned vector is the sample offset, which is a 32.32 fixed-point value. The whole number is stored in the upper 32 bits and the fractional component is in the lower 32 bits. The value is similar to that returned by SAMPLE_OFFSET, just with more precision.

      The second value is the device clock, in nanoseconds. This updates at the same rate as the offset, and both are measured atomically with respect to one another.

      See Also:
    • AL_SEC_OFFSET_CLOCK_SOFT

      public static final int AL_SEC_OFFSET_CLOCK_SOFT
      Accepted as the param parameter of GetSourcedvSOFT.

      Returns the playback position, along with the device clock, both expressed in seconds. This attribute is read-only.

      The first value in the returned vector is the offset in seconds. The value is similar to that returned by SEC_OFFSET, just with more precision.

      The second value is the device clock, in seconds. This updates at the same rate as the offset, and both are measured atomically with respect to one another. Be aware that this value may be subtly different from the other device clock queries due to the variable precision of floating-point values.

      See Also:
  • Method Details

    • nalcGetInteger64vSOFT

      public static void nalcGetInteger64vSOFT(long device, int pname, int size, long values)
      Unsafe version of: GetInteger64vSOFT
    • alcGetInteger64vSOFT

      public static void alcGetInteger64vSOFT(long device, int pname, LongBuffer values)
      Accepts all the same GetIntegerv queries, in addition to some new ones.

      Note that the size parameter is the number of ALCint64SOFT elements in the buffer provided, not the number of bytes.

      Parameters:
      pname -
      DEVICE_CLOCK_SOFTThe audio device clock time, expressed in nanoseconds. NULL is an invalid device.
      DEVICE_LATENCY_SOFTThe current audio device latency, in nanoseconds. This is effectively the delay for the samples rendered at the the device's current clock time fromreaching the physical output. NULL is an invalid device.
      DEVICE_CLOCK_LATENCY_SOFTExpects a destination size of 2, and provides both the audio device clock time and latency, both in nanoseconds. The two values are measured atomically with respect to one another (i.e. the latency value was measured at the same time the device clock value was retrieved). NULL is an invalid device.
    • alcGetInteger64vSOFT

      public static long alcGetInteger64vSOFT(long device, int pname)
      Accepts all the same GetIntegerv queries, in addition to some new ones.

      Note that the size parameter is the number of ALCint64SOFT elements in the buffer provided, not the number of bytes.

      Parameters:
      pname -
      DEVICE_CLOCK_SOFTThe audio device clock time, expressed in nanoseconds. NULL is an invalid device.
      DEVICE_LATENCY_SOFTThe current audio device latency, in nanoseconds. This is effectively the delay for the samples rendered at the the device's current clock time fromreaching the physical output. NULL is an invalid device.
      DEVICE_CLOCK_LATENCY_SOFTExpects a destination size of 2, and provides both the audio device clock time and latency, both in nanoseconds. The two values are measured atomically with respect to one another (i.e. the latency value was measured at the same time the device clock value was retrieved). NULL is an invalid device.
    • alcGetInteger64vSOFT

      public static void alcGetInteger64vSOFT(long device, int pname, long[] values)
      Array version of: GetInteger64vSOFT