view WindowFunction.cpp @ 31:f795b84c1ff2

This include change seems necessary for my compiler
author Chris Cannam
date Thu, 04 Sep 2014 10:08:09 +0100
parents de7213b35755
children 4cf2d163127b
line wrap: on
line source
//
//  WindowFunction.cpp
//  Tempogram
//
//  Created by Carl Bussey on 26/06/2014.
//  Copyright (c) 2014 Carl Bussey. All rights reserved.
//

#include "WindowFunction.h"
using std::vector;

//static function
void
WindowFunction::hanning(float * window, const unsigned int &N, const bool &normalise){
    
    float sum = 0;
    for(int i = 0; i < (int)N; i++){
        window[i] = 0.5*(1-cos((float)2*M_PI*i/N));
        sum += window[i];
    }
    if (normalise){
        for(int i = 0; i < (int)N; i++){
            window[i] /= sum;
        }
    }
}