Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/MetasoundOutput.cpp
charlie huguenard 3c8efcca93 [Metasound] Blueprint access to watch outputs on a playing Metasound source
#rb ryan.mangin, rob.gay, phil.popp
#preflight 6418bfb2691c5ebc15931d3e

[CL 24731517 by charlie huguenard in ue5-main branch]
2023-03-21 10:01:25 -04:00

81 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MetasoundOutput.h"
#include "MetasoundPrimitives.h"
FMetaSoundOutput::FMetaSoundOutput(const FMetaSoundOutput& Other)
{
Name = Other.Name;
DataReference = MakeUnique<Metasound::FAnyDataReference>(*Other.DataReference);
}
FMetaSoundOutput& FMetaSoundOutput::operator=(const FMetaSoundOutput& Other)
{
if (this != &Other)
{
this->Name = Other.Name;
this->DataReference = MakeUnique<Metasound::FAnyDataReference>(*Other.DataReference);
}
return *this;
}
bool FMetaSoundOutput::IsValid() const
{
return nullptr != DataReference;
}
FName FMetaSoundOutput::GetTypeName() const
{
return IsValid() ? DataReference->GetDataTypeName() : FName();
}
bool UMetasoundOutputBlueprintAccess::IsFloat(const FMetaSoundOutput& Output)
{
return Output.IsType<float>();
}
float UMetasoundOutputBlueprintAccess::GetFloat(const FMetaSoundOutput& Output, bool& Success)
{
float Value = 0;
Success = Output.Get(Value);
return Value;
}
bool UMetasoundOutputBlueprintAccess::IsInt32(const FMetaSoundOutput& Output)
{
return Output.IsType<int32>();
}
int32 UMetasoundOutputBlueprintAccess::GetInt32(const FMetaSoundOutput& Output, bool& Success)
{
int32 Value = 0;
Success = Output.Get(Value);
return Value;
}
bool UMetasoundOutputBlueprintAccess::IsBool(const FMetaSoundOutput& Output)
{
return Output.IsType<bool>();
}
bool UMetasoundOutputBlueprintAccess::GetBool(const FMetaSoundOutput& Output, bool& Success)
{
bool Value = false;
Success = Output.Get(Value);
return Value;
}
bool UMetasoundOutputBlueprintAccess::IsString(const FMetaSoundOutput& Output)
{
return Output.IsType<FString>();
}
FString UMetasoundOutputBlueprintAccess::GetString(const FMetaSoundOutput& Output, bool& Success)
{
FString Value;
Success = Output.Get(Value);
return Value;
}