Mercurial > hg > svcore
comparison base/Window.h @ 162:3fe6660f8fe2
* timestretcher improvements -- simplify API (it can calculate its own
processing block sizes etc)
author | Chris Cannam |
---|---|
date | Wed, 13 Sep 2006 11:56:44 +0000 |
parents | 0ba66b160a02 |
children | 524bcd89743b |
comparison
equal
deleted
inserted
replaced
161:735556300e10 | 162:3fe6660f8fe2 |
---|---|
53 void cut(T *src) const { cut(src, src); } | 53 void cut(T *src) const { cut(src, src); } |
54 void cut(T *src, T *dst) const { | 54 void cut(T *src, T *dst) const { |
55 for (size_t i = 0; i < m_size; ++i) dst[i] = src[i] * m_cache[i]; | 55 for (size_t i = 0; i < m_size; ++i) dst[i] = src[i] * m_cache[i]; |
56 } | 56 } |
57 | 57 |
58 T getArea() { return m_area; } | |
58 T getValue(size_t i) { return m_cache[i]; } | 59 T getValue(size_t i) { return m_cache[i]; } |
59 | 60 |
60 WindowType getType() const { return m_type; } | 61 WindowType getType() const { return m_type; } |
61 size_t getSize() const { return m_size; } | 62 size_t getSize() const { return m_size; } |
62 | 63 |
63 protected: | 64 protected: |
64 WindowType m_type; | 65 WindowType m_type; |
65 size_t m_size; | 66 size_t m_size; |
66 T *m_cache; | 67 T *m_cache; |
68 T m_area; | |
67 | 69 |
68 void encache(); | 70 void encache(); |
69 void cosinewin(T *, T, T, T, T); | 71 void cosinewin(T *, T, T, T, T); |
70 }; | 72 }; |
71 | 73 |
135 cosinewin(mult, 0.35875, 0.48829, 0.14128, 0.01168); | 137 cosinewin(mult, 0.35875, 0.48829, 0.14128, 0.01168); |
136 break; | 138 break; |
137 } | 139 } |
138 | 140 |
139 m_cache = mult; | 141 m_cache = mult; |
142 | |
143 m_area = 0; | |
144 for (int i = 0; i < n; ++i) { | |
145 m_area += m_cache[i]; | |
146 } | |
147 m_area /= n; | |
140 } | 148 } |
141 | 149 |
142 template <typename T> | 150 template <typename T> |
143 void Window<T>::cosinewin(T *mult, T a0, T a1, T a2, T a3) | 151 void Window<T>::cosinewin(T *mult, T a0, T a1, T a2, T a3) |
144 { | 152 { |