C Specification

The XrSoundObjectDistanceAttenuationBD structure is defined as:

// Provided by XR_BD_spatial_audio_rendering
typedef struct XrSoundObjectDistanceAttenuationBD {
    XrStructureType                             type;
    const void*                                 next;
    XrSoundObjectDistanceAttenuationTypeBD      distanceAttenuationType;
    float                                       minAttenuationRange;
    float                                       maxAttenuationRange;
    float                                       referenceDistance;
    float                                       rolloffFactor;
    XrSoundObjectDistanceAttenuationCurveBD*    customDistanceAttenuationCurve;
} XrSoundObjectDistanceAttenuationBD;

Members

Member Descriptions
  • type is the XrStructureType of this structure.

  • next is NULL or a pointer to the next structure in a structure chain. No such structures are defined in core OpenXR or this extension.

  • distanceAttenuationType is the type of this distance attenuation.

  • minAttenuationRange is the minimum distance of attenuation in meters. Any distance closer than this value will not cause less attenuation.

  • maxAttenuationRange is the maximum distance of attenuation in meters. Any distance further than this value will not cause more attenuation.

  • referenceDistance is the propagation distance in which sound is neither attenuated nor gained. It is ignored if distanceAttenuationType is not XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_ROLLOFF_BD.

  • rolloffFactor is the intensity of distance attenuation, which must be larger or equal to 0. It is ignored if distanceAttenuationType is not XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_ROLLOFF_BD.

  • customDistanceAttenuationCurve is a pointer to an XrSoundObjectDistanceAttenuationCurveBD structure defining an attenuation curve for a customized distance attenuation. It is ignored if distanceAttenuationType is not XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_CUSTOMIZED_BD

Description

When distanceAttenuationType is XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_NONE_BD, the runtime must not apply attenuation based on sound propagation distance, which means: attenuation(distance) = 1

When distanceAttenuationType is XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_INVERSE_SQUARE_BD, the runtime must use the following formulas to calculate the distance attenuation:

  • attenuation(d) = 1, d < rmin

  • attenuation(d) = 1/√(1 + (rmax - rmin)2), d > rmax

  • attenuation(d) = 1/√(1 + (d - rmin)2), otherwise

where:

  • d is the propagation distance of sound.

  • rmin is minAttenuationRange.

  • rmax is maxAttenuationRange.

When distanceAttenuationType is XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_ROLLOFF_BD, the runtime must use the following formulas to calculate the distance attenuation:

  • attenuation(d) = (rmin/dref)ρ, d < rmin

  • attenuation(d) = (rmax/dref)ρ, d > rmax

  • attenuation(d) = (d/dref)ρ, otherwise

where:

  • d is the propagation distance of sound.

  • rmin is minAttenuationRange.

  • rmax is maxAttenuationRange.

  • dref is referenceDistance.

  • ρ is rolloffFactor.

When distanceAttenuationType is XR_SOUND_OBJECT_DISTANCE_ATTENUATION_TYPE_CUSTOMIZED_BD, the application must set customDistanceAttenuationCurve to an XrSoundObjectDistanceAttenuationCurveBD structure defining the distance attenuation curve function to calculate the distance attenuation.

If minAttenuationRange is greater than maxAttenuationRange, the runtime must return XR_ERROR_VALIDATION_FAILURE.

Valid Usage (Implicit)

See Also

Document Notes

For more information, see the OpenXR Specification

This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2026 The Khronos Group Inc.