au.Concurrency.MinVolumeScale

au.Concurrency.MinVolumeScale

#Overview

name: au.Concurrency.MinVolumeScale

This variable is created as a Console Variable (cvar).

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.Concurrency.MinVolumeScale is to set a minimum volume threshold for sound concurrency scaling in Unreal Engine 5’s audio system. This variable defines the lowest linear volume scale that is considered audible, below which sounds are treated as silent.

This setting variable is primarily used in the Engine’s audio subsystem, specifically within the sound concurrency management system. It’s part of the core Engine module, as evident from its location in the Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp file.

The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. Its default value is 1.e-3f (0.001 in linear scale).

The associated variable ConcurrencyMinVolumeScaleCVar directly interacts with au.Concurrency.MinVolumeScale. They share the same value, with ConcurrencyMinVolumeScaleCVar being the actual variable used in the C++ code.

Developers should be aware that this variable affects how the engine determines when a sound is considered silent for volume scaling purposes. It’s used in volume calculations and comparisons throughout the sound concurrency system.

Best practices when using this variable include:

  1. Avoid setting it too high, as it might cause audible sounds to be treated as silent.
  2. Avoid setting it too low, as it might cause unnecessary processing of imperceptibly quiet sounds.
  3. Consider the implications on performance and audio quality when adjusting this value.

Regarding the associated variable ConcurrencyMinVolumeScaleCVar:

When working with either of these variables, developers should consider the impact on the overall audio mix and performance of the sound system in their game.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:10

Scope: file

Source code excerpt:

static float ConcurrencyMinVolumeScaleCVar = 1.e-3f;
FAutoConsoleVariableRef CVarConcurrencyMinVolumeScale(
	TEXT("au.Concurrency.MinVolumeScale"),
	ConcurrencyMinVolumeScaleCVar,
	TEXT("Volume threshold considered silent for volume scaling (linear scale).\n"),
	ECVF_Default);


namespace SoundConcurrency

#Associated Variable and Callsites

This variable is associated with another variable named ConcurrencyMinVolumeScaleCVar. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:8

Scope: file

Source code excerpt:

DEFINE_LOG_CATEGORY(LogAudioConcurrency);

static float ConcurrencyMinVolumeScaleCVar = 1.e-3f;
FAutoConsoleVariableRef CVarConcurrencyMinVolumeScale(
	TEXT("au.Concurrency.MinVolumeScale"),
	ConcurrencyMinVolumeScaleCVar,
	TEXT("Volume threshold considered silent for volume scaling (linear scale).\n"),
	ECVF_Default);


namespace SoundConcurrency
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:125

Scope (from outer to inner):

file
function     float FConcurrencySoundData::GetVolume

Source code excerpt:

	
	float VolumeLin = Audio::ConvertToLinear(VolumeDb);
	if (VolumeLin < ConcurrencyMinVolumeScaleCVar || FMath::IsNearlyEqual(VolumeLin, ConcurrencyMinVolumeScaleCVar))
	{
		return 0.0f;
	}
	return VolumeLin;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:140

Scope (from outer to inner):

file
function     float FConcurrencySoundData::GetTargetVolume

Source code excerpt:


	const float VolumeLin = Audio::ConvertToLinear(DbTargetVolume);
	if (VolumeLin < ConcurrencyMinVolumeScaleCVar || FMath::IsNearlyEqual(VolumeLin, ConcurrencyMinVolumeScaleCVar))
	{
		return 0.0f;
	}

	return VolumeLin;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:151

Scope (from outer to inner):

file
function     void FConcurrencySoundData::SetTarget

Source code excerpt:

{
	DbStartVolume = GetVolume(true /* bInDecibels */);
	DbTargetVolume = Audio::ConvertToDecibels(InTargetVolume, ConcurrencyMinVolumeScaleCVar);
	LerpTime = FMath::Max(InLerpTime, 0.0f);
	Elapsed = 0.0f;
}

FConcurrencyGroup::FConcurrencyGroup(FConcurrencyGroupID InGroupID, const FConcurrencyHandle& ConcurrencyHandle)
	: GroupID(InGroupID)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundConcurrency.cpp:310

Scope (from outer to inner):

file
function     void FConcurrencyGroup::UpdateGeneration

Source code excerpt:

			const float AttackTime = NewActiveSound == ActiveSound ? 0.0f : Settings.VolumeScaleAttackTime;

			if (!FMath::IsNearlyEqual(AttackTime, SoundData->GetLerpTime()) || !FMath::IsNearlyEqual(SoundData->GetTargetVolume(), NewTargetVolume, ConcurrencyMinVolumeScaleCVar))
			{
				SoundConcurrency::SetSoundDataTarget(*ActiveSound, *SoundData, NewTargetVolume, AttackTime);
			}
		}
	}
}