You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Before: 3648 unity files Total CPU Time: 47886.140625 s Total time in Parallel executor: 498.81 seconds After: 3548 unity files Total CPU Time: 46643.828125 s Total time in Parallel executor: 486.06 seconds #jira #preflight [CL 22173263 by marc audy in ue5-main branch]
73 lines
2.1 KiB
C++
73 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "Sound/SoundNodeMixer.h"
|
|
#include "ActiveSound.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(SoundNodeMixer)
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
USoundNodeMixer implementation.
|
|
-----------------------------------------------------------------------------*/
|
|
USoundNodeMixer::USoundNodeMixer(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
}
|
|
|
|
void USoundNodeMixer::ParseNodes( FAudioDevice* AudioDevice, const UPTRINT NodeWaveInstanceHash, FActiveSound& ActiveSound, const FSoundParseParameters& ParseParams, TArray<FWaveInstance*>& WaveInstances )
|
|
{
|
|
FSoundParseParameters UpdatedParams = ParseParams;
|
|
for( int32 ChildNodeIndex = 0; ChildNodeIndex < ChildNodes.Num(); ++ChildNodeIndex )
|
|
{
|
|
if( ChildNodes[ ChildNodeIndex ] )
|
|
{
|
|
UpdatedParams.Volume = ParseParams.Volume * InputVolume[ ChildNodeIndex ];
|
|
|
|
ChildNodes[ ChildNodeIndex ]->ParseNodes( AudioDevice, GetNodeWaveInstanceHash(NodeWaveInstanceHash, ChildNodes[ChildNodeIndex], ChildNodeIndex), ActiveSound, UpdatedParams, WaveInstances );
|
|
}
|
|
}
|
|
}
|
|
|
|
void USoundNodeMixer::CreateStartingConnectors()
|
|
{
|
|
// Mixers default with two connectors.
|
|
InsertChildNode( ChildNodes.Num() );
|
|
InsertChildNode( ChildNodes.Num() );
|
|
}
|
|
|
|
void USoundNodeMixer::InsertChildNode( int32 Index )
|
|
{
|
|
Super::InsertChildNode( Index );
|
|
InputVolume.InsertUninitialized( Index );
|
|
InputVolume[ Index ] = 1.0f;
|
|
}
|
|
|
|
void USoundNodeMixer::RemoveChildNode( int32 Index )
|
|
{
|
|
Super::RemoveChildNode( Index );
|
|
InputVolume.RemoveAt( Index );
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
void USoundNodeMixer::SetChildNodes(TArray<USoundNode*>& InChildNodes)
|
|
{
|
|
Super::SetChildNodes(InChildNodes);
|
|
|
|
if (InputVolume.Num() < ChildNodes.Num())
|
|
{
|
|
while (InputVolume.Num() < ChildNodes.Num())
|
|
{
|
|
int32 NewIndex = InputVolume.Num();
|
|
InputVolume.InsertUninitialized( NewIndex );
|
|
InputVolume[ NewIndex ] = 1.0f;
|
|
}
|
|
}
|
|
else if (InputVolume.Num() > ChildNodes.Num())
|
|
{
|
|
const int32 NumToRemove = InputVolume.Num() - ChildNodes.Num();
|
|
InputVolume.RemoveAt(InputVolume.Num() - NumToRemove, NumToRemove);
|
|
}
|
|
}
|
|
#endif //WITH_EDITOR
|
|
|