Class XrHapticPcmVibrationFB

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<XrHapticPcmVibrationFB>
org.lwjgl.openxr.XrHapticPcmVibrationFB
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class XrHapticPcmVibrationFB extends org.lwjgl.system.Struct<XrHapticPcmVibrationFB> implements org.lwjgl.system.NativeResource
Haptic Effect Description.
Description

This structure describes a PCM haptic effect.

The runtime may resample the provided samples in the buffer, and maintain an internal buffer which should be of MAX_HAPTIC_PCM_BUFFER_SIZE_FB length. The resampling should happen based on the sampleRate and the device’s sample rate.

If append is TRUE and a preceding XrHapticPcmVibrationFB haptic effect on this action has not yet completed, then the runtime must finish playing the preceding samples and then play the new haptic effect. If a preceding haptic event on this action has not yet completed, and either the preceding effect is not an XrHapticPcmVibrationFB haptic effect or append is FALSE, the runtime must cancel the preceding incomplete effects on that action and start playing the new haptic effect, as usual for the core specification.

When append is true and a preceding XrHapticPcmVibrationFB haptic effect on this action has not yet completed, then the application can provide a different sampleRate in the new haptic effect.

The runtime must populate the samplesConsumed with the count of the samples from buffer which were consumed. The samplesConsumed is populated before the ApplyHapticFeedback returns.

Valid Usage (Implicit)

