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
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.
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
Copyright 2014-2026 The Khronos Group Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.