FAudioDeviceManager

Class for managing multiple audio devices.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/AudioDeviceManager.h

Include

#include "AudioDeviceManager.h"

Syntax

class FAudioDeviceManager

Remarks

Class for managing multiple audio devices.

Variables

Name Description

Public variable

TArray< FSoundB...

 

Buffers

Array of all created buffers

Public variable

TMap< int32, FS...

 

WaveBufferMap

Look up associating a USoundWave's resource ID with sound buffers

Constructors

Name Description

Public function

FAudioDeviceManager()

Constructor

Destructors

Name Description

Public function

~FAudioDeviceManager()

Destructor

Functions

Name Description

Public function

void

 

AddReferencedObjects

(
    FReferenceCollector& Collector
)

Tracks objects in the active audio devices.

Public function

bool

 

CreateMainAudioDevice()

Creates the main audio device.

Public function

void

 

FreeBufferResource

(
    FSoundBuffer* SoundBuffer
)

Frees the sound buffer from the device manager.

Public function

void

 

FreeResource

(
    USoundWave* SoundWave
)

Frees the given sound wave resource from the device manager

Public function Static

FAudioDevice...

 

Get()

Public function

FAudioDevice...

 

GetActiveAudioDevice()

Returns a ptr to the active audio device.

Public function

FAudioDevice...

 

GetAudioDevice

(
    Audio::FDeviceId InDeviceID
)

Returns a strong handle to the audio device associated with the given device ID.

Public function Static

FAudioDevice...

 

GetAudioDeviceFromWorldContext

(
    const UObject* WorldContextObj...
)

Public function

IAudioDevice...

 

GetAudioDeviceModule()

Returns the currently used audio device module for this platform.

Public function

FAudioDevice...

 

GetAudioDeviceRaw

(
    Audio::FDeviceId InDeviceID
)

Returns a raw ptr to the audio device associated with the handle.

Public function

TArray< FAud...

 

GetAudioDevices()

Returns all the audio devices managed by device manager.

Public function Static

Audio::FMixe...

 

GetAudioMixerDeviceFromWorldContext

(
    const UObject* WorldContextObj...
)

Public function

Audio::FAudi...

 

GetDebugger()

Get the audio debugger instance

Public function Const

const Audio:...

 

GetDebugger()

Get the audio debugger instance

Public function

FAudioDevice...

 

GetDefaultParamsForNewWorld()

Public function Const

float

 

GetDynamicSoundVolume

(
    ESoundType SoundType,
    const FName& SoundName
)

Get, reset, or set a sound cue trim

Public function Const

const FAudio...

 

GetMainAudioDeviceHandle()

Returns the handle to the main audio device.

Public function Const

Audio::FDevi...

 

GetMainAudioDeviceID()

Public function Const

FAudioDevice...

 

GetMainAudioDeviceRaw()

Public function Const

uint8

 

GetNumActiveAudioDevices()

Returns the current number of active audio devices.

Public function Const

uint8

 

GetNumMainAudioDeviceWorlds()

Returns the number of worlds (e.g. PIE viewports) using the main audio device.

Public function

FSoundBuffer...

 

GetSoundBufferForResourceID

(
    uint32 ResourceID
)

Retrieves the sound buffer for the given resource id

Public function

TArray< UWor...

 

GetWorldsUsingAudioDevice

(
    const Audio::FDeviceId& InID
)

Public function Static

bool

 

Initialize()

Initialize the audio device manager. Return true if successfully initialized.

Public function

void

 

InitSoundClasses()

Initializes the sound class for all active devices.

Public function

void

 

InitSoundEffectPresets()

Initialize all sound effect presets.

Public function

void

 

InitSoundSubmixes()

Initializes the sound mixes for all active devices.

Public function Const

bool

 

IsAlwaysPlayNonRealtimeDeviceAudio()

Gets whether or not non-realtime devices should play their audio.

Public function Const

bool

 

IsPlayAllDeviceAudio()

Gets whether or not all devices should play their audio.

Public function Const

bool

 

