PanningMethod
PanningMethod
#Overview
name: PanningMethod
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PanningMethod is to determine the algorithm used for panning audio sources in the 3D space within Unreal Engine’s audio system. This setting variable is crucial for controlling how sound is distributed across different audio channels to create a sense of spatial positioning.
PanningMethod is primarily used in the Audio subsystem of Unreal Engine, specifically within the AudioMixer module. It’s an integral part of the FMixerDevice class, which is responsible for managing audio mixing and output.
The value of this variable is set from the UAudioSettings class, which is part of the Engine module. It’s configured as an UPROPERTY, allowing it to be set in the project settings or through Blueprint scripts.
PanningMethod interacts closely with other audio-related variables, such as MonoChannelUpmixMethod. Both of these variables are updated together when initializing or updating the audio hardware.
Developers must be aware that changing this variable affects how all 3D sounds are positioned in the game’s audio space. The chosen method can impact the perceived realism and immersion of the audio experience.
Best practices when using this variable include:
- Carefully considering the target platforms and their typical audio setups (e.g., headphones, surround sound systems) when choosing a panning method.
- Testing the audio experience with different panning methods to find the most suitable one for your game’s style and requirements.
- Ensuring consistency across different parts of the game by using the same panning method throughout, unless there’s a specific reason to change it.
- Being mindful of performance implications, as different panning methods may have varying computational costs.
- Documenting the chosen panning method and the rationale behind it for future reference and for other team members.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:264, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
EqualPower
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:519
Scope (from outer to inner):
file
namespace Audio
function bool FMixerDevice::InitializeHardware
Source code excerpt:
const UAudioSettings* AudioSettings = GetDefault<UAudioSettings>();
MonoChannelUpmixMethod = AudioSettings->MonoChannelUpmixMethod;
PanningMethod = AudioSettings->PanningMethod;
// Set whether we're the main audio mixer
bIsMainAudioMixer = IsMainAudioDevice();
AUDIO_MIXER_CHECK(SampleRate != 0.0f);
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:731
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::UpdateHardware
Source code excerpt:
const UAudioSettings* AudioSettings = GetDefault<UAudioSettings>();
MonoChannelUpmixMethod = AudioSettings->MonoChannelUpmixMethod;
PanningMethod = AudioSettings->PanningMethod;
}
SourceManager->Update();
AudioMixerPlatform->OnHardwareUpdate();
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2179
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::Get3DChannelMap
Source code excerpt:
float NextChannelPan;
if (PanningMethod == EPanningMethod::EqualPower)
{
FMath::SinCos(&NextChannelPan, &PrevChannelPan, Fraction * 0.5f * PI);
// Note that SinCos can return values slightly greater than 1.0 when very close to PI/2
NextChannelPan = FMath::Clamp(NextChannelPan, 0.0f, 1.0f);
PrevChannelPan = FMath::Clamp(PrevChannelPan, 0.0f, 1.0f);
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Public/AudioMixerDevice.h:415
Scope (from outer to inner):
file
namespace Audio
class class FMixerDevice : public FAudioDevice, public IAudioMixer, public FGCObject
Source code excerpt:
/** What panning method to use for panning. */
EPanningMethod PanningMethod;
/** The audio output stream parameters used to initialize the audio hardware. */
FAudioMixerOpenStreamParams OpenStreamParams;
/** The time delta for each callback block. */
double AudioClockDelta;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/AudioSettings.h:222
Scope (from outer to inner):
file
class class UAudioSettings : public UDeveloperSettings
Source code excerpt:
*/
UPROPERTY(config, EditAnywhere, Category = "Panning", AdvancedDisplay)
EPanningMethod PanningMethod;
/**
* The upmixing method for mono sound sources. Defines how mono channels are up-mixed to stereo channels.
*/
UPROPERTY(config, EditAnywhere, Category = "Mix", AdvancedDisplay)
EMonoChannelUpmixMethod MonoChannelUpmixMethod;