You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Add MetaSound Patch Interface support - Add MetaSound Interface Bindings #rb phil.popp #preflight 640783bd5515f4f57b4b1268 [FYI] Sondra.Moyls [FYI] Dan.Reynolds [CL 24548617 by rob gay in ue5-main branch]
123 lines
2.9 KiB
C++
123 lines
2.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#include "IAudioParameterInterfaceRegistry.h"
|
|
|
|
#include "Algo/Transform.h"
|
|
|
|
|
|
namespace Audio
|
|
{
|
|
namespace ParameterInterfaceRegistryPrivate
|
|
{
|
|
class FParameterInterfaceRegistry : public IAudioParameterInterfaceRegistry
|
|
{
|
|
public:
|
|
virtual void IterateInterfaces(TFunction<void(FParameterInterfacePtr)> InFunction) const override
|
|
{
|
|
for (const FParameterInterfacePtr& InterfacePtr : Interfaces)
|
|
{
|
|
InFunction(InterfacePtr);
|
|
}
|
|
}
|
|
|
|
virtual void RegisterInterface(FParameterInterfacePtr InInterface) override
|
|
{
|
|
Interfaces.Add(InInterface);
|
|
if (RegistrationFunction)
|
|
{
|
|
RegistrationFunction(InInterface);
|
|
}
|
|
}
|
|
|
|
virtual void OnRegistration(TUniqueFunction<void(FParameterInterfacePtr)>&& InFunction) override
|
|
{
|
|
RegistrationFunction = MoveTemp(InFunction);
|
|
}
|
|
};
|
|
} // namespace ParameterInterfaceRegistryPrivate
|
|
|
|
FParameterInterface::FParameterInterface(
|
|
FName InName,
|
|
const FVersion& InVersion,
|
|
const UClass& InType
|
|
)
|
|
: NamePrivate(InName)
|
|
, VersionPrivate(InVersion)
|
|
, SupportedUClassNames({ InType.GetFullName() })
|
|
{
|
|
}
|
|
|
|
FParameterInterface::FParameterInterface(FName InName, const FVersion& InVersion)
|
|
: NamePrivate(InName)
|
|
, VersionPrivate(InVersion)
|
|
{
|
|
}
|
|
|
|
FParameterInterface::FParameterInterface(FName InName, const FVersion& InVersion, const TArray<UClass*>& InClasses)
|
|
: NamePrivate(InName)
|
|
, VersionPrivate(InVersion)
|
|
{
|
|
Algo::Transform(InClasses, SupportedUClassNames, [](const UClass* Class)
|
|
{
|
|
check(Class);
|
|
return Class->GetFullName();
|
|
});
|
|
}
|
|
|
|
FName FParameterInterface::GetName() const
|
|
{
|
|
return NamePrivate;
|
|
}
|
|
|
|
const FParameterInterface::FVersion& FParameterInterface::GetVersion() const
|
|
{
|
|
return VersionPrivate;
|
|
}
|
|
|
|
const UClass& FParameterInterface::GetType() const
|
|
{
|
|
return *UObject::StaticClass();
|
|
}
|
|
|
|
const TArray<FParameterInterface::FInput>& FParameterInterface::GetInputs() const
|
|
{
|
|
return Inputs;
|
|
}
|
|
|
|
const TArray<FParameterInterface::FOutput>& FParameterInterface::GetOutputs() const
|
|
{
|
|
return Outputs;
|
|
}
|
|
|
|
const TArray<FParameterInterface::FEnvironmentVariable>& FParameterInterface::GetEnvironment() const
|
|
{
|
|
return Environment;
|
|
}
|
|
|
|
TArray<const UClass*> FParameterInterface::FindSupportedUClasses() const
|
|
{
|
|
TArray<const UClass*> SupportedUClasses;
|
|
for (const FString& Name : SupportedUClassNames)
|
|
{
|
|
if (const UClass* Class = FindObject<const UClass>(nullptr, *Name))
|
|
{
|
|
SupportedUClasses.Add(Class);
|
|
}
|
|
}
|
|
|
|
return SupportedUClasses;
|
|
}
|
|
|
|
TUniquePtr<IAudioParameterInterfaceRegistry> IAudioParameterInterfaceRegistry::Instance;
|
|
|
|
IAudioParameterInterfaceRegistry& IAudioParameterInterfaceRegistry::Get()
|
|
{
|
|
using namespace ParameterInterfaceRegistryPrivate;
|
|
|
|
if (!Instance.IsValid())
|
|
{
|
|
Instance = MakeUnique<FParameterInterfaceRegistry>();
|
|
}
|
|
return *Instance;
|
|
}
|
|
} // namespace Audio
|