comparison WindowFunction.cpp @ 13:7680cc4c0073

* Tidying - made length of array variables type size_t and for loops unsigned int, where index > 0. * Window length parameter is now a dropdown box.
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Wed, 13 Aug 2014 14:18:00 +0100
parents 09fb76606b2b
children de7213b35755
comparison
equal deleted inserted replaced
12:d58409ecd720 13:7680cc4c0073
9 #include "WindowFunction.h" 9 #include "WindowFunction.h"
10 using std::vector; 10 using std::vector;
11 11
12 //static function 12 //static function
13 void 13 void
14 WindowFunction::hanning(float *window, const unsigned int N, const bool normalise){ 14 WindowFunction::hanning(float * window, const unsigned int &N, const bool &normalise){
15 15
16 float sum = 0; 16 float sum = 0;
17 for(int i = 0; i < N; i++){ 17 for(unsigned int i = 0; i < N; i++){
18 window[i] = 0.5*(1-cos((float)2*M_PI*i/N)); 18 window[i] = 0.5*(1-cos((float)2*M_PI*i/N));
19 sum += window[i]; 19 sum += window[i];
20 } 20 }
21 if (normalise){ 21 if (normalise){
22 for(int i = 0; i < N; i++){ 22 for(int i = 0; i < N; i++){