UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SoundNodeRandom.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4#pragma once
5
6#include "CoreMinimal.h"
8#include "Sound/SoundNode.h"
9#include "SoundNodeRandom.generated.h"
10
11class FAudioDevice;
12struct FActiveSound;
14struct FWaveInstance;
15
19UCLASS(hidecategories=Object, editinlinenew, MinimalAPI, meta=( DisplayName="Random" ))
21{
23
24 UPROPERTY(EditAnywhere, editfixedsize, Category=Random)
25 TArray<float> Weights;
26
32 TArray<bool> HasBeenUsed;
33
36 int32 NumRandomUsed;
37
42 UPROPERTY(EditAnywhere, Category=Random)
43 int32 PreselectAtLevelLoad;
44
48 UPROPERTY(EditAnywhere, Category = Random)
49 uint8 bShouldExcludeFromBranchCulling : 1;
50
52 UPROPERTY()
53 uint8 bSoundCueExcludedFromBranchCulling : 1;
54
66 UPROPERTY(EditAnywhere, Category=Random)
67 uint8 bRandomizeWithoutReplacement : 1;
68
69#if WITH_EDITORONLY_DATA
73#endif //WITH_EDITORONLY_DATA
74
75public:
76 //~ Begin UObject Interface
77 virtual void PostLoad() override;
78 virtual void PostEditImport() override;
79 //~ End UObject Interface
80
81 //~ Begin USoundNode Interface.
82 virtual void ParseNodes( FAudioDevice* AudioDevice, const UPTRINT NodeWaveInstanceHash, FActiveSound& ActiveSound, const FSoundParseParameters& ParseParams, TArray<FWaveInstance*>& WaveInstances ) override;
83 virtual int32 GetNumSounds(const UPTRINT NodeWaveInstanceHash, FActiveSound& ActiveSound) const override;
84 virtual int32 GetMaxChildNodes() const override
85 {
86 return MAX_ALLOWED_CHILD_NODES;
87 }
88 virtual void InsertChildNode( int32 Index ) override;
89 virtual void RemoveChildNode( int32 Index ) override;
90#if WITH_EDITOR
92 virtual void SetChildNodes(TArray<USoundNode*>& InChildNodes) override;
93 virtual void OnBeginPIE(const bool bIsSimulating) override;
94#endif //WITH_EDITOR
95 virtual void CreateStartingConnectors( void ) override;
96 //~ End USoundNode Interface.
97
98 // @todo document
99 void FixWeightsArray( void );
100
101 // @todo document
102 void FixHasBeenUsedArray( void );
103
104#if WITH_EDITOR
106#endif //WITH_EDITOR
107
108 int32 ChooseNodeIndex(FActiveSound& ActiveSound);
109
110private:
111
112 /*
113 * Determines the amount of branches to use on this random node, so that we can cull the rest.
114 * Based on the au.MaxRandomBranches CVar, the MaxNumRandomBranches project setting
115 * available for some platforms, and this node's PreselectAtLevelLoad FProperty.
116 * @return 0 if we do not want cull any branches.
117 */
118 int32 DetermineAmountOfBranchesToPreselect();
119
120};
121
122
123
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::UPTRINT UPTRINT
An unsigned integer the same size as a pointer.
Definition Platform.h:1146
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
int32 ParseParams(const FString &ParamStr, TArray< FString > &OutArray)
Definition NativeJSScripting.cpp:193
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition AudioDevice.h:417
Definition Array.h:670
Definition SoundNodeRandom.h:21
virtual int32 GetMaxChildNodes() const override
Definition SoundNodeRandom.h:84
Definition SoundNode.h:58
U16 Index
Definition radfft.cpp:71
Definition ActiveSound.h:283
Definition ActiveSound.h:64
Definition Audio.h:180
FActiveSound * ActiveSound
Definition Audio.h:208