FMixerSubmix

Choose your operating system:

Windows

macOS

Linux

References

Module

AudioMixer

Header

/Engine/Source/Runtime/AudioMixer/Public/AudioMixerSubmix.h

Include

#include "AudioMixerSubmix.h"

Syntax

class FMixerSubmix

Variables

Name Description

Protected variable

TUniquePtr< IAu...

 

AudioLinkInstance

Protected variable

double

 

AutoDisableTime

The time to wait to disable the submix if the auto-disablement is active.

Protected variable

uint8: 1

 

bAutoDisable

Whether or not auto-disablement is enabled. If true, the submix will disable itself.

Protected variable

uint8: 1

 

bIsBackgroundMuted

Whether or not this submix is muted.

Protected variable

uint8: 1

 

bIsCurrentlyDisabled

Whether or not we're currently disabled (i.e. the submix has been silent)

Protected variable

FThreadSafeBool

 

bIsEnvelopeFollowing

Bool set to true when envelope following is enabled.

Protected variable

uint8: 1

 

bIsRecording

Bool set to true when this submix is recording data.

Protected variable

uint8: 1

 

bIsSilent

Whether or not the submix is currently rendering audio. I.e. audio was sent to it and mixing it, or any of its child submixes are rendering audio.

Protected variable

FThreadSafeBool

 

bIsSpectrumAnalyzing

Bool set to true when spectrum analysis is enabled.

Protected variable

FCriticalSectio...

 

BufferListenerCriticalSection

Critical section used for modifying and interacting with buffer listeners.

Protected variable

TArray< ISubmix...

 

BufferListeners

List of submix buffer listeners.

Protected variable

TMap< uint32, F...

 

ChildSubmixes

Child submixes.

Protected variable

TQueue< TFuncti...

 

CommandQueue

Submix command queue to shuffle commands from audio thread to audio render thread.

Protected variable

float

 

CurrentDryLevel

Protected variable

float

 

CurrentOutputVolume

Protected variable

float

 

CurrentWetLevel

Protected variable

FAlignedFloatBu...

 

DownmixedBuffer

Protected variable

FAlignedFloatBu...

 

DryChannelBuffer

The dry channel buffer.

Protected variable

FModulationDest...

 

DryLevelMod

Protected variable

float

 

DryModBase

Protected variable

FCriticalSectio...

 

EffectChainMutationCriticalSection

Critical section for mutation of the effect chain.

Protected variable

FAlignedFloatBu...

 

EffectChainOutputBuffer

Protected variable

TArray< FSubmix...

 

EffectChains

The array of submix effect overrides. There may be more than one if multiple are fading out. There should be only one fading in (the current override).

Protected variable

FEndpointData

 

EndpointData

Protected variable

FCriticalSectio...

 

EnvelopeCriticalSection

Protected variable

Audio::FEnvelop...

 

EnvelopeFollower

Protected variable

int32

 

EnvelopeNumChannels

Protected variable

float[8]

 

EnvelopeValues

Envelope following data.

Protected variable

uint32

 

Id

This mixer submix's Id.

Protected variable

FAlignedFloatBu...

 

InputBuffer

Protected variable

FMixerDevice &#...

 

MixerDevice

Owning mixer device.

Protected variable

TMap< FMixerSou...

 

MixerSourceVoices

Map of mixer source voices with a given send level for this submix.

Protected variable

FAlignedFloatBu...

 

MonoMixBuffer

This buffer is used to downmix the submix output to mono before submitting it to the SpectrumAnalyzer.

Protected variable

int32

 

NumChannels

Protected variable

int32

 

NumSamples

Protected variable

int32

 

NumSubmixEffects

Returns the number of submix effects.

Protected variable

FOnSubmixEnvelo...

 

OnSubmixEnvelope

Multi-cast delegate to broadcast envelope data from this submix instance.

Protected variable

TWeakObjectPtr<...

 

OwningSubmixObject

Handle back to the owning USoundSubmix. Used when the device is shutdown to prematurely end a recording.

Protected variable

TWeakPtr< FMixe...

 

ParentSubmix

Parent submix.

Protected variable

Audio::FPatchSp...

 

PatchSplitter

Protected variable

FCriticalSectio...

 

RecordingCriticalSection

Critical section used for when we are appending recorded data.

Protected variable

FAlignedFloatBu...

 

RecordingData

This buffer is used for recorded output of the submix.

Protected variable

FAlignedFloatBu...

 

ScratchBuffer