Layout


 struct XrHapticPcmVibrationFB {
     XrStructureType type();
     void const * next();
     uint32_t bufferSize();
     float const * buffer();
     float sampleRate();
     XrBool32 append();
     uint32_t * samplesConsumed(int);
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • TYPE

      public static final int TYPE
      The struct member offsets.
    • NEXT

      public static final int NEXT
      The struct member offsets.
    • BUFFERSIZE

      public static final int BUFFERSIZE
      The struct member offsets.
    • BUFFER

      public static final int BUFFER
      The struct member offsets.
    • SAMPLERATE

      public static final int SAMPLERATE
      The struct member offsets.
    • APPEND

      public static final int APPEND
      The struct member offsets.
    • SAMPLESCONSUMED

      public static final int SAMPLESCONSUMED
      The struct member offsets.
  • Constructor Details

    • XrHapticPcmVibrationFB

      public XrHapticPcmVibrationFB(ByteBuffer container)
      Creates a XrHapticPcmVibrationFB instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<XrHapticPcmVibrationFB>
    • type

      public int type()
      the XrStructureType of this structure.
    • next

      public long next()
      NULL or a pointer to the next structure in a structure chain. No such structures are defined in core OpenXR or this extension.
    • bufferSize

      public int bufferSize()
      the number of samples in the buffer.
    • buffer

      public FloatBuffer buffer()
      a pointer to a float array representing the PCM samples. If you consider the haptic effect as a sampled analog audio, then this buffer will contain the samples representing that effect. The values in this buffer are expected to be in the range [-1.0, 1.0].
    • sampleRate

      public float sampleRate()
      the number of samples to be played per second, this is used to determine the duration of the haptic effect.
    • append

      public boolean append()
      if set to FALSE, any existing samples will be cleared and a new haptic effect will begin, if TRUE, samples will be appended to the currently playing effect
    • samplesConsumed

      public IntBuffer samplesConsumed(int capacity)
      Parameters:
      capacity - the number of elements in the returned buffer
      Returns:
      a pointer to an unsigned integer; it is populated by runtime, to tell the application about how many samples were consumed from the input buffer
    • type

      public XrHapticPcmVibrationFB type(int value)
      Sets the specified value to the type() field.
    • type$Default

      public XrHapticPcmVibrationFB type$Default()
      Sets the TYPE_HAPTIC_PCM_VIBRATION_FB value to the type() field.
    • next

      public XrHapticPcmVibrationFB next(long value)
      Sets the specified value to the next() field.
    • buffer

      public XrHapticPcmVibrationFB buffer(FloatBuffer value)
      Sets the address of the specified FloatBuffer to the buffer() field.
    • sampleRate

      public XrHapticPcmVibrationFB sampleRate(float value)
      Sets the specified value to the sampleRate() field.
    • append

      public XrHapticPcmVibrationFB append(boolean value)
      Sets the specified value to the append() field.
    • samplesConsumed

      public XrHapticPcmVibrationFB samplesConsumed(IntBuffer value)
      Sets the address of the specified IntBuffer to the samplesConsumed(int) field.
    • set

      public XrHapticPcmVibrationFB set(int type, long next, FloatBuffer buffer, float sampleRate, boolean append, IntBuffer samplesConsumed)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static XrHapticPcmVibrationFB malloc()
      Returns a new XrHapticPcmVibrationFB instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static XrHapticPcmVibrationFB calloc()
      Returns a new XrHapticPcmVibrationFB instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static XrHapticPcmVibrationFB create()
      Returns a new XrHapticPcmVibrationFB instance allocated with BufferUtils.
    • create

      public static XrHapticPcmVibrationFB create(long address)
      Returns a new XrHapticPcmVibrationFB instance for the specified memory address.
    • createSafe

      public static @Nullable XrHapticPcmVibrationFB createSafe(long address)
      Like create, but returns null if address is NULL.
    • create

      public static XrHapticPcmVibrationFB create(XrHapticBaseHeader value)
      Downcasts the specified XrHapticBaseHeader instance to XrHapticPcmVibrationFB.
    • malloc

      public static XrHapticPcmVibrationFB.Buffer malloc(int capacity)
      Returns a new XrHapticPcmVibrationFB.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static XrHapticPcmVibrationFB.Buffer calloc(int capacity)
      Returns a new XrHapticPcmVibrationFB.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static XrHapticPcmVibrationFB.Buffer create(int capacity)
      Returns a new XrHapticPcmVibrationFB.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static XrHapticPcmVibrationFB.Buffer create(long address, int capacity)
      Create a XrHapticPcmVibrationFB.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable XrHapticPcmVibrationFB.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • create

      Downcasts the specified XrHapticBaseHeader.Buffer instance to XrHapticPcmVibrationFB.Buffer.
    • malloc

      public static XrHapticPcmVibrationFB malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new XrHapticPcmVibrationFB instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static XrHapticPcmVibrationFB calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new XrHapticPcmVibrationFB instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static XrHapticPcmVibrationFB.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new XrHapticPcmVibrationFB.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static XrHapticPcmVibrationFB.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new XrHapticPcmVibrationFB.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • ntype

      public static int ntype(long struct)
      Unsafe version of type().
    • nnext

      public static long nnext(long struct)
      Unsafe version of next().
    • nbufferSize

      public static int nbufferSize(long struct)
      Unsafe version of bufferSize().
    • nbuffer

      public static FloatBuffer nbuffer(long struct)
      Unsafe version of buffer.
    • nsampleRate

      public static float nsampleRate(long struct)
      Unsafe version of sampleRate().
    • nappend

      public static int nappend(long struct)
      Unsafe version of append().
    • nsamplesConsumed

      public static IntBuffer nsamplesConsumed(long struct, int capacity)
      Unsafe version of samplesConsumed.
    • ntype

      public static void ntype(long struct, int value)
      Unsafe version of type.
    • nnext

      public static void nnext(long struct, long value)
      Unsafe version of next.
    • nbufferSize

      public static void nbufferSize(long struct, int value)
      Sets the specified value to the bufferSize field of the specified struct.
    • nbuffer

      public static void nbuffer(long struct, FloatBuffer value)
      Unsafe version of buffer.
    • nsampleRate

      public static void nsampleRate(long struct, float value)
      Unsafe version of sampleRate.
    • nappend

      public static void nappend(long struct, int value)
      Unsafe version of append.
    • nsamplesConsumed

      public static void nsamplesConsumed(long struct, IntBuffer value)
      Unsafe version of samplesConsumed.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate