1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
5 Centre for Digital Music, Queen Mary, University of London.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. See the file
11 COPYING included with this distribution for more information.
14 #include "SincWindow.h"
23 } else if (m_length < 2) {
24 m_window.push_back(1);
28 int n0 = (m_length % 2 == 0 ? m_length/2 : (m_length - 1)/2);
29 int n1 = (m_length % 2 == 0 ? m_length/2 : (m_length + 1)/2);
30 double m = 2 * M_PI / m_p;
32 for (int i = 0; i < n0; ++i) {
33 double x = ((m_length / 2) - i) * m;
34 m_window.push_back(sin(x) / x);
37 m_window.push_back(1.0);
39 for (int i = 1; i < n1; ++i) {
41 m_window.push_back(sin(x) / x);