OverallVolumeControlBus

OverallVolumeControlBus

#Overview

name: OverallVolumeControlBus

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 OverallVolumeControlBus is to manage the overall sound volume control in the Lyra game project of Unreal Engine 5. It is part of the audio system, specifically designed to handle user-configurable audio mix settings.

This setting variable is primarily used by the Lyra game’s audio subsystem, particularly within the LyraAudioMixEffectsSubsystem and LyraSettingsLocal modules. These modules are responsible for initializing and managing audio settings in the game.

The value of this variable is set in the LyraAudioSettings class, which inherits from UDeveloperSettings. It is defined as a config property, meaning it can be configured in the project settings or through configuration files.

OverallVolumeControlBus interacts with other audio-related variables, such as MusicVolumeControlBus and SoundFXVolumeControlBus, which are part of the same audio settings system. Together, these variables form a comprehensive audio control system for the game.

Developers must be aware that this variable is of type FSoftObjectPath, which means it’s a reference to a USoundControlBus object. The actual USoundControlBus is loaded dynamically at runtime, so developers should ensure that the referenced asset exists and is of the correct type.

Best practices when using this variable include:

  1. Ensuring the referenced USoundControlBus asset is properly set up in the project settings.
  2. Using the TryLoad() method to safely attempt loading the asset, as demonstrated in the code snippets.
  3. Properly handling cases where the asset fails to load or is of an incorrect type.
  4. Considering the impact on performance when loading and using this control bus, especially in performance-critical sections of the game.
  5. Coordinating with audio designers to ensure the control bus is set up correctly for the desired audio mixing behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:216, 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:89

Scope (from outer to inner):

file
function     void ULyraAudioMixEffectsSubsystem::PostInitialize

Source code excerpt:

		}

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

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

Scope (from outer to inner):

file
class        class ULyraAudioSettings : public UDeveloperSettings

Source code excerpt:

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

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

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

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

Scope (from outer to inner):

file
function     void ULyraSettingsLocal::LoadUserControlBusMix

Source code excerpt:

				ControlBusMap.Empty();

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