Mercurial > hg > qm-dsp
comparison base/SincWindow.cpp @ 483:fdaa63607c15
Untabify, indent, tidy
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 31 May 2019 11:54:32 +0100 |
parents | 5d9489187abd |
children |
comparison
equal
deleted
inserted
replaced
482:cbe668c7d724 | 483:fdaa63607c15 |
---|---|
17 | 17 |
18 void | 18 void |
19 SincWindow::init() | 19 SincWindow::init() |
20 { | 20 { |
21 if (m_length < 1) { | 21 if (m_length < 1) { |
22 return; | 22 return; |
23 } else if (m_length < 2) { | 23 } else if (m_length < 2) { |
24 m_window.push_back(1); | 24 m_window.push_back(1); |
25 return; | 25 return; |
26 } else { | 26 } else { |
27 | 27 |
28 int n0 = (m_length % 2 == 0 ? m_length/2 : (m_length - 1)/2); | 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); | 29 int n1 = (m_length % 2 == 0 ? m_length/2 : (m_length + 1)/2); |
30 double m = 2 * M_PI / m_p; | 30 double m = 2 * M_PI / m_p; |
31 | 31 |
32 for (int i = 0; i < n0; ++i) { | 32 for (int i = 0; i < n0; ++i) { |
33 double x = ((m_length / 2) - i) * m; | 33 double x = ((m_length / 2) - i) * m; |
34 m_window.push_back(sin(x) / x); | 34 m_window.push_back(sin(x) / x); |
35 } | 35 } |
36 | 36 |
37 m_window.push_back(1.0); | 37 m_window.push_back(1.0); |
38 | 38 |
39 for (int i = 1; i < n1; ++i) { | 39 for (int i = 1; i < n1; ++i) { |
40 double x = i * m; | 40 double x = i * m; |
41 m_window.push_back(sin(x) / x); | 41 m_window.push_back(sin(x) / x); |
42 } | 42 } |
43 } | 43 } |
44 } | 44 } |
45 | 45 |