Skip to content
Snippets Groups Projects
Commit cc3a6d8e authored by Michael Zbyszyński's avatar Michael Zbyszyński
Browse files

moving rapidStream, documenting

parent 4834c4cc
Branches
Tags
No related merge requests found
......@@ -866,7 +866,7 @@ FILE_PATTERNS = *.c \
# be searched for input files as well.
# The default value is: NO.
RECURSIVE = NO
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a
......
#ifndef rapidStream_h
#define rapidStream_h
#include <stdint.h>
//Buffer of past values
//Standard Deviation over Window
//Min accel over window
//Max accel over window
//Buffer of past satisfying condition
//expression
class rapidStream {
public:
rapidStream();
rapidStream(int windowSize);
~rapidStream();
void clear();
void pushToWindow(double input);
double velocity();
double acceleration();
double minimum();
double maximum();
double sum();
double mean();
double standardDeviation();
double minVelocity();
double maxVelocity();
double minAcceleration();
double maxAcceleration();
private:
uint32_t windowSize;
uint32_t windowIndex;
double *circularWindow;
double calcCurrentVel(int i);
};
#endif
\ No newline at end of file
/*
* rapidStream.cpp
* Created by Michael Zbyszynski on 6 Feb 2017
* Copyright © 2017 Goldsmiths. All rights reserved.
*/
#include "rapidStream.h"
#include <iostream>
#include <cmath>
......
/*
* rapidStream.h
* Created by Michael Zbyszynski on 6 Feb 2017
* Copyright © 2017 Goldsmiths. All rights reserved.
*/
#ifndef rapidStream_h
#define rapidStream_h
#include <stdint.h>
class rapidStream {
public:
/**
* Create a circular buffer with 3 elements.
*/
rapidStream();
/**
* Create a circular buffer with an arbitrary number of elements.
* @param int: number of elements to hold in the buffer
*/
rapidStream(int windowSize);
~rapidStream();
/**
* Resets all the values in the buffer to zero.
*/
void clear();
/** Add a value to a circular buffer whose size is defined at creation.
* @param double: value to be pushed into circular buffer.
*/
void pushToWindow(double input);
/** Calculate the first-order difference (aka velocity) between the last two inputs.
* @return double: difference between last two inputs.
*/
double velocity();
/** Calculate the second-order difference (aka acceleration) over the last three inputs.
* @return double: acceleration over the last three inputs.
*/
double acceleration();
/** Find the minimum value in the buffer.
* @return double: minimum.
*/
double minimum();
/** Find the maximum value in the buffer.
* @return double: maximum.
*/
double maximum();
/** Calculate the sum of all values in the buffer.
* @return double: sum.
*/
double sum();
/** Calculate the mean of all values in the buffer.
* @return double: mean.
*/
double mean();
/** Calculate the standard deviation of all values in the buffer.
* @return double: standard deviation.
*/
double standardDeviation();
/** Calculate the minimum first-order difference over consecutive inputs in the buffer.
* @return double: minimum velocity.
*/
double minVelocity();
/** Calculate the maximum first-order difference over consecutive inputs in the buffer.
* @return double: maximum velocity.
*/
double maxVelocity();
/** Calculate the minimum second-order difference over consecutive inputs in the buffer.
* @return double: minimum acceleration.
*/
double minAcceleration();
/** Calculate the maximum second-order difference over consecutive inputs in the buffer.
* @return double: maximum acceleration.
*/
double maxAcceleration();
private:
uint32_t windowSize;
uint32_t windowIndex;
double *circularWindow;
double calcCurrentVel(int i);
};
#endif
\ No newline at end of file
/*
* signalProcessing.h
* Created by Michael Zbyszynski on 6 Feb 2017
* Copyright © 2017 Goldsmiths. All rights reserved.
*/
#ifndef signalProcessing_h
#define signalProcessing_h
#include "rapidMix.h"
#include "maximilian.h"
#include "maxim.h"
#include "rapidStream.h"
#include "rapidPiPoTools.h"
RAPIDMIX_BEGIN_NAMESPACE
typedef maxiFFT FFT;
typedef maxiMFCC MFCC;
typedef rapidStream rapidStream; //MZ: Best... typedef... EVER!
RAPIDMIX_END_NAMESPACE
#endif
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment