SoundFXVolumeControlBus

SoundFXVolumeControlBus

#Overview

name: SoundFXVolumeControlBus

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SoundFXVolumeControlBus is to manage the volume control for sound effects in the Lyra game project within Unreal Engine 5. It is part of the audio system, specifically designed to handle user-adjustable sound effect volume settings.

This setting variable is primarily used in the Lyra game project, which is likely a sample or template project for Unreal Engine 5. It is utilized by the audio subsystem, particularly in the LyraAudioMixEffectsSubsystem and LyraSettingsLocal classes.

The value of this variable is set in the LyraAudioSettings class, which inherits from UDeveloperSettings. It is defined as a config property, meaning its value can be set in configuration files and edited in the Unreal Engine editor.

SoundFXVolumeControlBus interacts with other audio-related variables, such as DialogueVolumeControlBus and VoiceChat volume controls. It is part of a broader audio settings system that includes various volume controls for different types of audio in the game.

Developers must be aware that this variable is of type FSoftObjectPath, which is a path to a SoundControlBus object. It needs to be loaded before use, as seen in the code snippets where TryLoad() is called on the SoundFXVolumeControlBus.

Best practices when using this variable include:

  1. Ensure that the referenced SoundControlBus asset exists and is properly set up in the project.
  2. Use the TryLoad() method to safely attempt loading the asset, and always check if the cast to USoundControlBus is successful before using it.
  3. Consider the performance implications of loading this asset, especially if it’s done frequently or in performance-critical sections of code.
  4. Maintain consistency in how this control bus is used across the project to ensure a uniform audio experience for users.
  5. When modifying the audio settings, make sure to update all related systems that depend on this control bus to maintain synchronization of the audio state.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:218, section: [/Script/LyraGame.LyraAudioSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Audio/LyraAudioMixEffectsSubsystem.cpp:113

Scope (from outer to inner):

file
function     void ULyraAudioMixEffectsSubsystem::PostInitialize

Source code excerpt:

		}

		if (UObject* ObjPath = LyraAudioSettings->SoundFXVolumeControlBus.TryLoad())
		{
			if (USoundControlBus* SoundControlBus = Cast<USoundControlBus>(ObjPath))
			{
				SoundFXControlBus = SoundControlBus;
			}
			else

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Audio/LyraAudioSettings.h:56

Scope (from outer to inner):

file
class        class ULyraAudioSettings : public UDeveloperSettings

Source code excerpt:

	/** Control Bus assigned to the SoundFX sound volume setting */
	UPROPERTY(config, EditAnywhere, Category = UserMixSettings, meta = (AllowedClasses = "/Script/AudioModulation.SoundControlBus"))
	FSoftObjectPath SoundFXVolumeControlBus;

	/** Control Bus assigned to the Dialogue sound volume setting */
	UPROPERTY(config, EditAnywhere, Category = UserMixSettings, meta = (AllowedClasses = "/Script/AudioModulation.SoundControlBus"))
	FSoftObjectPath DialogueVolumeControlBus;

	/** Control Bus assigned to the VoiceChat sound volume setting */

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:1473

Scope (from outer to inner):

file
function     void ULyraSettingsLocal::LoadUserControlBusMix

Source code excerpt:

				}

				if (UObject* ObjPath = LyraAudioSettings->SoundFXVolumeControlBus.TryLoad())
				{
					if (USoundControlBus* SoundControlBus = Cast<USoundControlBus>(ObjPath))
					{
						SoundFXControlBus = SoundControlBus;
						ControlBusMap.Add(TEXT("SoundFX"), SoundFXControlBus);
					}