You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[FYI] bob.tellez
Original CL Desc
-----------------------------------------------------------------
[Backout] - CL33838807
[FYI] Rob.Gay
Original CL Desc
-----------------------------------------------------------------
- Move MetaSound input/output editor validation, GetMemberName/Description, IsInterfaceMember to builder API
- Add warnings on register for interface vertex members (disabled until projects are complaint) to ensure they are following the expected naming convention (i.e. namespace matches that of owning interface)
- Note this is editor only to avoid spamming cook and failing builds
- Move versioning to use shared builder now that IDocumentBuilderRegistry is available prior to all asset serialize load calls. This ensures that multiple builders are not accessing the same asset when loading and versioning/migrating old editor data
#jira UE-194160
#rb phil.popp
#rnx
[CL 33957350 by rob gay in ue5-main branch]
150 lines
5.5 KiB
C++
150 lines
5.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Interfaces/MetasoundInterface.h"
|
|
|
|
#include "Algo/Transform.h"
|
|
#include "AudioParameterControllerInterface.h"
|
|
#include "IAudioParameterInterfaceRegistry.h"
|
|
#include "IAudioParameterTransmitter.h"
|
|
#include "Interfaces/MetasoundFrontendInterfaceRegistry.h"
|
|
#include "Interfaces/MetasoundFrontendSourceInterface.h"
|
|
#include "Interfaces/MetasoundInputFormatInterfaces.h"
|
|
#include "Interfaces/MetasoundOutputFormatInterfaces.h"
|
|
#include "Metasound.h"
|
|
#include "MetasoundFrontendDataTypeRegistry.h"
|
|
#include "MetasoundFrontendDocument.h"
|
|
#include "MetasoundFrontendTransform.h"
|
|
#include "MetasoundLog.h"
|
|
#include "MetasoundParameterTransmitter.h"
|
|
#include "MetasoundSource.h"
|
|
#include "MetasoundUObjectRegistry.h"
|
|
#include "Templates/SharedPointer.h"
|
|
#include "Templates/UniquePtr.h"
|
|
#include "UObject/Class.h"
|
|
#include "UObject/NoExportTypes.h"
|
|
|
|
|
|
namespace Metasound::Engine
|
|
{
|
|
FInterfaceRegistryEntry::FInterfaceRegistryEntry(FMetasoundFrontendInterface&& InInterface, FName InRouterName, bool bInIsDeprecated)
|
|
: Interface(MoveTemp(InInterface))
|
|
, RouterName(InRouterName)
|
|
, bIsDeprecated(bInIsDeprecated)
|
|
{
|
|
}
|
|
|
|
FInterfaceRegistryEntry::FInterfaceRegistryEntry(const FMetasoundFrontendInterface& InInterface, FName InRouterName, bool bInIsDeprecated)
|
|
: Interface(InInterface)
|
|
, RouterName(InRouterName)
|
|
, bIsDeprecated(bInIsDeprecated)
|
|
{
|
|
}
|
|
|
|
FInterfaceRegistryEntry::FInterfaceRegistryEntry(const FMetasoundFrontendInterface& InInterface, TUniquePtr<Frontend::IDocumentTransform>&& InUpdateTransform, FName InRouterName, bool bInIsDeprecated)
|
|
: Interface(InInterface)
|
|
, UpdateTransform(MoveTemp(InUpdateTransform))
|
|
, RouterName(InRouterName)
|
|
, bIsDeprecated(bInIsDeprecated)
|
|
{
|
|
}
|
|
|
|
FName FInterfaceRegistryEntry::GetRouterName() const
|
|
{
|
|
return RouterName;
|
|
}
|
|
|
|
const FMetasoundFrontendInterface& FInterfaceRegistryEntry::GetInterface() const
|
|
{
|
|
return Interface;
|
|
}
|
|
|
|
bool FInterfaceRegistryEntry::IsDeprecated() const
|
|
{
|
|
return bIsDeprecated;
|
|
}
|
|
|
|
bool FInterfaceRegistryEntry::UpdateRootGraphInterface(Frontend::FDocumentHandle InDocument) const
|
|
{
|
|
if (UpdateTransform.IsValid())
|
|
{
|
|
return UpdateTransform->Transform(InDocument);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void RegisterAudioFormatInterfaces()
|
|
{
|
|
using namespace Frontend;
|
|
|
|
IInterfaceRegistry& Reg = IInterfaceRegistry::Get();
|
|
|
|
// Input Formats
|
|
{
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(InputFormatMonoInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(InputFormatStereoInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(InputFormatQuadInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(InputFormatFiveDotOneInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(InputFormatSevenDotOneInterface::CreateInterface()));
|
|
}
|
|
|
|
// Output Formats
|
|
{
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(OutputFormatMonoInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(OutputFormatStereoInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(OutputFormatQuadInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(OutputFormatFiveDotOneInterface::CreateInterface()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(OutputFormatSevenDotOneInterface::CreateInterface()));
|
|
}
|
|
}
|
|
|
|
void RegisterExternalInterfaces()
|
|
{
|
|
// Register External Interfaces (Interfaces defined externally & can be managed directly by end-user).
|
|
auto RegisterExternalInterface = [](Audio::FParameterInterfacePtr Interface)
|
|
{
|
|
using namespace Frontend;
|
|
|
|
bool bSupportedInterface = false;
|
|
IMetasoundUObjectRegistry::Get().IterateRegisteredUClasses([&bSupportedInterface, &Interface](UClass& InRegisteredClass)
|
|
{
|
|
const TArray<const UClass*> SupportedUClasses = Interface->FindSupportedUClasses();
|
|
bSupportedInterface |= SupportedUClasses.IsEmpty();
|
|
for (const UClass* SupportedUClass : SupportedUClasses)
|
|
{
|
|
check(SupportedUClass);
|
|
bSupportedInterface |= SupportedUClass->IsChildOf(&InRegisteredClass);
|
|
}
|
|
});
|
|
|
|
if (bSupportedInterface)
|
|
{
|
|
IInterfaceRegistry::Get().RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(FMetasoundFrontendInterface(Interface), Audio::IParameterTransmitter::RouterName));
|
|
}
|
|
else
|
|
{
|
|
UE_LOG(LogMetaSound, Warning, TEXT("Parameter interface '%s' not supported by MetaSounds"), *Interface->GetName().ToString());
|
|
}
|
|
};
|
|
|
|
Audio::IAudioParameterInterfaceRegistry::Get().IterateInterfaces(RegisterExternalInterface);
|
|
Audio::IAudioParameterInterfaceRegistry::Get().OnRegistration(MoveTemp(RegisterExternalInterface));
|
|
}
|
|
|
|
void RegisterInterfaces()
|
|
{
|
|
using namespace Frontend;
|
|
|
|
IInterfaceRegistry& Reg = IInterfaceRegistry::Get();
|
|
|
|
// Default Source Interfaces
|
|
{
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(SourceInterface::CreateInterface(*UMetaSoundSource::StaticClass()), MakeUnique<SourceInterface::FUpdateInterface>()));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(SourceOneShotInterface::CreateInterface(*UMetaSoundSource::StaticClass())));
|
|
Reg.RegisterInterface(MakeUnique<FInterfaceRegistryEntry>(SourceStartTimeInterface::CreateInterface(*UMetaSoundSource::StaticClass())));
|
|
}
|
|
|
|
RegisterAudioFormatInterfaces();
|
|
RegisterExternalInterfaces();
|
|
}
|
|
} // namespace Metasound::Engine
|