You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Leverage AssetRegistry/Manager to only load data on MetaSounds required to register (disabled until frontend registry supports this) - Drag-And-Drop assets on MetaSound Graph - Move ConvertToPreset to toolbar (WIP, still need to properly hide when clicked instead of closing editor blindly, has issue with refresh) #rb phil.popp #preflight 60c9a0a83e1b3c0001335ee7 #ROBOMERGE-SOURCE: CL 16689213 via CL 16689237 #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529) [CL 16689251 by rob gay in ue5-release-engine-test branch]
179 lines
5.4 KiB
C++
179 lines
5.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "EdGraph/EdGraph.h"
|
|
#include "Metasound.h"
|
|
#include "MetasoundAssetBase.h"
|
|
#include "MetasoundFrontend.h"
|
|
#include "MetasoundFrontendDocument.h"
|
|
#include "MetasoundInstanceTransmitter.h"
|
|
#include "MetasoundOperatorSettings.h"
|
|
#include "MetasoundRouter.h"
|
|
#include "Sound/SoundWaveProcedural.h"
|
|
#include "UObject/MetaData.h"
|
|
|
|
#include "MetasoundSource.generated.h"
|
|
|
|
|
|
/** Declares the output audio format of the UMetaSoundSource */
|
|
UENUM()
|
|
enum class EMetasoundSourceAudioFormat : uint8
|
|
{
|
|
// Mono audio output
|
|
Mono,
|
|
|
|
// Stereo audio output
|
|
Stereo,
|
|
|
|
COUNT UMETA(Hidden)
|
|
};
|
|
|
|
|
|
/**
|
|
* This Metasound type can be played as an audio source.
|
|
*/
|
|
UCLASS(hidecategories = object, BlueprintType)
|
|
class METASOUNDENGINE_API UMetaSoundSource : public USoundWaveProcedural, public FMetasoundAssetBase
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
protected:
|
|
UPROPERTY(EditAnywhere, Category = CustomView)
|
|
FMetasoundFrontendDocument RootMetasoundDocument;
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
UPROPERTY()
|
|
UMetasoundEditorGraphBase* Graph;
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
public:
|
|
UMetaSoundSource(const FObjectInitializer& ObjectInitializer);
|
|
|
|
// The output audio format of the metasound source.
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Metasound)
|
|
EMetasoundSourceAudioFormat OutputFormat;
|
|
|
|
UPROPERTY(AssetRegistrySearchable)
|
|
FGuid AssetClassID;
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
UPROPERTY(AssetRegistrySearchable)
|
|
FString RegistryInputTypes;
|
|
|
|
UPROPERTY(AssetRegistrySearchable)
|
|
FString RegistryOutputTypes;
|
|
|
|
UPROPERTY(AssetRegistrySearchable)
|
|
int32 RegistryVersionMajor = 0;
|
|
|
|
UPROPERTY(AssetRegistrySearchable)
|
|
int32 RegistryVersionMinor = 0;
|
|
|
|
// Sets Asset Registry Metadata associated with this MetaSoundSource
|
|
virtual void SetRegistryAssetClassInfo(const Metasound::Frontend::FNodeClassInfo& InNodeInfo) override;
|
|
|
|
// Returns document name (for editor purposes, and avoids making document public for edit
|
|
// while allowing editor to reference directly)
|
|
static FName GetDocumentPropertyName()
|
|
{
|
|
return GET_MEMBER_NAME_CHECKED(UMetaSoundSource, RootMetasoundDocument);
|
|
}
|
|
|
|
// Name to display in editors
|
|
virtual FText GetDisplayName() const override;
|
|
|
|
// Returns the graph associated with this Metasound. Graph is required to be referenced on
|
|
// Metasound UObject for editor serialization purposes.
|
|
// @return Editor graph associated with UMetaSoundSource.
|
|
virtual UEdGraph* GetGraph() override;
|
|
virtual const UEdGraph* GetGraph() const override;
|
|
virtual UEdGraph& GetGraphChecked() override;
|
|
virtual const UEdGraph& GetGraphChecked() const override;
|
|
|
|
// Sets the graph associated with this Metasound. Graph is required to be referenced on
|
|
// Metasound UObject for editor serialization purposes.
|
|
// @param Editor graph associated with UMetaSoundSource.
|
|
virtual void SetGraph(UEdGraph* InGraph) override
|
|
{
|
|
Graph = CastChecked<UMetasoundEditorGraphBase>(InGraph);
|
|
}
|
|
#endif // #if WITH_EDITORONLY_DATA
|
|
|
|
#if WITH_EDITOR
|
|
virtual void PreSave(FObjectPreSaveContext SaveContext) override;
|
|
virtual void PostEditUndo() override;
|
|
|
|
virtual bool GetRedrawThumbnail() const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual void SetRedrawThumbnail(bool bInRedraw) override
|
|
{
|
|
}
|
|
|
|
virtual bool CanVisualizeAsset() const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& InEvent) override;
|
|
#endif // WITH_EDITOR
|
|
|
|
// Returns Asset Metadata associated with this MetaSoundSource
|
|
virtual Metasound::Frontend::FNodeClassInfo GetAssetClassInfo() const override;
|
|
|
|
virtual const FMetasoundFrontendArchetype& GetArchetype() const override;
|
|
|
|
UObject* GetOwningAsset() override
|
|
{
|
|
return this;
|
|
}
|
|
|
|
const UObject* GetOwningAsset() const override
|
|
{
|
|
return this;
|
|
}
|
|
|
|
virtual bool IsPlayable() const override;
|
|
virtual bool SupportsSubtitles() const override;
|
|
virtual float GetDuration() override;
|
|
virtual ISoundGeneratorPtr CreateSoundGenerator(const FSoundGeneratorInitParams& InParams) override;
|
|
virtual TUniquePtr<IAudioInstanceTransmitter> CreateInstanceTransmitter(const FAudioInstanceTransmitterInitParams& InParams) const override;
|
|
|
|
// Get the most up to date archetype for metasound sources.
|
|
const TArray<FMetasoundFrontendArchetype>& GetPreferredArchetypes() const override;
|
|
|
|
static const FMetasoundFrontendArchetype& GetBaseArchetype();
|
|
static const FMetasoundFrontendArchetype& GetMonoSourceArchetype();
|
|
static const FMetasoundFrontendArchetype& GetStereoSourceArchetype();
|
|
|
|
protected:
|
|
Metasound::Frontend::FDocumentAccessPtr GetDocument() override
|
|
{
|
|
using namespace Metasound::Frontend;
|
|
// Return document using FAccessPoint to inform the TAccessPtr when the
|
|
// object is no longer valid.
|
|
return MakeAccessPtr<FDocumentAccessPtr>(RootMetasoundDocument.AccessPoint, RootMetasoundDocument);
|
|
}
|
|
|
|
Metasound::Frontend::FConstDocumentAccessPtr GetDocument() const override
|
|
{
|
|
using namespace Metasound::Frontend;
|
|
// Return document using FAccessPoint to inform the TAccessPtr when the
|
|
// object is no longer valid.
|
|
return MakeAccessPtr<FConstDocumentAccessPtr>(RootMetasoundDocument.AccessPoint, RootMetasoundDocument);
|
|
}
|
|
|
|
private:
|
|
Metasound::FOperatorSettings GetOperatorSettings(Metasound::FSampleRate InSampleRate) const;
|
|
|
|
static const FString& GetOnPlayInputName();
|
|
static const FString& GetAudioOutputName();
|
|
static const FString& GetIsFinishedOutputName();
|
|
static const FString& GetAudioDeviceHandleVariableName();
|
|
static const FString& GetSoundUniqueIdName();
|
|
static const FString& GetIsPreviewSoundName();
|
|
};
|