Audio singal input and output example for DISCO-F746. Input: MEMS mic, Output: CN10 OUT, Acoustic effect: echo and frequency shift. DISCO-F746 によるオーディオ信号入出力.入力:MEMS マイク,出力:CN10 OUT,音響効果:エコー,周波数変換.

Dependencies:   F746_GUI F746_SAI_IO

Revision:
10:56f2f01df983
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyAcousticEffector_MIC/ReverbUnitBase.hpp	Mon Apr 10 13:44:13 2017 +0000
@@ -0,0 +1,54 @@
+//--------------------------------------------------------------
+// Base class for Reverb unit
+//  2017/04/04, Copyright (c) 2017 MIKAMI, Naoki
+//--------------------------------------------------------------
+
+#ifndef REVERB_UNIT_BASE_HPP
+#define REVERB_UNIT_BASE_HPP
+
+#include "mbed.h"
+#include "Array.hpp"
+
+namespace Mikami
+{
+    // Base class for reverb unit
+    class ReverbBase
+    {
+    public:
+        // Constructor
+        ReverbBase(int delay)
+            : ptr_(0), delay_(delay), un_(delay)
+        {   Clear(); }
+
+        // Clear internal delay elements
+        void Clear()
+        {   for (int n=0; n<delay_; n++) un_[n] = 0; }
+
+    protected:
+        float Get() { return un_[ptr_]; }
+
+        float Get(int n)
+        {
+            int k = ptr_ + n;
+            if (k > delay_) k -= delay_;
+            if (k < 0) k += delay_;
+            return un_[k];
+        }
+
+        void Set(float x)
+        {
+            un_[ptr_] = x;   
+            if (++ptr_ >=  delay_) ptr_ = 0;
+        }
+
+    private:
+        int ptr_;
+        int delay_;
+        Array<float> un_;   // for delay
+
+        // disallow copy constructor and assignment operator
+        ReverbBase(const ReverbBase&);
+        ReverbBase& operator=(const ReverbBase&);
+    };
+}
+#endif  // REVERB_UNIT_BASE_HPP