Realtime sound spectrogram using FFT or linear prediction. Spectrogram is displayed on the display of PC. リアルタイム・スペクトログラム.解析の手法:FFT,線形予測法.スペクトログラムは PC のディスプレー装置に表示される.PC 側のプログラム:F446_Spectrogram.
Dependencies: Array_Matrix mbed SerialTxRxIntr F446_AD_DA UIT_FFT_Real
DoubleBufferMatrix.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2019-11-24
- Revision:
- 7:5ba884060d3b
File content as of revision 7:5ba884060d3b:
//-------------------------------------------------------- // ダブル・バッファの template クラス // バッファに2次元配列(Matrix クラス)を使用 // // 2019/11/22, Copyright (c) 2019 MIKAMI, Naoki //-------------------------------------------------------- #ifndef DOUBLE_BUFFER_MATRIX_HPP #define DOUBLE_BUFFER_MATRIX_HPP #include "Matrix.hpp" using namespace Mikami; template<class T> class DoubleBuffer { public: // コンストラクタ explicit DoubleBuffer(int size, T initialValue = 0) : N_(size), buf_(2, size, initialValue), ping_(0), pong_(1), index_(0), full_(false) {} // データを格納 void Store(T data) { buf_[ping_][index_++] = data; } // 出力バッファからデータの取り出し T Get(int n) const { return buf_[pong_][n]; } // バッファが満杯でバッファを切り替える bool IsFullSwitch() { if (index_ < N_) return false; ping_ ^= 0x1; // バッファ切換えのため pong_ ^= 0x1; // バッファ切換えのため index_ = 0; full_ = true; return true; } // バッファが満杯で,true を返す bool IsFull() { bool temp = full_; if (full_) full_ = false; return temp; } private: const int N_; // バッファのサイズ Matrix<T> buf_; // バッファ int ping_, pong_; // バッファ切替用 int index_; // 入力データのカウンタ bool full_; // 満杯の場合 true // コピー・コンストラクタおよび代入演算子の禁止のため DoubleBuffer(const DoubleBuffer&); DoubleBuffer& operator=(const DoubleBuffer&); }; #endif // DOUBLE_BUFFER_MATRIX_HPP