bEnableRealTimeAudio

bEnableRealTimeAudio

#Overview

name: bEnableRealTimeAudio

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 bEnableRealTimeAudio is to control whether real-time audio is enabled in the Unreal Editor. This setting specifically affects the editor environment and does not impact audio during Play-In-Editor (PIE) mode.

This setting variable is primarily used by the Unreal Editor subsystem, specifically within the UnrealEd module. It is part of the LevelEditorMiscSettings class, which inherits from UDeveloperSettings, indicating it’s a configurable setting for developers.

The value of this variable is set in the ULevelEditorMiscSettings class, which is likely loaded from a configuration file due to the UPROPERTY(config) attribute. It can also be modified at runtime through the MuteRealTimeAudio function in the UEditorEngine class.

bEnableRealTimeAudio interacts with the EditorVolumeLevel variable, which controls the global volume setting for the editor. Together, these variables manage the audio experience within the Unreal Editor.

Developers should be aware that this variable only affects the editor environment and not the game audio during play testing. It’s a boolean value stored as a bit flag (uint32 bEnableRealTimeAudio:1), so it can only be true or false.

Best practices when using this variable include:

  1. Use the provided UEditorEngine functions (IsRealTimeAudioMuted and MuteRealTimeAudio) to check or modify the setting, rather than accessing it directly.
  2. Consider the impact on performance when enabling real-time audio in the editor, especially for large or complex projects.
  3. Be mindful of the distinction between editor audio settings and in-game audio settings to avoid confusion during development.
  4. Use this setting in conjunction with EditorVolumeLevel for fine-grained control over the editor audio experience.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:212, 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:62

Scope (from outer to inner):

file
class        class ULevelEditorMiscSettings : public UDeveloperSettings

Source code excerpt:

	/** If true audio will be enabled in the editor. Does not affect PIE **/
	UPROPERTY(config)
	uint32 bEnableRealTimeAudio:1;

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

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

Scope (from outer to inner):

file
function     void UEditorEngine::Tick

Source code excerpt:


	// True if a viewport has realtime audio	// If any realtime audio is enabled in the editor
	bool bAudioIsRealtime = GetDefault<ULevelEditorMiscSettings>()->bEnableRealTimeAudio;

	// By default we tick the editor world.  
	// When in PIE if we are in immersive we do not tick the editor world unless there is a visible editor viewport.
	bool bShouldTickEditorWorld = true;

	// Conditionally disable all viewport rendering when the editor is in the background.

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

Scope (from outer to inner):

file
function     bool UEditorEngine::IsRealTimeAudioMuted

Source code excerpt:

bool UEditorEngine::IsRealTimeAudioMuted() const
{
	return GetDefault<ULevelEditorMiscSettings>()->bEnableRealTimeAudio ? false : true;
}

void UEditorEngine::MuteRealTimeAudio(bool bMute)
{
	ULevelEditorMiscSettings* LevelEditorMiscSettings = GetMutableDefault<ULevelEditorMiscSettings>();

	LevelEditorMiscSettings->bEnableRealTimeAudio = bMute ? false : true;
	LevelEditorMiscSettings->PostEditChange();
}

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