I’ll preface this by saying that I am very new to C++ and fairly new to coding in general so I apologize if my code or terminology isn’t up to par.
I’ve got a game at the moment that picks up audio input from a microphone and plays it back through the speakers with a 0.4 second buffer. My question is how can I use C++ to increase a post processing effect (bloom intensity for example) while the player is making noise and then decrease the effect while they aren’t?
The function in the .cpp file that actually plays the audio back is as follows:
Alright I finally figured it out, you need to set a variable to carry the post processing data through a struct FPostProcessSettings myVar and then also set it to be able to override. Here’s basically what’s needed:
//.h
//Create your camera component
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class UCameraComponent* CameraComponentName;
//create your variable that will carry the post processing data that you want affected
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
struct FPostProcessSettings VariableName;
//.cpp
//Initiate your variable
FPostProcessSettings VariableName;
//Allow your variable to override the setting that you want to affect
VariableName.bOverride_BloomIntensity = true;
//Set the variable to the value you want for your setting
VariableName.BloomIntensity = 50.f;
//Get the post process settings of your camera and set them to your variable
CameraComponentName->PostProcessSettings = VariableName;
You might need to #include “SceneManagement.h” and/or “SceneInterface.h”
With this, you can have a function that sets your variable- in my case, bloom intensity- to one value on an if statement and to another value on your else or another if like so: