Files
UnrealEngineUWP/Engine/Source/Runtime/AudioExtensions/Private/ISoundfieldFormat.cpp
ethan geller 1b9558d5fa Editgrate 4.25 audio features from project stream:
-Soundfield Submixes
-Endpoint Submixes
-Unreal Ambisonics Encoder/Decoder

[FYI] aaron.mcleran, maxwell.hayes, phil.popp, rob.gay, charles.egenbacher, kevin.neilson


#ROBOMERGE-OWNER: ethan.geller
#ROBOMERGE-AUTHOR: ethan.geller
#ROBOMERGE-SOURCE: CL 11302185 via CL 11302187
#ROBOMERGE-BOT: (v649-11301724)

[CL 11302191 by ethan geller in Main branch]
2020-02-09 18:57:53 -05:00

77 lines
2.2 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;
}
TArray<ISoundfieldFactory*> Factories = IModularFeatures::Get().GetModularFeatureImplementations<ISoundfieldFactory>(GetModularFeatureName());
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());
TArray<ISoundfieldFactory*> Factories = IModularFeatures::Get().GetModularFeatureImplementations<ISoundfieldFactory>(GetModularFeatureName());
for (ISoundfieldFactory* Factory : Factories)
{
SoundfieldFormatNames.Add(Factory->GetSoundfieldFormatName());
}
return SoundfieldFormatNames;
}