Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real
ReverbUnitBase.hpp
00001 //-------------------------------------------------------------- 00002 // Base class for Reverb unit 00003 // 2017/04/04, Copyright (c) 2017 MIKAMI, Naoki 00004 //-------------------------------------------------------------- 00005 00006 #ifndef REVERB_UNIT_BASE_HPP 00007 #define REVERB_UNIT_BASE_HPP 00008 00009 #include "mbed.h" 00010 #include "Array.hpp" 00011 00012 namespace Mikami 00013 { 00014 // Base class for reverb unit 00015 class ReverbBase 00016 { 00017 public: 00018 // Constructor 00019 ReverbBase(int delay) 00020 : ptr_(0), delay_(delay), un_(delay) 00021 { Clear(); } 00022 00023 // Clear internal delay elements 00024 void Clear() 00025 { for (int n=0; n<delay_; n++) un_[n] = 0; } 00026 00027 protected: 00028 float Get() { return un_[ptr_]; } 00029 00030 float Get(int n) 00031 { 00032 int k = ptr_ + n; 00033 if (k > delay_) k -= delay_; 00034 if (k < 0) k += delay_; 00035 return un_[k]; 00036 } 00037 00038 void Set(float x) 00039 { 00040 un_[ptr_] = x; 00041 if (++ptr_ >= delay_) ptr_ = 0; 00042 } 00043 00044 private: 00045 int ptr_; 00046 int delay_; 00047 Array<float> un_; // for delay 00048 00049 // disallow copy constructor and assignment operator 00050 ReverbBase(const ReverbBase&); 00051 ReverbBase& operator=(const ReverbBase&); 00052 }; 00053 } 00054 #endif // REVERB_UNIT_BASE_HPP
Generated on Tue Jul 12 2022 21:58:54 by
1.7.2