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/api/CallChain.h@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 | /* mbed Microcontroller Library |
MikamiUitOpen | 16:cbb726ac20d8 | 2 | * Copyright (c) 2006-2013 ARM Limited |
MikamiUitOpen | 16:cbb726ac20d8 | 3 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
MikamiUitOpen | 16:cbb726ac20d8 | 5 | * you may not use this file except in compliance with the License. |
MikamiUitOpen | 16:cbb726ac20d8 | 6 | * You may obtain a copy of the License at |
MikamiUitOpen | 16:cbb726ac20d8 | 7 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MikamiUitOpen | 16:cbb726ac20d8 | 9 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 10 | * Unless required by applicable law or agreed to in writing, software |
MikamiUitOpen | 16:cbb726ac20d8 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
MikamiUitOpen | 16:cbb726ac20d8 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MikamiUitOpen | 16:cbb726ac20d8 | 13 | * See the License for the specific language governing permissions and |
MikamiUitOpen | 16:cbb726ac20d8 | 14 | * limitations under the License. |
MikamiUitOpen | 16:cbb726ac20d8 | 15 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 16 | #ifndef MBED_CALLCHAIN_H |
MikamiUitOpen | 16:cbb726ac20d8 | 17 | #define MBED_CALLCHAIN_H |
MikamiUitOpen | 16:cbb726ac20d8 | 18 | |
MikamiUitOpen | 16:cbb726ac20d8 | 19 | #include "FunctionPointer.h" |
MikamiUitOpen | 16:cbb726ac20d8 | 20 | #include <string.h> |
MikamiUitOpen | 16:cbb726ac20d8 | 21 | |
MikamiUitOpen | 16:cbb726ac20d8 | 22 | namespace mbed { |
MikamiUitOpen | 16:cbb726ac20d8 | 23 | |
MikamiUitOpen | 16:cbb726ac20d8 | 24 | /** Group one or more functions in an instance of a CallChain, then call them in |
MikamiUitOpen | 16:cbb726ac20d8 | 25 | * sequence using CallChain::call(). Used mostly by the interrupt chaining code, |
MikamiUitOpen | 16:cbb726ac20d8 | 26 | * but can be used for other purposes. |
MikamiUitOpen | 16:cbb726ac20d8 | 27 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 28 | * Example: |
MikamiUitOpen | 16:cbb726ac20d8 | 29 | * @code |
MikamiUitOpen | 16:cbb726ac20d8 | 30 | * #include "mbed.h" |
MikamiUitOpen | 16:cbb726ac20d8 | 31 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 32 | * CallChain chain; |
MikamiUitOpen | 16:cbb726ac20d8 | 33 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 34 | * void first(void) { |
MikamiUitOpen | 16:cbb726ac20d8 | 35 | * printf("'first' function.\n"); |
MikamiUitOpen | 16:cbb726ac20d8 | 36 | * } |
MikamiUitOpen | 16:cbb726ac20d8 | 37 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 38 | * void second(void) { |
MikamiUitOpen | 16:cbb726ac20d8 | 39 | * printf("'second' function.\n"); |
MikamiUitOpen | 16:cbb726ac20d8 | 40 | * } |
MikamiUitOpen | 16:cbb726ac20d8 | 41 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 42 | * class Test { |
MikamiUitOpen | 16:cbb726ac20d8 | 43 | * public: |
MikamiUitOpen | 16:cbb726ac20d8 | 44 | * void f(void) { |
MikamiUitOpen | 16:cbb726ac20d8 | 45 | * printf("A::f (class member).\n"); |
MikamiUitOpen | 16:cbb726ac20d8 | 46 | * } |
MikamiUitOpen | 16:cbb726ac20d8 | 47 | * }; |
MikamiUitOpen | 16:cbb726ac20d8 | 48 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 49 | * int main() { |
MikamiUitOpen | 16:cbb726ac20d8 | 50 | * Test test; |
MikamiUitOpen | 16:cbb726ac20d8 | 51 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 52 | * chain.add(second); |
MikamiUitOpen | 16:cbb726ac20d8 | 53 | * chain.add_front(first); |
MikamiUitOpen | 16:cbb726ac20d8 | 54 | * chain.add(&test, &Test::f); |
MikamiUitOpen | 16:cbb726ac20d8 | 55 | * chain.call(); |
MikamiUitOpen | 16:cbb726ac20d8 | 56 | * } |
MikamiUitOpen | 16:cbb726ac20d8 | 57 | * @endcode |
MikamiUitOpen | 16:cbb726ac20d8 | 58 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 59 | |
MikamiUitOpen | 16:cbb726ac20d8 | 60 | typedef FunctionPointer* pFunctionPointer_t; |
MikamiUitOpen | 16:cbb726ac20d8 | 61 | |
MikamiUitOpen | 16:cbb726ac20d8 | 62 | class CallChain { |
MikamiUitOpen | 16:cbb726ac20d8 | 63 | public: |
MikamiUitOpen | 16:cbb726ac20d8 | 64 | /** Create an empty chain |
MikamiUitOpen | 16:cbb726ac20d8 | 65 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 66 | * @param size (optional) Initial size of the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 67 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 68 | CallChain(int size = 4); |
MikamiUitOpen | 16:cbb726ac20d8 | 69 | virtual ~CallChain(); |
MikamiUitOpen | 16:cbb726ac20d8 | 70 | |
MikamiUitOpen | 16:cbb726ac20d8 | 71 | /** Add a function at the end of the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 72 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 73 | * @param function A pointer to a void function |
MikamiUitOpen | 16:cbb726ac20d8 | 74 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 75 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 76 | * The function object created for 'function' |
MikamiUitOpen | 16:cbb726ac20d8 | 77 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 78 | pFunctionPointer_t add(void (*function)(void)); |
MikamiUitOpen | 16:cbb726ac20d8 | 79 | |
MikamiUitOpen | 16:cbb726ac20d8 | 80 | /** Add a function at the end of the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 81 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 82 | * @param tptr pointer to the object to call the member function on |
MikamiUitOpen | 16:cbb726ac20d8 | 83 | * @param mptr pointer to the member function to be called |
MikamiUitOpen | 16:cbb726ac20d8 | 84 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 85 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 86 | * The function object created for 'tptr' and 'mptr' |
MikamiUitOpen | 16:cbb726ac20d8 | 87 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 88 | template<typename T> |
MikamiUitOpen | 16:cbb726ac20d8 | 89 | pFunctionPointer_t add(T *tptr, void (T::*mptr)(void)) { |
MikamiUitOpen | 16:cbb726ac20d8 | 90 | return common_add(new FunctionPointer(tptr, mptr)); |
MikamiUitOpen | 16:cbb726ac20d8 | 91 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 92 | |
MikamiUitOpen | 16:cbb726ac20d8 | 93 | /** Add a function at the beginning of the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 94 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 95 | * @param function A pointer to a void function |
MikamiUitOpen | 16:cbb726ac20d8 | 96 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 97 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 98 | * The function object created for 'function' |
MikamiUitOpen | 16:cbb726ac20d8 | 99 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 100 | pFunctionPointer_t add_front(void (*function)(void)); |
MikamiUitOpen | 16:cbb726ac20d8 | 101 | |
MikamiUitOpen | 16:cbb726ac20d8 | 102 | /** Add a function at the beginning of the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 103 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 104 | * @param tptr pointer to the object to call the member function on |
MikamiUitOpen | 16:cbb726ac20d8 | 105 | * @param mptr pointer to the member function to be called |
MikamiUitOpen | 16:cbb726ac20d8 | 106 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 107 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 108 | * The function object created for 'tptr' and 'mptr' |
MikamiUitOpen | 16:cbb726ac20d8 | 109 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 110 | template<typename T> |
MikamiUitOpen | 16:cbb726ac20d8 | 111 | pFunctionPointer_t add_front(T *tptr, void (T::*mptr)(void)) { |
MikamiUitOpen | 16:cbb726ac20d8 | 112 | return common_add_front(new FunctionPointer(tptr, mptr)); |
MikamiUitOpen | 16:cbb726ac20d8 | 113 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 114 | |
MikamiUitOpen | 16:cbb726ac20d8 | 115 | /** Get the number of functions in the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 116 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 117 | int size() const; |
MikamiUitOpen | 16:cbb726ac20d8 | 118 | |
MikamiUitOpen | 16:cbb726ac20d8 | 119 | /** Get a function object from the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 120 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 121 | * @param i function object index |
MikamiUitOpen | 16:cbb726ac20d8 | 122 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 123 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 124 | * The function object at position 'i' in the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 125 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 126 | pFunctionPointer_t get(int i) const; |
MikamiUitOpen | 16:cbb726ac20d8 | 127 | |
MikamiUitOpen | 16:cbb726ac20d8 | 128 | /** Look for a function object in the call chain |
MikamiUitOpen | 16:cbb726ac20d8 | 129 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 130 | * @param f the function object to search |
MikamiUitOpen | 16:cbb726ac20d8 | 131 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 132 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 133 | * The index of the function object if found, -1 otherwise. |
MikamiUitOpen | 16:cbb726ac20d8 | 134 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 135 | int find(pFunctionPointer_t f) const; |
MikamiUitOpen | 16:cbb726ac20d8 | 136 | |
MikamiUitOpen | 16:cbb726ac20d8 | 137 | /** Clear the call chain (remove all functions in the chain). |
MikamiUitOpen | 16:cbb726ac20d8 | 138 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 139 | void clear(); |
MikamiUitOpen | 16:cbb726ac20d8 | 140 | |
MikamiUitOpen | 16:cbb726ac20d8 | 141 | /** Remove a function object from the chain |
MikamiUitOpen | 16:cbb726ac20d8 | 142 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 143 | * @arg f the function object to remove |
MikamiUitOpen | 16:cbb726ac20d8 | 144 | * |
MikamiUitOpen | 16:cbb726ac20d8 | 145 | * @returns |
MikamiUitOpen | 16:cbb726ac20d8 | 146 | * true if the function object was found and removed, false otherwise. |
MikamiUitOpen | 16:cbb726ac20d8 | 147 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 148 | bool remove(pFunctionPointer_t f); |
MikamiUitOpen | 16:cbb726ac20d8 | 149 | |
MikamiUitOpen | 16:cbb726ac20d8 | 150 | /** Call all the functions in the chain in sequence |
MikamiUitOpen | 16:cbb726ac20d8 | 151 | */ |
MikamiUitOpen | 16:cbb726ac20d8 | 152 | void call(); |
MikamiUitOpen | 16:cbb726ac20d8 | 153 | |
MikamiUitOpen | 16:cbb726ac20d8 | 154 | #ifdef MBED_OPERATORS |
MikamiUitOpen | 16:cbb726ac20d8 | 155 | void operator ()(void) { |
MikamiUitOpen | 16:cbb726ac20d8 | 156 | call(); |
MikamiUitOpen | 16:cbb726ac20d8 | 157 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 158 | pFunctionPointer_t operator [](int i) const { |
MikamiUitOpen | 16:cbb726ac20d8 | 159 | return get(i); |
MikamiUitOpen | 16:cbb726ac20d8 | 160 | } |
MikamiUitOpen | 16:cbb726ac20d8 | 161 | #endif |
MikamiUitOpen | 16:cbb726ac20d8 | 162 | |
MikamiUitOpen | 16:cbb726ac20d8 | 163 | private: |
MikamiUitOpen | 16:cbb726ac20d8 | 164 | void _check_size(); |
MikamiUitOpen | 16:cbb726ac20d8 | 165 | pFunctionPointer_t common_add(pFunctionPointer_t pf); |
MikamiUitOpen | 16:cbb726ac20d8 | 166 | pFunctionPointer_t common_add_front(pFunctionPointer_t pf); |
MikamiUitOpen | 16:cbb726ac20d8 | 167 | |
MikamiUitOpen | 16:cbb726ac20d8 | 168 | pFunctionPointer_t* _chain; |
MikamiUitOpen | 16:cbb726ac20d8 | 169 | int _size; |
MikamiUitOpen | 16:cbb726ac20d8 | 170 | int _elements; |
MikamiUitOpen | 16:cbb726ac20d8 | 171 | |
MikamiUitOpen | 16:cbb726ac20d8 | 172 | /* disallow copy constructor and assignment operators */ |
MikamiUitOpen | 16:cbb726ac20d8 | 173 | private: |
MikamiUitOpen | 16:cbb726ac20d8 | 174 | CallChain(const CallChain&); |
MikamiUitOpen | 16:cbb726ac20d8 | 175 | CallChain & operator = (const CallChain&); |
MikamiUitOpen | 16:cbb726ac20d8 | 176 | }; |
MikamiUitOpen | 16:cbb726ac20d8 | 177 | |
MikamiUitOpen | 16:cbb726ac20d8 | 178 | } // namespace mbed |
MikamiUitOpen | 16:cbb726ac20d8 | 179 | |
MikamiUitOpen | 16:cbb726ac20d8 | 180 | #endif |
MikamiUitOpen | 16:cbb726ac20d8 | 181 |