UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AudioBufferDistanceAttenuation.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Math/Vector2D.h"
8
9namespace Audio
10{
11 // Settings for audio buffer distance attenuation
13 {
16
17 // The min and max distance range to apply attenuation to the voip stream based on distance from listener.
18 FVector2D DistanceRange = { 400.0f, 4000.0f };
19
20 // The attenuation (in Decibels) at max range. The attenuation will be performed in dB and clamped to zero (linear) greater than max attenuation past the max range.
22
23 // A curve (values are expected to be normalized between 0.0 and 1.0) to use to control attenuation vs distance from listener.
25 };
26
27 // Processes the audio buffer with the given distance attenuation
28 // InOutAudioFrames - The audio buffer to attenuate. Note there is a function override for int16 and float formats.
29 // InFrameCount - The number of frames of audio in the buffer
30 // InNumChannels - The number of channels of audio in the buffer
31 // InDistance - The current distance to use to compute the attenuation
32 // InSettings - The settings to use to compute the attenuation
33 // InOutAttenuation - The input value of previous attenuation and the output value after performing the current distance
34 // attenuation. Use -1.0 if this is the first call to this function. The value is used to interpolate the attenuation smoothly.
38 float InDistance,
40 float& InOutAttenuation);
41
45 float InDistance,
47 float& InOutAttenuation);
48
49}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AudioLinearCurve.h:13
Definition ArrayView.h:139
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53
void DistanceAttenuationProcessAudio(TArrayView< int16 > &InOutBuffer, uint32 InNumChannels, float InDistance, const FAudioBufferDistanceAttenuationSettings &InSettings, float &InOutAttenuation)
Definition AudioBufferDistanceAttenuation.cpp:43
Definition AudioBufferDistanceAttenuation.h:13
float AttenuationDbAtMaxRange
Definition AudioBufferDistanceAttenuation.h:21
FVector2D DistanceRange
Definition AudioBufferDistanceAttenuation.h:18
Audio::FLinearCurve AttenuationCurve
Definition AudioBufferDistanceAttenuation.h:24