Ok got all of the directories hooked up and compiled. I’ll try digging into the error itself now.
I got it a little further along.
modified the header of TCsoundOperator.h adding in the _API before class definition
#pragma once
// Is this still necessary? WIP
#ifdef LIKELY
#undef LIKELY
#endif
#ifdef UNLIKELY
#undef UNLIKELY
#endif
THIRD_PARTY_INCLUDES_START
#include <csound.hpp>
THIRD_PARTY_INCLUDES_END
#include "MetasoundExecutableOperator.h" // TExecutableOperator class
#include "MetasoundPrimitives.h" // ReadRef and WriteRef descriptions for bool, int32, float, and string
#include "MetasoundNodeRegistrationMacro.h" // METASOUND_LOCTEXT and METASOUND_REGISTER_NODE macros
#include "MetasoundFacade.h" // FNodeFacade class, eliminates the need for a fair amount of boilerplate code
#include "Containers/Array.h"
// WIP trying to create my own pin type
#include "MetasoundDataTypeRegistrationMacro.h"
#include "MetasoundDataReferenceMacro.h"
#include "MetasoundDataReference.h"
#include "MetasoundVariable.h"
#include "MetaCsound.h"
// Required for ensuring the node is supported by all languages in engine. Must be unique per MetaSound.
#define LOCTEXT_NAMESPACE "MetaCsound_CsoundNode"
// WIP: Should I use namespace MetaCsound?
namespace Metasound
{
namespace CsoundNode
{
METASOUND_PARAM(PlayTrig, "Play", "Starts playing Csound");
METASOUND_PARAM(StopTrig, "Stop", "Stops the Csound performace");
METASOUND_PARAM(FilePath, "File", "Path of the .csd file to be executed by Csound");
METASOUND_PARAM(EvStr, "Event String", "The string that contains a Csound event");
METASOUND_PARAM(EvTrig, "Event Trigger", "Triggers the Csound event descrived by EventString");
METASOUND_PARAM(FinTrig, "On Finished", "Triggers when the Csound score has finished");
METASOUND_PARAM(InA, "In Audio {0}", "Input audio {0}");
METASOUND_PARAM(OutA, "Out Audio {0}", "Output audio {0}");
METASOUND_PARAM(InK, "In Control {0}", "Input control {0}");
METASOUND_PARAM(OutK, "Out Control {0}", "Output control {0}");
}
//#if WITH_METASOUND_FRONTEND
// DECLARE_METASOUND_DATA_REFERENCE_TYPES(TCHAR, METACSOUND_API, FCharTypeInfo, FCharReadRef, FCharWriteRef);
DECLARE_METASOUND_DATA_REFERENCE_TYPES(TCHAR, METACSOUND_API, FCharTypeInfo, FCharReadRef, FCharWriteRef);
//
//#define DECLARE_METASOUND_DATA_REFERENCE_TYPES(DataType, ModuleApi, DataTypeInfoTypeName, DataReadReferenceTypeName, DataWriteReferenceTypeName) \
//#endif
template<typename DerivedOperator>
class METACSOUND_API TCsoundOperator : public TExecutableOperator<DerivedOperator>
{
protected:
// Protected constructor
TCsoundOperator(const FOperatorSettings& InSettings,
const FTriggerReadRef& InPlayTrigger,
const FTriggerReadRef& InStopTrigger,
const FStringReadRef& InFilePath,
const TArray<FAudioBufferReadRef>& InAudioRefs,
const int32& InNumOutAudioChannels,
const TArray<FFloatReadRef>& InControlRefs,
const int32& InNumOutControlChannels,
const FStringReadRef& InEventString,
const FTriggerReadRef& InEventTrigger
);
public:
// Primary node functionality
void Execute();
static const FNodeClassMetadata& GetNodeInfo();
static const FVertexInterface& DeclareVertexInterface();
// WIP use of BindInputs and BindOutputs instead?
// Allows MetaSound graph to interact with your node's inputs
virtual FDataReferenceCollection GetInputs() const override final;
// Allows MetaSound graph to interact with your node's outputs
virtual FDataReferenceCollection GetOutputs() const override final;
static TUniquePtr<IOperator> CreateOperator(const FCreateOperatorParams& InParams, TArray<TUniquePtr<IOperatorBuildError>>& OutErrors);
private:
FTriggerReadRef PlayTrigger;
FTriggerReadRef StopTrigger;
FStringReadRef FilePath;
FStringReadRef EventString;
FTriggerReadRef EventTrigger;
FTriggerWriteRef FinishedTrigger;
TArray<FAudioBufferReadRef> AudioInRefs;
TArray<const float*> BuffersIn;
TArray<FAudioBufferWriteRef> AudioOutRefs;
TArray<float*> BuffersOut;
TArray<FFloatReadRef> ControlInRefs;
TArray<FString> ControlInNames;
TArray<FFloatWriteRef> ControlOutRefs;
TArray<FString> ControlOutNames;
FOperatorSettings OpSettings;
Csound CsoundInstance;
int32 SpIndex;
double* Spin, * Spout;
int32 CsoundNchnlsIn, CsoundNchnlsOut, MinAudioIn, MinAudioOut;
int32 CsoundKsmps;
enum class METACSOUND_API EOpState : uint8
{
Stopped,
Playing,
Error
};
EOpState OpState;
void Play(int32 CurrentFrame);
void Stop(int32 StopFrame = 0);
void ClearChannels(int32 StopFrame = 0);
void CsoundPerformKsmps(int32 CurrentFrame);
};
class METACSOUND_API FCsoundOperator2 : public TCsoundOperator<FCsoundOperator2>
{
public:
// WIP create struct that has all of the arguments, to avoid such long constructors?
FCsoundOperator2(const FOperatorSettings& InSettings,
const FTriggerReadRef& InPlayTrigger,
const FTriggerReadRef& InStopTrigger,
const FStringReadRef& InFilePath,
const TArray<FAudioBufferReadRef>& InAudioRefs,
const int32& InNumOutAudioChannels,
const TArray<FFloatReadRef>& InControlRefs,
const int32& InNumOutControlChannels,
const FStringReadRef& InEventString,
const FTriggerReadRef& InEventTrigger
)
: TCsoundOperator(
InSettings, InPlayTrigger, InStopTrigger, InFilePath,
InAudioRefs, InNumOutAudioChannels, InControlRefs, InNumOutControlChannels,
InEventString, InEventTrigger
)
{ }
// WIP inline?
static const FNodeClassName GetClassName()
{
// WIP What is Audio? Could we use "Csound" instead?
return { TEXT("MetaCsound"), TEXT("Csound 2"), TEXT("Audio") };
}
static const FText GetDisplayName()
{
return LOCTEXT("MetaCsound_Node2DisplayName", "Csound 2");
}
static const FText GetDescription()
{
return LOCTEXT("MetaCsound_Node2Desc", "Csound 2 description");
}
static constexpr int32 NumAudioChannelsIn = 2;
static constexpr int32 NumAudioChannelsOut = 2;
static constexpr int32 NumControlChannelsIn = 2;
static constexpr int32 NumControlChannelsOut = 2;
};
class METACSOUND_API FCsoundNode2 : public FNodeFacade
{
public:
FCsoundNode2(const FNodeInitData& InitData) : FNodeFacade(InitData.InstanceName, InitData.InstanceID,
TFacadeOperatorClass<FCsoundOperator2>())
{ }
};
// Register node
METASOUND_REGISTER_NODE(FCsoundNode2); // WIP Node registration using module startup/shutdown?
class METACSOUND_API FCsoundOperator4 : public TCsoundOperator<FCsoundOperator4>
{
public:
FCsoundOperator4(const FOperatorSettings& InSettings,
const FTriggerReadRef& InPlayTrigger,
const FTriggerReadRef& InStopTrigger,
const FStringReadRef& InFilePath,
const TArray<FAudioBufferReadRef>& InAudioRefs,
const int32& InNumOutAudioChannels,
const TArray<FFloatReadRef>& InControlRefs,
const int32& InNumOutControlChannels,
const FStringReadRef& InEventString,
const FTriggerReadRef& InEventTrigger
)
: TCsoundOperator(
InSettings, InPlayTrigger, InStopTrigger, InFilePath,
InAudioRefs, InNumOutAudioChannels, InControlRefs, InNumOutControlChannels,
InEventString, InEventTrigger
)
{ }
// WIP inline?
static const FNodeClassName GetClassName()
{
// WIP What is Audio? Could we change it to something like "Csound" instead?
return { TEXT("MetaCsound"), TEXT("Csound 4"), TEXT("Audio") };
}
static const FText GetDisplayName()
{
return LOCTEXT("MetaCsound_Node2DisplayName", "Csound 4");
}
static const FText GetDescription()
{
return LOCTEXT("MetaCsound_Node2Desc", "Csound 4 description");
}
static constexpr int32 NumAudioChannelsIn = 4;
static constexpr int32 NumAudioChannelsOut = 4;
static constexpr int32 NumControlChannelsIn = 4;
static constexpr int32 NumControlChannelsOut = 4;
};
class METACSOUND_API FCsoundNode4 : public FNodeFacade
{
public:
FCsoundNode4(const FNodeInitData& InitData) : FNodeFacade(InitData.InstanceName, InitData.InstanceID,
TFacadeOperatorClass<FCsoundOperator4>())
{ }
};
// Register node
METASOUND_REGISTER_NODE(FCsoundNode4);
}
#undef LOCTEXT_NAMESPACE
now the structs
Metasound::TDataReferenceTypeInfo<TCHAR>::TypeId;
Metasound::FCharTypeInfo::TypeId;
and
Metasound::FBoolTypeInfo::TypeName;
compile fine
the only struct that is giving problems is FCharReadRef but to use createnew it might require a default constructor??
::CreateNew() from the documentation seems to denote that it is supposed to be used in conjunction with TDataReadReference as a wrapper. I don’t think you can use it directly.
I think that like other metasound plugins you probably need to pass into the operator
ReadRef(TDataWriteReference<Metasound::FCharReadRef>::CreateNew())
in the input parameters before you open the curly brace {
and define TDataWriteReference< Metasound::FCharReadRef > ReadRef; as a private variable in the header
I think the main error is that you are declaring the variables below the curly brace so they are not input pins but part of the function body at that point.
You would need to modify the header pass in parameters too
So the const struct inName and then the passed parameter name, like the rest of the parameters play etc