Navigation
API > API/Runtime > API/Runtime/Engine
SoundNodeDistanceCrossFade
This node's purpose is to play different sounds based on the distance to the listener. The node mixes between the N different sounds which are valid for the distance. One should think of a SoundNodeDistanceCrossFade as Mixer node which determines the set of nodes to "mix in" based on their distance to the sound.
Example: You have a gun that plays a fire sound. At long distances you want a different sound than if you were up close. So you use a SoundNodeDistanceCrossFade which will calculate the distance a listener is from the sound and play either: short distance, long distance, mix of short and long sounds.
A SoundNodeDistanceCrossFade differs from an SoundNodeAttenuation in that any sound is only going be played if it is within the MinRadius and MaxRadius. So if you want the short distance sound to be heard by people close to it, the MinRadius should probably be 0
The volume curve for a SoundNodeDistanceCrossFade will look like this: Volume (of the input) FadeInDistance.Max --> _________ < FadeOutDistance.Min / \ / \ / \ FadeInDistance.Min -->/ \ < FadeOutDistance.Max
| Name | USoundNodeDistanceCrossFade |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Sound/SoundNodeDistanceCrossFade.h |
| Include Path | #include "Sound/SoundNodeDistanceCrossFade.h" |
Syntax
UCLASS (HideCategories=Object, EditInlineNew, MinimalAPI,
Meta=(DisplayName="Crossfade by Distance"))
class USoundNodeDistanceCrossFade : public USoundNode
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → USoundNode → USoundNodeDistanceCrossFade
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
USoundNodeDistanceCrossFade
(
const FObjectInitializer& ObjectInitializer |
Sound/SoundNodeDistanceCrossFade.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CrossFadeInput | TArray< struct FDistanceDatum > | Each input needs to have the correct data filled in so the SoundNodeDistanceCrossFade is able to determine which sounds to play | Sound/SoundNodeDistanceCrossFade.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool AllowCrossfading
(
FActiveSound& ActiveSound |
Determines whether Crossfading is currently allowed for the active sound | Sound/SoundNodeDistanceCrossFade.h | |
virtual float GetCurrentDistance
(
FAudioDevice* AudioDevice, |
Sound/SoundNodeDistanceCrossFade.h | ||
virtual void ParseNodes
(
FAudioDevice* AudioDevice, |
Sound/SoundNodeDistanceCrossFade.h |
Overridden from USoundNode
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CreateStartingConnectors () |
Editor interface. | Sound/SoundNodeDistanceCrossFade.h | |
virtual int32 GetMaxChildNodes() |
Returns the maximum number of child nodes this node can possibly have | Sound/SoundNodeDistanceCrossFade.h | |
virtual float GetMaxDistance() |
Returns the maximum distance this sound can be heard from. | Sound/SoundNodeDistanceCrossFade.h | |
virtual int32 GetNumSounds
(
const UPTRINT NodeWaveInstanceHash, |
Returns the number of simultaneous sounds this node instance plays back. | Sound/SoundNodeDistanceCrossFade.h | |
virtual void InsertChildNode
(
int32 Index |
Sound/SoundNodeDistanceCrossFade.h | ||
virtual void RemoveChildNode
(
int32 Index |
Sound/SoundNodeDistanceCrossFade.h | ||
virtual void SetChildNodes
(
TArray< USoundNode* >& InChildNodes |
Ensure amount of Cross Fade inputs matches new amount of children | Sound/SoundNodeDistanceCrossFade.h |