Output the audio signal with filtering by graphic equalizer in the *.wav file on the SD card using onboard CODEC. SD カードの *.wav ファイルのオーディオ信号をグラフィック・イコライザを通して,ボードに搭載されているCODEC で出力する.
Dependencies: F746_GUI F746_SAI_IO SD_PlayerSkeleton FrequencyResponseDrawer
mbed_src_STM32F7/common/CallChain.cpp@24:f78f9d0ac262, 2017-04-10 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Mon Apr 10 04:07:35 2017 +0000
- Revision:
- 24:f78f9d0ac262
- Parent:
- 16:cbb726ac20d8
25
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 16:cbb726ac20d8 | 1 | #include "CallChain.h" |
MikamiUitOpen | 16:cbb726ac20d8 | 2 | #include "cmsis.h" |
MikamiUitOpen | 16:cbb726ac20d8 | 3 | |
MikamiUitOpen | 16:cbb726ac20d8 | 4 | namespace mbed { |
MikamiUitOpen | 16:cbb726ac20d8 | 5 | |
MikamiUitOpen | 16:cbb726ac20d8 | 6 | CallChain::CallChain(int size) : _chain(), _size(size), _elements(0) { |
MikamiUitOpen | 16:cbb726ac20d8 | 7 | _chain = new pFunctionPointer_t[size](); |
MikamiUitOpen | 16:cbb726ac20d8 | 8 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 9 | |
MikamiUitOpen | 16:cbb726ac20d8 | 10 | CallChain::~CallChain() { |
MikamiUitOpen | 16:cbb726ac20d8 | 11 | clear(); |
MikamiUitOpen | 16:cbb726ac20d8 | 12 | delete _chain; |
MikamiUitOpen | 16:cbb726ac20d8 | 13 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 14 | |
MikamiUitOpen | 16:cbb726ac20d8 | 15 | pFunctionPointer_t CallChain::add(void (*function)(void)) { |
MikamiUitOpen | 16:cbb726ac20d8 | 16 | return common_add(new FunctionPointer(function)); |
MikamiUitOpen | 16:cbb726ac20d8 | 17 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 18 | |
MikamiUitOpen | 16:cbb726ac20d8 | 19 | pFunctionPointer_t CallChain::add_front(void (*function)(void)) { |
MikamiUitOpen | 16:cbb726ac20d8 | 20 | return common_add_front(new FunctionPointer(function)); |
MikamiUitOpen | 16:cbb726ac20d8 | 21 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 22 | |
MikamiUitOpen | 16:cbb726ac20d8 | 23 | int CallChain::size() const { |
MikamiUitOpen | 16:cbb726ac20d8 | 24 | return _elements; |
MikamiUitOpen | 16:cbb726ac20d8 | 25 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 26 | |
MikamiUitOpen | 16:cbb726ac20d8 | 27 | pFunctionPointer_t CallChain::get(int i) const { |
MikamiUitOpen | 16:cbb726ac20d8 | 28 | if (i < 0 || i >= _elements) |
MikamiUitOpen | 16:cbb726ac20d8 | 29 | return NULL; |
MikamiUitOpen | 16:cbb726ac20d8 | 30 | return _chain[i]; |
MikamiUitOpen | 16:cbb726ac20d8 | 31 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 32 | |
MikamiUitOpen | 16:cbb726ac20d8 | 33 | int CallChain::find(pFunctionPointer_t f) const { |
MikamiUitOpen | 16:cbb726ac20d8 | 34 | for (int i = 0; i < _elements; i++) |
MikamiUitOpen | 16:cbb726ac20d8 | 35 | if (f == _chain[i]) |
MikamiUitOpen | 16:cbb726ac20d8 | 36 | return i; |
MikamiUitOpen | 16:cbb726ac20d8 | 37 | return -1; |
MikamiUitOpen | 16:cbb726ac20d8 | 38 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 39 | |
MikamiUitOpen | 16:cbb726ac20d8 | 40 | void CallChain::clear() { |
MikamiUitOpen | 16:cbb726ac20d8 | 41 | for(int i = 0; i < _elements; i ++) { |
MikamiUitOpen | 16:cbb726ac20d8 | 42 | delete _chain[i]; |
MikamiUitOpen | 16:cbb726ac20d8 | 43 | _chain[i] = NULL; |
MikamiUitOpen | 16:cbb726ac20d8 | 44 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 45 | _elements = 0; |
MikamiUitOpen | 16:cbb726ac20d8 | 46 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 47 | |
MikamiUitOpen | 16:cbb726ac20d8 | 48 | bool CallChain::remove(pFunctionPointer_t f) { |
MikamiUitOpen | 16:cbb726ac20d8 | 49 | int i; |
MikamiUitOpen | 16:cbb726ac20d8 | 50 | |
MikamiUitOpen | 16:cbb726ac20d8 | 51 | if ((i = find(f)) == -1) |
MikamiUitOpen | 16:cbb726ac20d8 | 52 | return false; |
MikamiUitOpen | 16:cbb726ac20d8 | 53 | if (i != _elements - 1) |
MikamiUitOpen | 16:cbb726ac20d8 | 54 | memmove(_chain + i, _chain + i + 1, (_elements - i - 1) * sizeof(pFunctionPointer_t)); |
MikamiUitOpen | 16:cbb726ac20d8 | 55 | delete f; |
MikamiUitOpen | 16:cbb726ac20d8 | 56 | _elements --; |
MikamiUitOpen | 16:cbb726ac20d8 | 57 | return true; |
MikamiUitOpen | 16:cbb726ac20d8 | 58 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 59 | |
MikamiUitOpen | 16:cbb726ac20d8 | 60 | void CallChain::call() { |
MikamiUitOpen | 16:cbb726ac20d8 | 61 | for(int i = 0; i < _elements; i++) |
MikamiUitOpen | 16:cbb726ac20d8 | 62 | _chain[i]->call(); |
MikamiUitOpen | 16:cbb726ac20d8 | 63 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 64 | |
MikamiUitOpen | 16:cbb726ac20d8 | 65 | void CallChain::_check_size() { |
MikamiUitOpen | 16:cbb726ac20d8 | 66 | if (_elements < _size) |
MikamiUitOpen | 16:cbb726ac20d8 | 67 | return; |
MikamiUitOpen | 16:cbb726ac20d8 | 68 | _size = (_size < 4) ? 4 : _size + 4; |
MikamiUitOpen | 16:cbb726ac20d8 | 69 | pFunctionPointer_t* new_chain = new pFunctionPointer_t[_size](); |
MikamiUitOpen | 16:cbb726ac20d8 | 70 | memcpy(new_chain, _chain, _elements * sizeof(pFunctionPointer_t)); |
MikamiUitOpen | 16:cbb726ac20d8 | 71 | delete _chain; |
MikamiUitOpen | 16:cbb726ac20d8 | 72 | _chain = new_chain; |
MikamiUitOpen | 16:cbb726ac20d8 | 73 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 74 | |
MikamiUitOpen | 16:cbb726ac20d8 | 75 | pFunctionPointer_t CallChain::common_add(pFunctionPointer_t pf) { |
MikamiUitOpen | 16:cbb726ac20d8 | 76 | _check_size(); |
MikamiUitOpen | 16:cbb726ac20d8 | 77 | _chain[_elements] = pf; |
MikamiUitOpen | 16:cbb726ac20d8 | 78 | _elements ++; |
MikamiUitOpen | 16:cbb726ac20d8 | 79 | return pf; |
MikamiUitOpen | 16:cbb726ac20d8 | 80 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 81 | |
MikamiUitOpen | 16:cbb726ac20d8 | 82 | pFunctionPointer_t CallChain::common_add_front(pFunctionPointer_t pf) { |
MikamiUitOpen | 16:cbb726ac20d8 | 83 | _check_size(); |
MikamiUitOpen | 16:cbb726ac20d8 | 84 | memmove(_chain + 1, _chain, _elements * sizeof(pFunctionPointer_t)); |
MikamiUitOpen | 16:cbb726ac20d8 | 85 | _chain[0] = pf; |
MikamiUitOpen | 16:cbb726ac20d8 | 86 | _elements ++; |
MikamiUitOpen | 16:cbb726ac20d8 | 87 | return pf; |
MikamiUitOpen | 16:cbb726ac20d8 | 88 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 89 | |
MikamiUitOpen | 16:cbb726ac20d8 | 90 | } // namespace mbed |