USoundNodeDistanceCrossFade

SoundNodeDistanceCrossFade

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Sound/SoundNodeDistanceCrossFade.h

Include

#include "Sound/SoundNodeDistanceCrossFade.h"

Syntax

class USoundNodeDistanceCrossFade : public USoundNode

Remarks

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

Variables

Name Description

Public variable

TArray< struct ...

 

CrossFadeInput

Each input needs to have the correct data filled in so the SoundNodeDistanceCrossFade is able to determine which sounds to play

Constructors

Name Description

Public function

USoundNodeDistanceCrossFade

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual Const

bool

 

AllowCrossfading

(
    FActiveSound& ActiveSound
)

Determines whether Crossfading is currently allowed for the active sound

Public function Virtual Const

float

 

GetCurrentDistance

(
    FAudioDevice* AudioDevice,
    FActiveSound& ActiveSound,
    const FSoundParseParameters& Parse...
)

Public function Virtual

void

 

ParseNodes

(
    FAudioDevice* AudioDevice,
    const UPTRINT NodeWaveInstanceHash,
    FActiveSound& ActiveSound,
    const FSoundParseParameters& Parse...,
    TArray< FWaveInstance* >& Wav...
)

Overridden from USoundNode

Name Description

Public function Virtual

void

 

CreateStartingConnectors()

Editor interface.

Public function Virtual Const

int32

 

GetMaxChildNodes()

Returns the maximum number of child nodes this node can possibly have

Public function Virtual Const

float

 

GetMaxDistance()

Returns the maximum distance this sound can be heard from.

Public function Virtual Const

int32

 

GetNumSounds

(
    const UPTRINT NodeWaveInstanceHash,
    FActiveSound& ActiveSound
)

Returns the number of simultaneous sounds this node instance plays back.

Public function Virtual

void

 

InsertChildNode

(
    int32 Index
)

Public function Virtual

void

 

RemoveChildNode

(
    int32 Index
)

Public function Virtual

void

 

SetChildNodes

(
    TArray< USoundNode* >& InChil...
)

Ensure amount of Cross Fade inputs matches new amount of children