/usr/include/qm-dsp/base/SincWindow.h is in libqm-dsp-dev 1.7.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
QM DSP library
Centre for Digital Music, Queen Mary, University of London.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#ifndef SINC_WINDOW_H
#define SINC_WINDOW_H
#include <vector>
/**
* A window containing values of the sinc function, i.e. sin(x)/x with
* sinc(0) == 1, with x == 0 at the centre.
*/
class SincWindow
{
public:
/**
* Construct a windower of the given length, containing the values
* of sinc(x) with x=0 in the middle, i.e. at sample (length-1)/2
* for odd or (length/2)+1 for even length, such that the distance
* from -pi to pi (the nearest zero crossings either side of the
* peak) is p samples.
*/
SincWindow(int length, double p) : m_length(length), m_p(p) { init(); }
int getLength() const {
return m_length;
}
const double *getWindow() const {
return m_window.data();
}
void cut(double *src) const {
cut(src, src);
}
void cut(const double *src, double *dst) const {
for (int i = 0; i < m_length; ++i) {
dst[i] = src[i] * m_window[i];
}
}
private:
int m_length;
double m_p;
std::vector<double> m_window;
void init();
};
#endif
|