EditorVolumeLevel

EditorVolumeLevel

#Overview

name: EditorVolumeLevel

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 EditorVolumeLevel is to control the global volume setting for the Unreal Editor. This variable is used to adjust the audio volume level within the editor environment, separate from the game’s runtime audio settings.

This setting variable is primarily used by the Unreal Editor’s core subsystem, specifically within the UnrealEd module. It’s part of the LevelEditorMiscSettings class, which suggests it’s a miscellaneous editor setting related to level editing.

The value of this variable is set in the ULevelEditorMiscSettings class, which inherits from UDeveloperSettings. This means it’s likely configurable through the editor’s project settings interface.

EditorVolumeLevel interacts with the FApp::SetVolumeMultiplier function, which is called in the UEditorEngine::Tick function. It’s used to adjust the global volume multiplier when the editor window has focus and there’s no PIE (Play In Editor) world active.

Developers should be aware that this variable affects the editor’s audio volume, not the in-game audio. It’s important to distinguish between editor settings and runtime game settings when working with audio in Unreal Engine.

Best practices when using this variable include:

  1. Use the provided getter and setter functions (GetRealTimeAudioVolume and SetRealTimeAudioVolume) to access and modify the value, rather than directly manipulating the variable.
  2. Be mindful of how changes to this setting might affect the developer experience, especially in collaborative environments where different team members might have different preferences for editor audio levels.
  3. Consider exposing this setting in a user-friendly way if creating custom editor tools or extensions that deal with audio feedback in the editor.
  4. Remember that this setting is separate from in-game audio settings, so adjusting it won’t affect the audio levels in the final game build.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:214, section: [/Script/UnrealEd.LevelEditorMiscSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorMiscSettings.h:66

Scope (from outer to inner):

file
class        class ULevelEditorMiscSettings : public UDeveloperSettings

Source code excerpt:

	/** Global volume setting for the editor */
	UPROPERTY(config)
	float EditorVolumeLevel;

	/** Enables audio feedback for certain operations in Unreal Editor, such as entering and exiting Play mode */
	UPROPERTY(EditAnywhere, config, Category=Sound)
	uint32 bEnableEditorSounds:1;

public:

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:1752

Scope (from outer to inner):

file
function     void UEditorEngine::Tick

Source code excerpt:

		{
			// Adjust the global volume multiplier if the window has focus and there is no pie world or no viewport overriding audio.
			FApp::SetVolumeMultiplier( GetDefault<ULevelEditorMiscSettings>()->EditorVolumeLevel );
		}
		else
		{
			// If there is currently a pie world a viewport is overriding audio settings do not adjust the volume.
			FApp::SetVolumeMultiplier( 1.0f );
		}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:2419

Scope (from outer to inner):

file
function     float UEditorEngine::GetRealTimeAudioVolume

Source code excerpt:

float UEditorEngine::GetRealTimeAudioVolume() const
{
	return GetDefault<ULevelEditorMiscSettings>()->EditorVolumeLevel;
}

void UEditorEngine::SetRealTimeAudioVolume(float VolumeLevel)
{
	ULevelEditorMiscSettings* LevelEditorMiscSettings = GetMutableDefault<ULevelEditorMiscSettings>();

	LevelEditorMiscSettings->EditorVolumeLevel = VolumeLevel;
	LevelEditorMiscSettings->PostEditChange();
}

bool UEditorEngine::UpdateSingleViewportClient(FEditorViewportClient* InViewportClient, const bool bInAllowNonRealtimeViewportToDraw, bool bLinkedOrthoMovement, bool* bOutViewportDrawn /*= nullptr*/)
{
	bool bUpdatedNonRealtimeViewport = false;