IsUsingAudioMixer()

Returns true if we're currently using the audio mixer.

Public function Const

bool

 

IsValidAudioDevice

(
    Audio::FDeviceId DeviceID
)

Returns whether the audio device handle is valid (i.e. points to an actual audio device instance)

Public function Const

bool

 

IsVisualizeDebug3dEnabled()

Is debug visualization of 3d sounds enabled

Public function

void

 

IterateOverAllDevices

(
    TUniqueFunction< void...
)

Public function

void

 

LogListOfAudioDevices()

Public function

void

 

RegisterSoundClass

(
    USoundClass* SoundClass
)

Registers the Sound Class for all active devices.

Public function

void

 

RegisterSoundSubmix

(
    USoundSubmixBase* SoundSubmix
)

Registers the Sound Mix for all active devices.

Public function

void

 

RegisterWorld

(
    UWorld* InWorld,
    Audio::FDeviceId DeviceId
)

Registers the world with the provided device Id

Public function

void

 

RemoveSoundBufferForResourceID

(
    uint32 ResourceID
)

Removes the sound buffer for the given resource id

Public function

void

 

RemoveSoundMix

(
    USoundMix* SoundMix
)

Removes sound mix from all audio devices

Public function

FAudioDevice...

 

RequestAudioDevice

(
    const FAudioDeviceParams& InParams
)

Creates or requests an audio device instance internally and returns a handle to the audio device.

Public function

void

 

ResetAllDynamicSoundVolumes()

Reset all sound cue trims

Public function

void

 

ResetDynamicSoundVolume

(
    ESoundType SoundType,
    const FName& SoundName
)

Public function

void

 

SetActiveDevice

(
    uint32 InAudioDeviceHandle
)

Sets which audio device is the active audio device.

Public function

void

 

SetAudioDevice

(
    UWorld& InWorld,
    Audio::FDeviceId InDeviceID
)

Sets the device associated with the given world.

Public function

void

 

SetDynamicSoundVolume

(
    ESoundType SoundType,
    const FName& SoundName,
    float Volume
)

Public function

void

 

SetSoloDevice

(
    Audio::FDeviceId InAudioDeviceHandl...
)

Sets an audio device to be solo'd

Public function Static

void

 

Shutdown()

Public function

void

 

StopSoundsUsingResource

(
    USoundWave* InSoundWave,
    TArray< UAudioComponent* >...
)

Stops sounds using the given resource on all audio devices.

Public function

void

 

StopSourcesUsingBuffer

(
    FSoundBuffer* Buffer
)

Stops using the given sound buffer. Called before freeing the buffer

Public function

void

 

TogglePlayAllDeviceAudio()

Toggles playing audio for all active PIE sessions (and all devices).

Public function

void

 

ToggleVisualize3dDebug()

Toggles 3d visualization of 3d sounds on/off

Public function

void

 

TrackResource

(
    USoundWave* SoundWave,
    FSoundBuffer* Buffer
)

Links up the resource data indices for looking up and cleaning up.

Public function

void

 

UnregisterSoundClass

(
    USoundClass* SoundClass
)

Unregisters the Sound Class for all active devices.

Public function

void

 

UnregisterSoundSubmix

(
    const USoundSubmixBase* SoundS...
)

Registers the Sound Mix for all active devices.

Public function

void

 

UnregisterWorld

(
    UWorld* InWorld,
    Audio::FDeviceId DeviceId
)

Unregisters the world from the provided device Id

Public function

void

 

UpdateActiveAudioDevices

(
    bool bGameTicking
)

Updates all active audio devices

Public function

void

 

UpdateSourceEffectChain

(
    const uint32 SourceEffectChainId,
    const TArray< FSourceEffectChainEnt...,
    const bool bPlayEffectChainTails
)

Updates source effect chain on all sources currently using the source effect chain.

Public function

void

 

UpdateSubmix

(
    USoundSubmixBase* SoundSubmix
)

Updates this submix for any changes made. Broadcasts to all submix instances.

Constants

Name

Description

Singleton