UserSettingsControlBusMix

UserSettingsControlBusMix

#Overview

name: UserSettingsControlBusMix

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 UserSettingsControlBusMix is to provide a reference to a SoundControlBusMix asset that controls the audio mix settings for user-configurable sound options in the Lyra game project.

This setting variable is primarily used by the audio system in the Lyra game project, specifically within the LyraAudioMixEffectsSubsystem and LyraSettingsLocal classes. It’s part of the audio settings configuration for the game.

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

UserSettingsControlBusMix interacts with other audio-related variables, such as OverallVolumeControlBus, which is used in conjunction with this variable to set up the overall volume control.

Developers must be aware that this variable is a FSoftObjectPath, which means it’s a reference to an asset that may need to be loaded. The code checks if the asset can be loaded and casts it to the correct type (USoundControlBusMix) before using it.

Best practices when using this variable include:

  1. Ensuring the referenced SoundControlBusMix asset exists and is properly set up in the project settings.
  2. Handling cases where the asset might fail to load or isn’t of the expected type.
  3. Using this in conjunction with other audio settings to create a cohesive audio mixing system for user-configurable options.
  4. Understanding the AudioModulation system in Unreal Engine, as this variable is part of that framework.
  5. Consider the performance implications of loading and applying the control bus mix, especially if it’s done frequently or in performance-critical sections of the code.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
function     void ULyraAudioMixEffectsSubsystem::PostInitialize

Source code excerpt:

		}

		if (UObject* ObjPath = LyraAudioSettings->UserSettingsControlBusMix.TryLoad())
		{
			if (USoundControlBusMix* SoundControlBusMix = Cast<USoundControlBusMix>(ObjPath))
			{
				UserMix = SoundControlBusMix;
			}
			else

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

Scope (from outer to inner):

file
class        class ULyraAudioSettings : public UDeveloperSettings

Source code excerpt:

	/** The Default Base Control Bus Mix */
	UPROPERTY(config, EditAnywhere, Category = UserMixSettings, meta = (AllowedClasses = "/Script/AudioModulation.SoundControlBusMix"))
	FSoftObjectPath UserSettingsControlBusMix;

	/** 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 */

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

Scope (from outer to inner):

file
function     void ULyraSettingsLocal::LoadUserControlBusMix

Source code excerpt:

				}

				if (UObject* ObjPath = LyraAudioSettings->UserSettingsControlBusMix.TryLoad())
				{
					if (USoundControlBusMix* SoundControlBusMix = Cast<USoundControlBusMix>(ObjPath))
					{
						ControlBusMix = SoundControlBusMix;

						const FSoundControlBusMixStage OverallControlBusMixStage = UAudioModulationStatics::CreateBusMixStage(World, OverallControlBus, OverallVolume);