You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-146734 #rb Aaron.McLeran, Phil.Popp #preflight 623a53eb88538cd45eef0f33 [CL 19473764 by Maxwell Hayes in ue5-main branch]
82 lines
2.4 KiB
C++
82 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ISoundfieldFormat.h"
|
|
#include "ISoundfieldEndpoint.h"
|
|
|
|
FName ISoundfieldFactory::GetFormatNameForNoEncoding()
|
|
{
|
|
static FName NoEncodingFormatName = FName(TEXT("No Encoding"));
|
|
return NoEncodingFormatName;
|
|
}
|
|
|
|
FName ISoundfieldFactory::GetFormatNameForInheritedEncoding()
|
|
{
|
|
static FName InheritedFormatName = FName(TEXT("Inherited Encoding"));
|
|
return InheritedFormatName;
|
|
}
|
|
|
|
FName ISoundfieldFactory::GetModularFeatureName()
|
|
{
|
|
static FName SoundfieldFactoryName = FName(TEXT("Soundfield Format"));
|
|
return SoundfieldFactoryName;
|
|
}
|
|
|
|
void ISoundfieldFactory::RegisterSoundfieldFormat(ISoundfieldFactory* InFactory)
|
|
{
|
|
check(IsInGameThread());
|
|
IModularFeatures::Get().RegisterModularFeature(GetModularFeatureName(), InFactory);
|
|
}
|
|
|
|
void ISoundfieldFactory::UnregisterSoundfieldFormat(ISoundfieldFactory* InFactory)
|
|
{
|
|
check(IsInGameThread());
|
|
IModularFeatures::Get().UnregisterModularFeature(GetModularFeatureName(), InFactory);
|
|
}
|
|
|
|
ISoundfieldFactory* ISoundfieldFactory::Get(const FName& InName)
|
|
{
|
|
if (InName == GetFormatNameForNoEncoding() || InName == FName())
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
IModularFeatures::Get().LockModularFeatureList();
|
|
TArray<ISoundfieldFactory*> Factories = IModularFeatures::Get().GetModularFeatureImplementations<ISoundfieldFactory>(GetModularFeatureName());
|
|
IModularFeatures::Get().UnlockModularFeatureList();
|
|
|
|
for (ISoundfieldFactory* Factory : Factories)
|
|
{
|
|
if (Factory && InName == Factory->GetSoundfieldFormatName())
|
|
{
|
|
if (Factory->IsEndpointFormat())
|
|
{
|
|
ensureAlwaysMsgf(false, TEXT("This format is only supported for endpoints. Use ISoundfieldEndpointFactory::Get instead."));
|
|
}
|
|
|
|
return Factory;
|
|
}
|
|
}
|
|
|
|
ensureAlwaysMsgf(false, TEXT("Soundfield Format %s not found!"), *InName.ToString());
|
|
return nullptr;
|
|
}
|
|
|
|
TArray<FName> ISoundfieldFactory::GetAvailableSoundfieldFormats()
|
|
{
|
|
TArray<FName> SoundfieldFormatNames;
|
|
|
|
SoundfieldFormatNames.Add(GetFormatNameForInheritedEncoding());
|
|
SoundfieldFormatNames.Add(GetFormatNameForNoEncoding());
|
|
|
|
IModularFeatures::Get().LockModularFeatureList();
|
|
TArray<ISoundfieldFactory*> Factories = IModularFeatures::Get().GetModularFeatureImplementations<ISoundfieldFactory>(GetModularFeatureName());
|
|
IModularFeatures::Get().UnlockModularFeatureList();
|
|
|
|
for (ISoundfieldFactory* Factory : Factories)
|
|
{
|
|
SoundfieldFormatNames.Add(Factory->GetSoundfieldFormatName());
|
|
}
|
|
|
|
return SoundfieldFormatNames;
|
|
}
|