mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:29:47 +02:00
commit
0f011e07e5
1 changed files with 2 additions and 2 deletions
|
@ -22,7 +22,7 @@ int SimpleMovingAverage::updateAverage(float sample) {
|
||||||
if (_numSamples > 0) {
|
if (_numSamples > 0) {
|
||||||
_average = (ONE_MINUS_WEIGHTING * _average) + (WEIGHTING * sample);
|
_average = (ONE_MINUS_WEIGHTING * _average) + (WEIGHTING * sample);
|
||||||
|
|
||||||
float eventDelta = (usecTimestampNow() - _lastEventTimestamp) / 1000000;
|
float eventDelta = (usecTimestampNow() - _lastEventTimestamp) / 1000000.0f;
|
||||||
|
|
||||||
if (_numSamples > 1) {
|
if (_numSamples > 1) {
|
||||||
_eventDeltaAverage = (ONE_MINUS_WEIGHTING * _eventDeltaAverage) +
|
_eventDeltaAverage = (ONE_MINUS_WEIGHTING * _eventDeltaAverage) +
|
||||||
|
@ -46,7 +46,7 @@ void SimpleMovingAverage::reset() {
|
||||||
|
|
||||||
float SimpleMovingAverage::getEventDeltaAverage() {
|
float SimpleMovingAverage::getEventDeltaAverage() {
|
||||||
return (ONE_MINUS_WEIGHTING * _eventDeltaAverage) +
|
return (ONE_MINUS_WEIGHTING * _eventDeltaAverage) +
|
||||||
(WEIGHTING * ((usecTimestampNow() - _lastEventTimestamp) / 1000000));
|
(WEIGHTING * ((usecTimestampNow() - _lastEventTimestamp) / 1000000.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
float SimpleMovingAverage::getAverageSampleValuePerSecond() {
|
float SimpleMovingAverage::getAverageSampleValuePerSecond() {
|
||||||
|
|
Loading…
Reference in a new issue