Skip to content

Commit

Permalink
Still process MIDI Modulator when output is not connected (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 authored Mar 2, 2025
1 parent 6ef1720 commit 3e61f31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/processors/BaseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,20 @@ juce::Point<int> BaseProcessor::getPosition (juce::Rectangle<int> parentBounds)
return (editorPosition * juce::Point { (float) parentBounds.getWidth(), (float) parentBounds.getHeight() }).toInt();
}

bool BaseProcessor::isOutputModulationPortConnected()
bool BaseProcessor::onlyHasModulationOutput() const
{
if (getProcessorType() != Modulation)
return false;

for (int portIdx = 0; portIdx < getNumOutputs(); ++portIdx)
{
if (getOutputPortType (portIdx) != PortType::modulation)
return false;
}
return true;
}

bool BaseProcessor::isOutputModulationPortConnected() const
{
if (getProcessorType() != Modulation)
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class BaseProcessor : private JuceProcWrapper
int getForwardingParameterSlotIndex() const noexcept { return forwardingParamsSlotIndex; }
void setForwardingParameterSlotIndex (int index) { forwardingParamsSlotIndex = index; }

bool isOutputModulationPortConnected();
bool onlyHasModulationOutput() const;
bool isOutputModulationPortConnected() const;
const std::vector<String>* getParametersToDisableWhenInputIsConnected (int portIndex) const noexcept;
const std::vector<String>* getParametersToEnableWhenInputIsConnected (int portIndex) const noexcept;

Expand Down
3 changes: 2 additions & 1 deletion src/processors/chain/ProcessorChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ void ProcessorChain::processAudio (AudioBuffer<float>& buffer, const MidiBuffer&
// process standalone modulation ports
auto noInputsConnected = processor->getNumInputConnections() == 0;
auto modOutputConnected = processor->isOutputModulationPortConnected();
if (noInputsConnected && modOutputConnected)
auto onlyModOut = processor->onlyHasModulationOutput();
if (noInputsConnected && (modOutputConnected || onlyModOut))
runProcessor (processor, inputBuffer, outProcessed);
}

Expand Down

0 comments on commit 3e61f31

Please sign in to comment.