Skip to content

Commit

Permalink
NullPort Introduced and Processors Updated to Use Internal Input and …
Browse files Browse the repository at this point in the history
…Output Port Config
  • Loading branch information
RachelMaryamLocke committed Jun 26, 2023
1 parent b752609 commit dbd45fa
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 21 deletions.
9 changes: 0 additions & 9 deletions src/processors/BaseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ BaseProcessor::BaseProcessor (const String& name,
[] (auto)
{ return PortType::audio; })
{
onOffParam = vts.getRawParameterValue ("on_off");

outputBuffers.resize (jmax (1, numOutputs));
outputBuffers.fill (nullptr);
outputConnections.resize (numOutputs);

inputBuffers.resize (numInputs);
inputsConnected.resize (0);
portMagnitudes.resize (numInputs);
}

BaseProcessor::~BaseProcessor() = default;
Expand Down
17 changes: 11 additions & 6 deletions src/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ template <typename Port, typename PortMapper>
static PortTypesVector initialisePortTypes (PortMapper mapper)
{
auto portTypes = PortTypesVector (magic_enum::enum_count<Port>(), PortType::audio);
magic_enum::enum_for_each<Port> ([&portTypes, &mapper] (auto portType)
{
const auto portIndex = *magic_enum::enum_index ((Port) portType);
portTypes[portIndex] = mapper ((Port) portType); });
if constexpr (magic_enum::enum_count<Port>() > 0)
{
magic_enum::enum_for_each<Port> ([&portTypes, &mapper] (auto portType)
{
const auto portIndex = *magic_enum::enum_index ((Port) portType);
portTypes[portIndex] = mapper ((Port) portType); });
}
return portTypes;
}
} // namespace base_processor_detail
Expand Down Expand Up @@ -260,6 +263,8 @@ class BaseProcessor : private JuceProcWrapper
AudioOutput,
};

enum class NullPort;

private:
std::atomic<float>* onOffParam = nullptr;

Expand Down Expand Up @@ -295,8 +300,8 @@ class BaseProcessor : private JuceProcWrapper

juce::Array<int> inputModulationPorts {};
juce::Array<int> outputModulationPorts {};
base_processor_detail::PortTypesVector inputPortTypes;
base_processor_detail::PortTypesVector outputPortTypes;
const base_processor_detail::PortTypesVector inputPortTypes;
const base_processor_detail::PortTypesVector outputPortTypes;

std::unordered_map<int, std::vector<String>> paramsToDisableWhenInputConnected {};

Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/FreqBandSplitter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "FreqBandSplitter.h"
#include "../ParameterHelpers.h"

FreqBandSplitter::FreqBandSplitter (UndoManager* um) : BaseProcessor ("Frequency Splitter", createParameterLayout(), um)
FreqBandSplitter::FreqBandSplitter (UndoManager* um) : BaseProcessor ("Frequency Splitter",
createParameterLayout(),
BasicInputPort{},
OutputPort{},
um)
{
using namespace ParameterHelpers;
loadParameterPointer (crossLowParam, vts, "cross_low");
Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/InputProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "InputProcessor.h"
#include "../ParameterHelpers.h"

InputProcessor::InputProcessor (UndoManager* um) : BaseProcessor ("Input", createParameterLayout(), um)
InputProcessor::InputProcessor (UndoManager* um) : BaseProcessor ("Input",
createParameterLayout(),
NullPort{},
BasicOutputPort{},
um)
{
uiOptions.backgroundColour = Colours::orange;
}
Expand Down
2 changes: 2 additions & 0 deletions src/processors/utility/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Mixer::Mixer (UndoManager* um) : BaseProcessor ("Mixer",
createParameterLayout(),
InputPort{},
BasicOutputPort{},
um)
{
for (int i = 0; i < numIns; ++i)
Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/Oscilloscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace
constexpr int scopeFps = 30;
}

Oscilloscope::Oscilloscope (UndoManager* um) : BaseProcessor ("Oscilloscope", createParameterLayout(), um)
Oscilloscope::Oscilloscope (UndoManager* um) : BaseProcessor ("Oscilloscope",
createParameterLayout(),
BasicInputPort{},
NullPort{},
um)
{
uiOptions.backgroundColour = Colours::silver.brighter (0.2f);
uiOptions.powerColour = Colours::red;
Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/OutputProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "OutputProcessor.h"
#include "../ParameterHelpers.h"

OutputProcessor::OutputProcessor (UndoManager* um) : BaseProcessor ("Output", createParameterLayout(), um)
OutputProcessor::OutputProcessor (UndoManager* um) : BaseProcessor ("Output",
createParameterLayout(),
BasicInputPort{},
NullPort{},
um)
{
uiOptions.backgroundColour = Colours::lightskyblue;
}
Expand Down
2 changes: 2 additions & 0 deletions src/processors/utility/StereoMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

StereoMerger::StereoMerger (UndoManager* um) : BaseProcessor ("Stereo Merger",
createParameterLayout(),
InputPort{},
BasicOutputPort{},
um)
{
modeParam = vts.getRawParameterValue ("mode");
Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/StereoSplitter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "StereoSplitter.h"
#include "../ParameterHelpers.h"

StereoSplitter::StereoSplitter (UndoManager* um) : BaseProcessor ("Stereo Splitter", createParameterLayout(), um)
StereoSplitter::StereoSplitter (UndoManager* um) : BaseProcessor ("Stereo Splitter",
createParameterLayout(),
BasicInputPort{},
OutputPort{},
um)
{
modeParam = vts.getRawParameterValue ("mode");

Expand Down
6 changes: 5 additions & 1 deletion src/processors/utility/Tuner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace
constexpr int tunerRefreshHz = 24;
}

Tuner::Tuner (UndoManager* um) : BaseProcessor ("Tuner", createParameterLayout(), um)
Tuner::Tuner (UndoManager* um) : BaseProcessor ("Tuner",
createParameterLayout(),
BasicInputPort{},
NullPort{},
um)
{
uiOptions.backgroundColour = Colours::silver.brighter (0.2f);
uiOptions.powerColour = Colours::red;
Expand Down

0 comments on commit dbd45fa

Please sign in to comment.