| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /*
- ==============================================================================
- CMLSProcessorChain.cpp
- Created: 12 May 2025 10:05:40am
- Author: Luigi
- ==============================================================================
- */
- #include "CMLSProcessorChain.h"
- CMLSProcessorChain::CMLSProcessorChain()
- {}
- CMLSProcessorChain::~CMLSProcessorChain()
- {}
- void CMLSProcessorChain::reset()
- {
- for (auto& processor : chain)
- {
- if (processor)
- processor->reset();
- }
- }
- void CMLSProcessorChain::prepare(const juce::dsp::ProcessSpec& spec)
- {
- for (auto& processor : chain)
- {
- if (processor)
- processor->prepare(spec);
- }
- }
- void CMLSProcessorChain::process(const juce::dsp::ProcessContextReplacing<float>& context)
- {
- for (int i = 0; i < this->chain.size(); ++i)
- {
- if (this->chain[i] && this->slots[i] == true)
- this->chain[i]->process(context);
- }
- }
- int CMLSProcessorChain::pushProcessor(juce::dsp::ProcessorBase& processor)
- {
- chain.push_back(&processor);
- slots.push_back(true);
- return chain.size() - 1;
- }
- void CMLSProcessorChain::muteProcessrInSlot(int slot)
- {
- slots[slot] = false;
- }
- void CMLSProcessorChain::unmuteProcessorInSlot(int slot)
- {
- slots[slot] = true;
- }
- void CMLSProcessorChain::swapPlaces(int slot1, int slot2)
- {
- if (slot1 < 0 || slot2 < 0 || slot1 >= chain.size() || slot2 >= chain.size())
- return;
- std::swap(chain[slot1], chain[slot2]);
- std::swap(slots[slot1], slots[slot2]);
- }
|