-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlockEffectProcessingChain.hpp
54 lines (43 loc) · 1.4 KB
/
BlockEffectProcessingChain.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// BlockEffectProcessingChain.hpp
// AudioComponents
//
// Created by Aaron Dawson on 9/1/16.
//
//
#ifndef BlockEffectProcessingChain_hpp
#define BlockEffectProcessingChain_hpp
#include <stdio.h>
#include <vector>
#include "BlockEffect.hpp"
class BlockEffectProcessingChain : public BlockEffect {
private:
std::vector<BlockEffect*> effects; // Vector containing all the effects in this chain
public:
// Processes a sample using all the effects in the chain.
double** process(double** outBlock, int blockSize) {
// If the chain has at least one effect, get output from chain
if (effects.size() > 0) {
outBlock = effects.back()->getSamples(outBlock, blockSize);
}
// Otherwise, return zeros
else {
for (int i=0; i<blockSize; i++) {
outBlock[LEFT][i] = 0.0;
outBlock[RIGHT][i] = 0.0;
}
}
return outBlock;
}
void drawSlotView(IRECT rect) {
}
// Adds an effect to the vector of effects
void addEffect(BlockEffect* effect) {
// Add the last effect in the vector as an input for this new effect
if (effects.size() > 0) {
effect->addInput(effects.back());
}
// Add the effect to the vector
effects.push_back(effect);
}};
#endif /* BlockEffectProcessingChain_hpp */