mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-10 18:47:23 +02:00
fix a leak in StdDev
This commit is contained in:
parent
c04e653cf3
commit
4fd22914c0
2 changed files with 9 additions and 6 deletions
|
@ -13,14 +13,15 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "StdDev.h"
|
#include "StdDev.h"
|
||||||
|
|
||||||
const int NUM_SAMPLES = 1000;
|
StDev::StDev() :
|
||||||
|
_data(),
|
||||||
StDev::StDev() {
|
_sampleCount(0)
|
||||||
_data = new float[NUM_SAMPLES];
|
{
|
||||||
_sampleCount = 0;
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StDev::reset() {
|
void StDev::reset() {
|
||||||
|
memset(&_data, 0, sizeof(_data));
|
||||||
_sampleCount = 0;
|
_sampleCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#ifndef hifi_StdDev_h
|
#ifndef hifi_StdDev_h
|
||||||
#define hifi_StdDev_h
|
#define hifi_StdDev_h
|
||||||
|
|
||||||
|
const int NUM_SAMPLES = 1000;
|
||||||
|
|
||||||
class StDev {
|
class StDev {
|
||||||
public:
|
public:
|
||||||
StDev();
|
StDev();
|
||||||
|
@ -21,7 +23,7 @@ public:
|
||||||
float getStDev() const;
|
float getStDev() const;
|
||||||
int getSamples() const { return _sampleCount; }
|
int getSamples() const { return _sampleCount; }
|
||||||
private:
|
private:
|
||||||
float* _data;
|
float _data[NUM_SAMPLES];
|
||||||
int _sampleCount;
|
int _sampleCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue