HanningWindow, HammingWindow, BlackmanWindow の各クラス. このライブラリを登録した際のプログラム: Demo_Window

Dependents:   TrG_FFT_Analyzer Demo_Window TrG_Spectrogram

Revision:
0:823e9a4ab223
Child:
1:d8673bf6f89c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Blackman.hpp	Sun May 23 06:25:26 2021 +0000
@@ -0,0 +1,38 @@
+//-------------------------------------------------------------------
+//  Blackman 窓による窓掛け
+//      ゼロ詰め(zero-padding)の機能を持つ
+//
+//  2021/05/22, Copyright (c) 2021 MIKAMI, Naoki
+//-------------------------------------------------------------------
+
+#ifndef BLACKMAN_WINDOW_HPP
+#define BLACKMAN_WINDOW_HPP
+
+#include "WindowBase.hpp"
+
+namespace Mikami
+{
+    class BlackmanWindow : public WindowBase
+    {
+    public:
+        // コンストラクタ
+        BlackmanWindow(uint16_t nFft, uint16_t nData)
+                : WindowBase(nFft, nData) { Generate(nData); }
+        BlackmanWindow(uint16_t nFft)
+                : WindowBase(nFft, nFft) { Generate(nFft); }
+
+    private:
+        // 窓関数を生成
+        virtual void Generate(uint16_t nData)
+        {
+            const float PI2L = 6.283185f/(float)nData;
+            for (int k=0; k<nData; k++)
+                Set(k, 0.42f - 0.5f*cosf(k*PI2L) + 0.08f*cosf(k*2*PI2L));
+        }
+
+        // コピー・コンストラクタおよび代入演算子の禁止のため
+        BlackmanWindow(const BlackmanWindow& );
+        BlackmanWindow& operator=(const BlackmanWindow& );
+    };
+}
+#endif  // BLACKMAN_WINDOW_HPP
\ No newline at end of file