Skip to content

Commit

Permalink
Average (#110)
Browse files Browse the repository at this point in the history
* average

* Ok

* Oops
  • Loading branch information
Andreya-Autumn authored Jun 19, 2024
1 parent f363422 commit fa7282c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/sst/basic-blocks/dsp/FollowSlewAndSmooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,16 @@ struct RunningAverage
size_t nPoints{0};
size_t head{0}, tail{0};
float avg{0}, oneOverN{1};
RunningAverage(float *ontoStorage, size_t np) : storage{ontoStorage}, nPoints{np}
RunningAverage() {}

void setStorage(float *s, size_t np)
{
reset();
storage = s;
nPoints = np;
oneOverN = 1.0 / (nPoints - 1);
}
RunningAverage() = delete;


void reset()
{
std::fill(storage, storage + nPoints, 0.f);
Expand Down

0 comments on commit fa7282c

Please sign in to comment.