📄 comb.h
字号:
// Comb filter class
//
// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// This code is public domain
#ifndef _comb_
#define _comb_
#include "denormals.h"
class comb
{
public:
comb()
{
filterstore = 0;
bufidx = 0;
}
void setbuffer(float *buf, int size)
{
buffer = buf;
bufsize = size;
}
__forceinline float process(float input)
{
float output;
output = buffer[bufidx];
undenormalise(output);
filterstore = (output*damp2) + (filterstore*damp1);
undenormalise(filterstore);
buffer[bufidx] = input + (filterstore*feedback);
if(++bufidx>=bufsize) bufidx = 0;
return output;
}
void mute()
{
for (int i=0; i<bufsize; i++)
buffer[i]=0;
}
void setdamp(float val)
{
damp1 = val;
damp2 = 1-val;
}
float getdamp()
{
return damp1;
}
void setfeedback(float val)
{
feedback = val;
}
float getfeedback()
{
return feedback;
}
private:
float feedback;
float filterstore;
float damp1;
float damp2;
float *buffer;
int bufsize;
int bufidx;
};
#endif //_comb_
//ends
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -