SincWindow.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  QM DSP library
5  Centre for Digital Music, Queen Mary, University of London.
6 
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.
12 */
13 
14 #ifndef QM_DSP_SINC_WINDOW_H
15 #define QM_DSP_SINC_WINDOW_H
16 
17 #include <vector>
18 
24 {
25 public:
33  SincWindow(int length, double p) : m_length(length), m_p(p) { init(); }
34 
35  int getLength() const {
36  return m_length;
37  }
38 
39  const double *getWindow() const {
40  return m_window.data();
41  }
42 
43  void cut(double *src) const {
44  cut(src, src);
45  }
46 
47  void cut(const double *src, double *dst) const {
48  for (int i = 0; i < m_length; ++i) {
49  dst[i] = src[i] * m_window[i];
50  }
51  }
52 
53 private:
54  int m_length;
55  double m_p;
56  std::vector<double> m_window;
57 
58  void init();
59 };
60 
61 #endif
int m_length
Definition: SincWindow.h:54
void init()
Definition: SincWindow.cpp:19
const double * getWindow() const
Definition: SincWindow.h:39
A window containing values of the sinc function, i.e.
Definition: SincWindow.h:23
void cut(double *src) const
Definition: SincWindow.h:43
double m_p
Definition: SincWindow.h:55
std::vector< double > m_window
Definition: SincWindow.h:56
int getLength() const
Definition: SincWindow.h:35
void cut(const double *src, double *dst) const
Definition: SincWindow.h:47
SincWindow(int length, double p)
Construct a windower of the given length, containing the values of sinc(x) with x=0 in the middle...
Definition: SincWindow.h:33