-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchroederAllPass.cpp
53 lines (39 loc) · 1.09 KB
/
SchroederAllPass.cpp
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
//
// SchroederAllPass.cpp
// SchroederAllPassTest
//
// Created by Sam on 16/02/2018.
// Copyright © 2018 Sam. All rights reserved.
//
#include "SchroederAllPass.hpp"
SchroederAllPass::SchroederAllPass(float inValue, float inG){
delayLength = inValue;
g = inG;
}
void SchroederAllPass::process(float* samples, int bufferSize){
for(int i = 0; i < bufferSize; i++)
samples[i] = processSingleSample(samples[i]);
}
float SchroederAllPass::processSingleSample(float sample){
delayedSample = CB.readCubic(delayLength);
CB.write(sample + (delayedSample * g));
feedFordwardSample = sample * -g;
return (delayedSample + feedFordwardSample);
}
void SchroederAllPass::setFeedback(float inValue){
g = inValue;
}
float SchroederAllPass::getFeedback(){
return g;
}
void SchroederAllPass::setDelayLength(float inValue){
delayLength = inValue;
if (delayLength > CB.getBufferLength())
CB.setBufferLength(delayLength);
}
float SchroederAllPass::getDelayLength(){
return delayLength;
}
void SchroederAllPass::setFs(int inValue){
Fs = inValue;
}