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

Committer:
MikamiUitOpen
Date:
Sun Oct 02 06:33:59 2016 +0000
Revision:
16:cbb726ac20d8
17

Who changed what in which revision?

UserRevisionLine numberNew 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 #include "FileSystemLike.h"
MikamiUitOpen 16:cbb726ac20d8 17
MikamiUitOpen 16:cbb726ac20d8 18 namespace mbed {
MikamiUitOpen 16:cbb726ac20d8 19
MikamiUitOpen 16:cbb726ac20d8 20 class BaseDirHandle : public DirHandle {
MikamiUitOpen 16:cbb726ac20d8 21 public:
MikamiUitOpen 16:cbb726ac20d8 22 /*
MikamiUitOpen 16:cbb726ac20d8 23 We keep track of our current location as the n'th object in the
MikamiUitOpen 16:cbb726ac20d8 24 FileSystemLike list. Using a Base* instead would cause problems if that
MikamiUitOpen 16:cbb726ac20d8 25 object were to be destroyed between readdirs.
MikamiUitOpen 16:cbb726ac20d8 26 Using this method does mean though that destroying/creating objects can
MikamiUitOpen 16:cbb726ac20d8 27 give unusual results from readdir.
MikamiUitOpen 16:cbb726ac20d8 28 */
MikamiUitOpen 16:cbb726ac20d8 29 off_t n;
MikamiUitOpen 16:cbb726ac20d8 30 struct dirent cur_entry;
MikamiUitOpen 16:cbb726ac20d8 31
MikamiUitOpen 16:cbb726ac20d8 32 BaseDirHandle() : n(0), cur_entry() {
MikamiUitOpen 16:cbb726ac20d8 33 }
MikamiUitOpen 16:cbb726ac20d8 34
MikamiUitOpen 16:cbb726ac20d8 35 virtual int closedir() {
MikamiUitOpen 16:cbb726ac20d8 36 delete this;
MikamiUitOpen 16:cbb726ac20d8 37 return 0;
MikamiUitOpen 16:cbb726ac20d8 38 }
MikamiUitOpen 16:cbb726ac20d8 39
MikamiUitOpen 16:cbb726ac20d8 40 virtual struct dirent *readdir() {
MikamiUitOpen 16:cbb726ac20d8 41 FileBase *ptr = FileBase::get(n);
MikamiUitOpen 16:cbb726ac20d8 42 if (ptr == NULL) return NULL;
MikamiUitOpen 16:cbb726ac20d8 43
MikamiUitOpen 16:cbb726ac20d8 44 /* Increment n, so next readdir gets the next item */
MikamiUitOpen 16:cbb726ac20d8 45 n++;
MikamiUitOpen 16:cbb726ac20d8 46
MikamiUitOpen 16:cbb726ac20d8 47 /* Setup cur entry and return a pointer to it */
MikamiUitOpen 16:cbb726ac20d8 48 std::strncpy(cur_entry.d_name, ptr->getName(), NAME_MAX);
MikamiUitOpen 16:cbb726ac20d8 49 return &cur_entry;
MikamiUitOpen 16:cbb726ac20d8 50 }
MikamiUitOpen 16:cbb726ac20d8 51
MikamiUitOpen 16:cbb726ac20d8 52 virtual off_t telldir() {
MikamiUitOpen 16:cbb726ac20d8 53 return n;
MikamiUitOpen 16:cbb726ac20d8 54 }
MikamiUitOpen 16:cbb726ac20d8 55
MikamiUitOpen 16:cbb726ac20d8 56 virtual void seekdir(off_t offset) {
MikamiUitOpen 16:cbb726ac20d8 57 n = offset;
MikamiUitOpen 16:cbb726ac20d8 58 }
MikamiUitOpen 16:cbb726ac20d8 59
MikamiUitOpen 16:cbb726ac20d8 60 virtual void rewinddir() {
MikamiUitOpen 16:cbb726ac20d8 61 n = 0;
MikamiUitOpen 16:cbb726ac20d8 62 }
MikamiUitOpen 16:cbb726ac20d8 63 };
MikamiUitOpen 16:cbb726ac20d8 64
MikamiUitOpen 16:cbb726ac20d8 65 FileSystemLike::FileSystemLike(const char *name) : FileBase(name, FileSystemPathType) {
MikamiUitOpen 16:cbb726ac20d8 66
MikamiUitOpen 16:cbb726ac20d8 67 }
MikamiUitOpen 16:cbb726ac20d8 68
MikamiUitOpen 16:cbb726ac20d8 69 FileSystemLike::~FileSystemLike() {
MikamiUitOpen 16:cbb726ac20d8 70
MikamiUitOpen 16:cbb726ac20d8 71 }
MikamiUitOpen 16:cbb726ac20d8 72
MikamiUitOpen 16:cbb726ac20d8 73 DirHandle *FileSystemLike::opendir() {
MikamiUitOpen 16:cbb726ac20d8 74 return new BaseDirHandle();
MikamiUitOpen 16:cbb726ac20d8 75 }
MikamiUitOpen 16:cbb726ac20d8 76
MikamiUitOpen 16:cbb726ac20d8 77 } // namespace mbed