UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ModulationMatrix.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7#define MOD_MATRIX_DEBUG_NAMES 1
8
9namespace Audio
10{
12 {
14 : Id(INDEX_NONE)
15 {}
16
18 : Id(InId)
19 {}
20
21 void SetName(const FString& InName)
22 {
23#if MOD_MATRIX_DEBUG_NAMES
24 Name = InName;
25#endif
26 }
27
29
30#if MOD_MATRIX_DEBUG_NAMES
31 FString Name;
32#endif
33
34 };
35
37 {
39 : Id(INDEX_NONE)
41 , Depth(0.0f)
42 {}
43
45 : Id(InId)
47 , Depth(0.0f)
48 {}
49
51
53 float Depth;
54
55 void SetName(const FString& InName)
56 {
57#if MOD_MATRIX_DEBUG_NAMES
58 Name = InName;
59#endif
60 }
61
62#if MOD_MATRIX_DEBUG_NAMES
63 FString Name;
64#endif
65 };
66
67 struct FPatch
68 {
71 , bEnabled(true)
72 {
73 }
74
81
82 void SetName(const FString& InName)
83 {
84#if MOD_MATRIX_DEBUG_NAMES
85 Name = InName;
86#endif
87 }
88
89 // The modulation source of the patch
91
92 // The modulation destinations of the patch to support multiple destinations
94
95#if MOD_MATRIX_DEBUG_NAMES
96 FString Name;
97#endif
99 };
100
102 {
103 public:
106
107 // Initialize the modulation matrix with the desired number of voices
109
110 // Returns the number of patch connections
111 SIGNALPROCESSING_API int32 GetNumPatches(const int32 VoiceId) const;
112
113 // Creates a new patch source object and returns the patch source id
115
116 // Crates a new patch destination object and returns the patch destination id
118
119 // Adds a new patch connection between one source and one or more destinations
120 SIGNALPROCESSING_API bool AddPatch(const int32 VoiceId, FPatch* Patch);
121
122 // Removes the given patch connection between a source and one or more destinations
123 SIGNALPROCESSING_API bool RemovePatch(const int32 VoiceId, FPatch* Patch);
124
125 // Reset all patch state
127
128 // Clear all patch connections
129 SIGNALPROCESSING_API void ClearPatches(const int32 VoiceId);
130
131 // Set the modulation source value of the given id
132 SIGNALPROCESSING_API bool SetSourceValue(const int32 VoiceId, const FPatchSource& Source, const float Value);
133
134 // Get the modulation destination value of the given destination id
135 SIGNALPROCESSING_API bool GetDestinationValue(const int32 VoiceId, const FPatchDestination& Destination, float& OutValue) const;
136
137 // Perform the matrix update. Optionally do only a given stage.
138 SIGNALPROCESSING_API void Update(const int32 VoiceId, const int32 Stage = INDEX_NONE);
139
140 protected:
141
142 SIGNALPROCESSING_API void ResetDestinations(const int32 VoiceId);
144
148
150 {
151 // What the value of the destination is
152 float Value;
153
154 // Whether or not anybody changed it
155 bool bDirty;
156
158 : Value(0.0f)
159 , bDirty(false)
160 {}
161 };
162
164 };
165
166}
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Patch
Patch version increments fix existing functionality without changing the API.
return true
Definition ExternalRpcRegistry.cpp:601
void Init()
Definition LockFreeList.h:4
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ModulationMatrix.h:102
SIGNALPROCESSING_API void ResetPatchSourceState()
Definition ModulationMatrix.cpp:103
int32 NumVoices
Definition ModulationMatrix.h:145
SIGNALPROCESSING_API void ClearPatches(const int32 VoiceId)
Definition ModulationMatrix.cpp:114
SIGNALPROCESSING_API bool GetDestinationValue(const int32 VoiceId, const FPatchDestination &Destination, float &OutValue) const
Definition ModulationMatrix.cpp:139
TArray< TArray< FPatch * > > Patches
Definition ModulationMatrix.h:146
SIGNALPROCESSING_API bool RemovePatch(const int32 VoiceId, FPatch *Patch)
Definition ModulationMatrix.cpp:83
SIGNALPROCESSING_API FPatchSource CreatePatchSource(const int32 VoiceId)
Definition ModulationMatrix.cpp:33
TArray< TArray< FDestData > > Destinations
Definition ModulationMatrix.h:163
SIGNALPROCESSING_API int32 GetNumPatches(const int32 VoiceId) const
Definition ModulationMatrix.cpp:27
SIGNALPROCESSING_API void ResetDestinations(const int32 VoiceId)
Definition ModulationMatrix.cpp:154
SIGNALPROCESSING_API FPatchDestination CreatePatchDestination(const int32 VoiceId, const int32 Stage, const float DefaultDepth)
Definition ModulationMatrix.cpp:41
virtual SIGNALPROCESSING_API ~FModulationMatrix()
Definition ModulationMatrix.cpp:12
SIGNALPROCESSING_API bool AddPatch(const int32 VoiceId, FPatch *Patch)
Definition ModulationMatrix.cpp:71
SIGNALPROCESSING_API FModulationMatrix()
Definition ModulationMatrix.cpp:7
TArray< TArray< float > > Sources
Definition ModulationMatrix.h:147
SIGNALPROCESSING_API bool SetSourceValue(const int32 VoiceId, const FPatchSource &Source, const float Value)
Definition ModulationMatrix.cpp:128
SIGNALPROCESSING_API bool ValidatePatch(const int32 VoiceId, FPatch *Patch)
Definition ModulationMatrix.cpp:51
Definition Array.h:670
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53
@ false
Definition radaudio_common.h:23
Definition ModulationMatrix.h:150
float Value
Definition ModulationMatrix.h:152
FDestData()
Definition ModulationMatrix.h:157
bool bDirty
Definition ModulationMatrix.h:155
Definition ModulationMatrix.h:37
FString Name
Definition ModulationMatrix.h:63
FPatchDestination()
Definition ModulationMatrix.h:38
FPatchDestination(const uint32 InId)
Definition ModulationMatrix.h:44
uint32 Id
Definition ModulationMatrix.h:50
int32 Stage
Definition ModulationMatrix.h:52
void SetName(const FString &InName)
Definition ModulationMatrix.h:55
float Depth
Definition ModulationMatrix.h:53
Definition ModulationMatrix.h:12
FPatchSource()
Definition ModulationMatrix.h:13
FPatchSource(const uint32 InId)
Definition ModulationMatrix.h:17
void SetName(const FString &InName)
Definition ModulationMatrix.h:21
FString Name
Definition ModulationMatrix.h:31
uint32 Id
Definition ModulationMatrix.h:28
Definition ModulationMatrix.h:68
FPatchSource Source
Definition ModulationMatrix.h:90
FString Name
Definition ModulationMatrix.h:96
FPatch(const FPatchSource &InSourceId, const FPatchDestination &InDestinationId)
Definition ModulationMatrix.h:75
FPatch()
Definition ModulationMatrix.h:69
bool bEnabled
Definition ModulationMatrix.h:98
void SetName(const FString &InName)
Definition ModulationMatrix.h:82
TArray< FPatchDestination > Destinations
Definition ModulationMatrix.h:93