@David-Healey Just tried by curiosity but it's still half dynamic, because you still have to hard code the number of channel (getFixChannelAmount) and recompile the DLL...
Weird there's no way to get the hardcoded FX to actually fix the number of channel in the function parameter, @Christoph-Hart?
// ==================================| Third Party Node Template |==================================
#pragma once
#include <JuceHeader.h>
namespace project
{
using namespace juce;
using namespace hise;
using namespace scriptnode;
// ==========================| The node class with all required callbacks |==========================
template <int NV> struct MultiChannelThirdPartyGain_custom_node: public data::base
{
// Metadata Definitions ------------------------------------------------------------------------
SNEX_NODE(MultiChannelThirdPartyGain_custom_node);
struct MetadataClass
{
SN_NODE_ID("MultiChannelThirdPartyGain_custom_node");
};
// set to true if you want this node to have a modulation dragger
static constexpr bool isModNode() { return false; };
static constexpr bool isPolyphonic() { return NV > 1; };
// set to true if your node produces a tail
static constexpr bool hasTail() { return false; };
// set to true if your doesn't generate sound from silence and can be suspended when the input signal is silent
static constexpr bool isSuspendedOnSilence() { return false; };
// Undefine this method if you want a dynamic channel count
static constexpr int getFixChannelAmount() { return 6; };
// Define the amount and types of external data slots you want to use
static constexpr int NumTables = 0;
static constexpr int NumSliderPacks = 0;
static constexpr int NumAudioFiles = 0;
static constexpr int NumFilters = 0;
static constexpr int NumDisplayBuffers = 0;
// Scriptnode Callbacks ------------------------------------------------------------------------
void prepare(PrepareSpecs specs)
{
}
void reset()
{
}
void handleHiseEvent(HiseEvent& e)
{
}
template <typename T> void process(T& data)
{
auto gainFactor = Decibels::decibelsToGain(gain);
for (auto ch : data)
{
auto block = data.toChannelData(ch);
for (auto& s : block)
s *= gainFactor;
}
}
template <typename T> void processFrame(T& data)
{
auto gainFactor = Decibels::decibelsToGain(gain);
for (auto& s : data)
s *= gainFactor;
}
int handleModulation(double& value)
{
return 0;
}
void setExternalData(const ExternalData& data, int index)
{
}
// Parameter Functions -------------------------------------------------------------------------
template <int P> void setParameter(double v)
{
if (P == 0)
{
gain = (float)v;
}
}
void createParameters(ParameterDataList& data)
{
{
parameter::data p("Gain", { -100.0, 0.0, 0.1 });
registerCallback<0>(p);
p.setDefaultValue(0.0);
p.setSkewForCentre(-12.0);
data.add(std::move(p));
}
}
float gain = 0.0f;
};
}