Protected variable

double

 

SilenceTimeStartSeconds

The time that the first full silent buffer was detected in the submix. Submix will auto-disable if the timeout is reached and the submix has bAutoDisable set to true.

Protected variable

FSoundfieldStre...

 

SoundfieldStreams

Protected variable

FAlignedFloatBu...

 

SourceInputBuffer

Protected variable

TArray< FSpectr...

 

SpectralAnalysisDelegates

Protected variable

TSharedPtr< FAs...

 

SpectrumAnalyzer

Protected variable

FCriticalSectio...

 

SpectrumAnalyzerCriticalSection

Spectrum analyzer. Created and destroyed on the audio thread.

Protected variable

FSoundSpectrumA...

 

SpectrumAnalyzerSettings

Protected variable

FAlignedFloatBu...

 

SubmixChainMixBuffer

Protected variable

FString

 

SubmixName

The name of this submix (the owning USoundSubmix)

Protected variable

float

 

TargetDryLevel

Protected variable

float

 

TargetOutputVolume

Protected variable

float

 

TargetWetLevel

Protected variable

FModulationDest...

 

VolumeMod

Protected variable

float

 

VolumeModBase

Protected variable

FModulationDest...

 

WetLevelMod

Protected variable

float

 

WetModBase

Constructors

Name Description

Public function

FMixerSubmix

(
    FMixerDevice* InMixerDevice
)

Destructors

Name Description

Public function Virtual

~FMixerSubmix()

Functions

Name Description

Public function

void

 

AddChildSubmix

Adds the given submix to this submix's children.

Public function

void

 

AddEnvelopeFollowerDelegate

(
    const FOnSubmixEnvelopeBP& OnSubmi...
)

Adds an envelope follower delegate.

Public function

void

 

AddOrSetSourceVoice

(
    FMixerSourceVoice* InSourceVoi...,
    const float SendLevel,
    EMixerSourceSubmixSendStage InSubmi...
)

Add (if not already added) or sets the amount of the source voice's send amount.

Public function

FPatchOutput...

 

AddPatch

(
    float InGain
)

Public function

void

 

AddSoundEffectSubmix

(
    FSoundEffectSubmixPtr InSoundEffect...
)

Appends the effect submix to the effect submix chain.

Public function

void

 

AddSpectralAnalysisDelegate

(
    const FSoundSpectrumAnalyzerDelegat...,
    const FOnSubmixSpectralAnalysisBP&...
)

Adds an spectral analysis delegate.

Public function

void

 

BroadcastDelegates()

Broadcast the envelope and submix delegates on the game thread.

Public function

void

 

ClearSoundEffectSubmixes()

Clears all submix effects from the effect submix chain.

Public function

void

 

ClearSubmixEffectChainOverride

(
    float InFadeTimeSec
)

Clears any submix effect chain overrides in the given fade time in seconds.

Protected function Static

void

 

DownmixBuffer

(
    const int32 InChannels,
    const FAlignedFloatBuffer& InBuffe...,
    const int32 OutChannels,
    FAlignedFloatBuffer& OutNewBuffer
)

Down mix the given buffer to the desired down mix channel count.

Protected function

bool

 

GenerateEffectChainAudio

(
    FSoundEffectSubmixInputData& Input...,
    FAlignedFloatBuffer& InAudioBuffer,
    TArray< FSoundEffectSubmixPtr >& I...,
    FAlignedFloatBuffer& OutBuffer
)

Generates audio from the given effect chain into the given buffer.

Public function

FSoundfieldS...

 

GetDefaultPositionalDataForAudioDevice()

Public function Const

uint32

 

GetId()

Returns the mixer submix Id.

Public function

FAudioPlugin...

 

GetInitializationParamsForSoundfieldStream()

Public function

FSoundfieldE...

 

GetKeyForSubmixEncoding()

Get a unique key for this submix's format and settings.

Public function

void

 

GetMagnitudeForFrequencies

(
    const TArray< float >& InFrequenci...,
    TArray< float >& OutMagnitudes
)

Gets the most recent magnitude values for each corresponding value in InFrequencies (in Hz).

Public function

int32

 

GetNumChainEffects()

Returns the number of effects in this submix's effect chain.

Public function Const

int32

 

GetNumEffects()

Returns the number of wet effects in this submix.

Public function Const

int32

 

GetNumOutputChannels()

Returns the output channels this submix is rendering to.

Public function Const

int32

 

GetNumSourceVoices()

Returns the number of source voices currently a part of this submix.

