annotate WindowFunction.cpp @ 37:44d8e5dc1902

Split out Makefile to separate single-platform versions and an .inc file
author Chris Cannam
date Fri, 12 Sep 2014 14:54:55 +0100
parents de7213b35755
children 4cf2d163127b
rev   line source
c@0 1 //
c@0 2 // WindowFunction.cpp
c@0 3 // Tempogram
c@0 4 //
c@0 5 // Created by Carl Bussey on 26/06/2014.
c@0 6 // Copyright (c) 2014 Carl Bussey. All rights reserved.
c@0 7 //
c@0 8
c@0 9 #include "WindowFunction.h"
c@0 10 using std::vector;
c@0 11
c@9 12 //static function
c@0 13 void
c@13 14 WindowFunction::hanning(float * window, const unsigned int &N, const bool &normalise){
c@0 15
c@0 16 float sum = 0;
c@20 17 for(int i = 0; i < (int)N; i++){
c@11 18 window[i] = 0.5*(1-cos((float)2*M_PI*i/N));
c@11 19 sum += window[i];
c@0 20 }
c@0 21 if (normalise){
c@20 22 for(int i = 0; i < (int)N; i++){
c@11 23 window[i] /= sum;
c@0 24 }
c@0 25 }
c@0 26 }