2022-05-10 16:51:39 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "Analysis/MetasoundFrontendAnalyzerView.h"
2022-05-12 13:47:17 -04:00
# include "Analysis/MetasoundFrontendAnalyzerFactory.h"
# include "Analysis/MetasoundFrontendAnalyzerRegistry.h"
2022-05-10 16:51:39 -04:00
# include "Analysis/MetasoundFrontendVertexAnalyzer.h"
# include "Analysis/MetasoundFrontendVertexAnalyzerEnvelopeFollower.h"
# include "Analysis/MetasoundFrontendGraphAnalyzer.h"
# include "Math/UnrealMathUtility.h"
# include "MetasoundAssetBase.h"
# include "MetasoundFrontendController.h"
# include "MetasoundOperatorSettings.h"
# include "Templates/Function.h"
namespace Metasound
{
namespace Frontend
{
2022-05-12 13:47:17 -04:00
FMetasoundAnalyzerView : : FMetasoundAnalyzerView ( FAnalyzerAddress & & InAnalyzerAddress )
2022-05-10 16:51:39 -04:00
: AnalyzerAddress ( MoveTemp ( InAnalyzerAddress ) )
{
}
2022-05-12 13:47:17 -04:00
void FMetasoundAnalyzerView : : BindToAllOutputs ( const FOperatorSettings & InOperatorSettings )
2022-05-10 16:51:39 -04:00
{
2022-05-12 13:47:17 -04:00
const IVertexAnalyzerFactory * Factory = IVertexAnalyzerRegistry : : Get ( ) . FindAnalyzerFactory ( AnalyzerAddress . AnalyzerName ) ;
if ( ensureMsgf ( Factory , TEXT ( " Failed to bind AnalyzerView to all Analyzer outputs: Missing factory definition for analyzer with name '%s' " ) , * AnalyzerAddress . AnalyzerName . ToString ( ) ) )
{
for ( const FAnalyzerOutput & Output : Factory - > GetAnalyzerOutputs ( ) )
{
FAnalyzerAddress OutputAddress = AnalyzerAddress ;
OutputAddress . AnalyzerMemberName = Output . Name ;
OutputAddress . DataType = Output . DataType ;
const FReceiverInitParams ReceiverParams { InOperatorSettings } ;
2022-08-17 19:01:34 -04:00
IReceiver * Receiver = FDataTransmissionCenter : : Get ( ) . RegisterNewReceiver ( OutputAddress , ReceiverParams ) . Release ( ) ;
2022-05-12 13:47:17 -04:00
OutputReceivers . Add ( { Output . Name , TSharedPtr < IReceiver > ( Receiver ) } ) ;
}
}
2022-05-10 16:51:39 -04:00
}
2022-05-12 13:47:17 -04:00
bool FMetasoundAnalyzerView : : UnbindOutput ( FName InOutputName )
2022-05-10 16:51:39 -04:00
{
2022-05-12 13:47:17 -04:00
return OutputReceivers . Remove ( InOutputName ) > 0 ;
2022-05-10 16:51:39 -04:00
}
2023-03-20 17:13:25 -04:00
TArray < FMetasoundAnalyzerView : : FBoundOutputDescription > FMetasoundAnalyzerView : : GetBoundOutputDescriptions ( ) const
{
TArray < FBoundOutputDescription > OutputDescriptions ;
for ( auto & Receiver : OutputReceivers )
{
if ( ! ensure ( Receiver . Value . IsValid ( ) ) )
{
continue ;
}
OutputDescriptions . Add ( { Receiver . Key , Receiver . Value - > GetDataType ( ) } ) ;
}
return OutputDescriptions ;
}
2022-05-10 16:51:39 -04:00
} // namespace Frontend
} // namespace Metasound