Public function

TWeakPtr< FM...

 

GetParentSubmix()

Gets this submix's parent submix.

Public function

void

 

GetPhaseForFrequencies

(
    const TArray< float >& InFrequenci...,
    TArray< float >& OutPhases
)

Gets the most recent phase values for each corresponding value in InFrequencies (in Hz).

Public function Const

int32

 

GetSampleRate()

Returns the device sample rate this submix is rendering to.

Public function Const

int32

 

GetSizeOfSubmixChain()

Returns the size of the submix chain.

Public function

ISoundfieldF...

 

GetSoundfieldFactory()

Protected function Const

FName

 

GetSoundfieldFormat()

Public function

ISoundfieldE...

 

GetSoundfieldSettings()

Public function Const

int32

 

GetSubmixChannels()

Gets the submix channels channels.

Public function

FSoundEffect...

 

GetSubmixEffect

(
    const int32 InIndex
)

Returns the submix effect at the given effect chain index.

Protected function

TUniquePtr< ...

 

GetTranscoderForChildSubmix

(
    const TSharedPtr< Audio::FMixerSubm...
)

Public function

void

 

Init

(
    const USoundSubmixBase* InSoun...,
    bool bAllowReInit
)

Initialize the submix object with the USoundSubmix ptr. Sets up child and parent connects.

Protected function

void

 

InitInternal()

Initialize the submix internal.

Public function Const

bool

 

IsDefaultEndpointSubmix()

Returns true if this submix sends it's audio to the default endpoint.

Public function Const

bool

 

IsDummyEndpointSubmix()

Returns true if this is an endpoint type that should no-op for this platform.

Public function Const

bool

 

IsExternalEndpointSubmix()

Returns true if this submix sends its audio to an IAudioEndpoint.

Public function Const

bool

 

IsRenderingAudio()

Returns true if the submix is currently rendering audio. The current rendering time is passed in.

Public function Const

bool

 

IsSoundfieldEndpointSubmix()

Returns true if this submix sends its audio to an ISoundfieldEndpoint.

Public function Const

bool

 

IsSoundfieldSubmix()

Returns true if this submix is encoded to a soundfield.

Public function Const

bool

 

IsValid()

Checks to see if submix is valid.

Protected function

void

 

MixBufferDownToMono

(
    const FAlignedFloatBuffer& InBuffe...,
    int32 NumInputChannels,
    FAlignedFloatBuffer& OutBuffer
)

Protected function

void

 

MixInChildSubmix

(
    FChildSubmixInfo& Child,
    ISoundfieldAudioPacket& PacketToSu...
)

Calls ProcessAudio on the child submix, performs all necessary conversions and mixes in it's resulting audio.

Protected function

void

 

MixInSource

(
    const ISoundfieldAudioPacket& InAu...,
    const ISoundfieldEncodingSettingsPr...,
    ISoundfieldAudioPacket& PacketToSu...
)

Encode a source and sum it into the mixed soundfield.

Public function

void

 

OnStartRecordingOutput

(
    float ExpectedDuration
)

This is called by the corresponding USoundSubmix when StartRecordingOutput is called.

Public function

FAlignedFloa...

 

OnStopRecordingOutput

(
    float& OutNumChannels,
    float& OutSampleRate
)

This is called by the corresponding USoundSubmix when StopRecordingOutput is called.

Public function

void

 

PauseRecordingOutput()

This is called by the corresponding USoundSubmix when PauseRecording is called.

Public function

void

 

ProcessAudio

(
    ISoundfieldAudioPacket& OutputAudi...
)

Function which processes audio.

Public function

void

 

ProcessAudio

(
    FAlignedFloatBuffer& OutAudio
)

Function which processes audio.

Public function

void

 

ProcessAudioAndSendToEndpoint()

This should be called if this submix doesn't send it's audio to a parent submix, but rather an external endpoint.

Protected function

void

 

PumpCommandQueue()

Pump command queue.

Public function

void

 

RegisterBufferListener

(
    ISubmixBufferListener* BufferL...
)

Register buffer listener with this submix.

Public function

void

 

RemoveChildSubmix

Removes the given submix from this submix's children.

Public function

void

 

RemoveSoundEffectSubmix

(
    uint32 SubmixPresetId
)

Removes the submix effect from the effect submix chain.

Public function

void

 

RemoveSoundEffectSubmixAtIndex

(
    int32 InIndex
)

Removes the submix effect from the effect submix chain at the given submix index.

