You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
416 B
32 lines
416 B
4 years ago
|
#include "fold.h"
|
||
|
#include <math.h>
|
||
|
|
||
|
using namespace daisysp;
|
||
|
|
||
|
|
||
|
void Fold::Init()
|
||
|
{
|
||
|
incr_ = 1000.f;
|
||
|
sample_index_ = 0;
|
||
|
index_ = 0.0f;
|
||
|
value_ = 0.0f;
|
||
|
}
|
||
|
|
||
|
float Fold::Process(float in)
|
||
|
{
|
||
|
float out;
|
||
|
|
||
|
if(index_ < sample_index_)
|
||
|
{
|
||
|
index_ += incr_;
|
||
|
out = value_ = in;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
out = value_;
|
||
|
}
|
||
|
|
||
|
sample_index_++;
|
||
|
return out;
|
||
|
}
|