Skip to content

Commit

Permalink
isInputModulationPort and isOutputModulationPort Removed and Usages R…
Browse files Browse the repository at this point in the history
…eplaced With getPortType I/O Methods
  • Loading branch information
RachelMaryamLocke committed Jun 28, 2023
1 parent 9d3d88e commit 0a5b871
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/headless/tests/BadModulationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BadModulationTest : public UnitTest

bool hasModulationInputs = false;
for (int i = 0; i < proc->getNumInputs(); ++i)
hasModulationInputs |= proc->isInputModulationPort (i);
hasModulationInputs |= proc->getOutputPortType(i) == PortType::modulation;

if (! hasModulationInputs)
processorsWithNoModulation.add (proc->getName());
Expand Down
16 changes: 3 additions & 13 deletions src/processors/BaseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ void BaseProcessor::setEditor (ProcessorEditor* procEditor)
editor = procEditor;
}

PortType BaseProcessor::getInputPortType (int portIndex)
PortType BaseProcessor::getInputPortType (int portIndex) const
{
return inputPortTypes[portIndex];
}

PortType BaseProcessor::getOutputPortType (int portIndex)
PortType BaseProcessor::getOutputPortType (int portIndex) const
{
return outputPortTypes[portIndex];
}
Expand All @@ -366,16 +366,6 @@ juce::Point<int> BaseProcessor::getPosition (Rectangle<int> parentBounds)
return (editorPosition * juce::Point { (float) parentBounds.getWidth(), (float) parentBounds.getHeight() }).toInt();
}

bool BaseProcessor::isInputModulationPort (int portIndex)
{
return inputPortTypes[portIndex] == PortType::modulation;
}

bool BaseProcessor::isOutputModulationPort (int portIndex)
{
return outputPortTypes[portIndex] == PortType::modulation;
}

bool BaseProcessor::isOutputModulationPortConnected()
{
if (getProcessorType() != Modulation)
Expand All @@ -385,7 +375,7 @@ bool BaseProcessor::isOutputModulationPortConnected()
{
for (auto info : connections)
{
if (isOutputModulationPort (info.startPort))
if (getOutputPortType(info.startPort) == PortType::modulation)
return true;
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,15 @@ class BaseProcessor : private JuceProcWrapper

int getNumInputs() const noexcept { return numInputs; }
int getNumOutputs() const noexcept { return numOutputs; }
PortType getInputPortType (int portIndex);
PortType getOutputPortType (int portIndex);
PortType getInputPortType (int portIndex) const;
PortType getOutputPortType (int portIndex) const;

void setPosition (juce::Point<int> pos, Rectangle<int> parentBounds);
void setPosition (const BaseProcessor& other) { editorPosition = other.editorPosition; }
juce::Point<int> getPosition (Rectangle<int> parentBounds);

const auto& getParameters() const { return AudioProcessor::getParameters(); }

bool isInputModulationPort (int portIndex);
bool isOutputModulationPort (int portIndex);
bool isOutputModulationPortConnected();

const std::vector<String>* getParametersToDisableWhenInputIsConnected (int portIndex) const noexcept;
Expand Down

0 comments on commit 0a5b871

Please sign in to comment.