Public function

void

 

RemoveSourceVoice

(
    FMixerSourceVoice* InSourceVoi...
)

Removes the given source voice from the submix.

Public function

void

 

RemoveSpectralAnalysisDelegate

(
    const FOnSubmixSpectralAnalysisBP&...
)

Removes an existing spectral analysis delegate.

Public function

void

 

ReplaceSoundEffectSubmix

(
    int32 InIndex,
    FSoundEffectSubmixPtr InEffectInsta...
)

Swaps effect for provided submix at the given index. Fails if effect at index doesn't exist

Public function

void

 

ResumeRecordingOutput()

This is called by the corresponding USoundSubmix when ResumeRecording is called.

Public function

void

 

SetAutoDisable

(
    bool bInAutoDisable
)

Set whether or not this submix is told to auto disable.

Public function

void

 

SetAutoDisableTime

(
    float InAutoDisableTime
)

Sets the auto-disable time.

Public function

void

 

SetBackgroundMuted

(
    bool bInMuted
)

Whether or not this submix instance is muted.

Public function

void

 

SetDryLevel

(
    float InDryLevel
)

Sets the static output volume of the submix.

Public function

void

 

SetModulationBaseLevels

(
    float InVolumeModBase,
    float InWetModeBase,
    float InDryModBase
)

Update modulation settings of the submix.

Public function

void

 

SetOutputVolume

(
    float InOutputLevel
)

Sets the output level of the submix.

Public function

void

 

SetParentSubmix

Sets the parent submix to the given submix.

Public function

void

 

SetSoundfieldFactory

(
    ISoundfieldFactory* InSoundfie...
)

This must be called on the entire submix graph before calling SetupSoundfieldStreams.

Public function

void

 

SetSubmixEffectChainOverride

(
    const TArray< FSoundEffectSubmixPtr...,
    float InFadeTimeSec
)

Sets a submix effect chain override with the given fade time in seconds.

Public function

void

 

SetupEndpoint

(
    ISoundfieldEndpointFactory* In...,
    const USoundfieldEndpointSettingsBa...
)

Public function

void

 

SetupEndpoint

(
    IAudioEndpointFactory* InFacto...,
    const UAudioEndpointSettingsBase&#...
)

Protected function

void

 

SetupSoundfieldEncodersForChildren()

Protected function

void

 

SetupSoundfieldEncodingForChild

(
    FChildSubmixInfo& InChild
)

Protected function

void

 

SetUpSoundfieldPositionalData

(
    const TSharedPtr< Audio::FMixerSubm...
)

This sets up the ambisonics positional data for speakers, based on what new format we need to convert to.

Protected function

void

 

SetupSoundfieldStreamForParent()

Check to see if we need to decode from ambisonics for parent.

Public function

void

 

SetupSoundfieldStreams

(
    const USoundfieldEncodingSettingsBa...,
    TArray< USoundfieldEffectBase*...,
    ISoundfieldFactory* InSoundfie...
)

Updates settings, potentially creating or removing ambisonics streams based on what types of submixes this submix is connected to.

Public function

void

 

SetWetLevel

(
    float InWetLevel
)

Sets the wet level of the submix.

Public function

void

 

StartEnvelopeFollowing

(
    int32 AttackTime,
    int32 ReleaseTime
)

Starts envelope following with the given attack time and release time.

Public function

void

 

StartSpectrumAnalysis

(
    const FSoundSpectrumAnalyzerSetting...
)

Initializes a new FFT analyzer for this submix and immediately begins feeding audio to it.

Public function

void

 

StopEnvelopeFollowing()

Stops envelope following the submix.

Public function

void

 

StopSpectrumAnalysis()

Terminates whatever FFT Analyzer is being used for this submix.

Protected function

void

 

SubmixCommand

(
    TFunction< void()> Command
)

Add command to the command queue.

Public function

void

 

TeardownSoundfieldStreams()

Public function

void

 

UnregisterBufferListener

(
    ISubmixBufferListener* BufferL...
)

Unregister buffer listener with this submix.

Public function

void

 

UpdateEndpointSettings

Public function

void

 

UpdateEndpointSettings

Protected function

void

 

UpdateListenerRotation

(
    const FQuat& InRotation
)

Public function

void

 

UpdateModulationSettings

(
    USoundModulatorBase* InOutputM...,
    USoundModulatorBase* InWetLeve...,
    USoundModulatorBase* InDryLeve...
)

Update modulation settings of the submix.

Classes