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 #ifndef MBED_LOCALFILESYSTEM_H
MikamiUitOpen 16:cbb726ac20d8 17 #define MBED_LOCALFILESYSTEM_H
MikamiUitOpen 16:cbb726ac20d8 18
MikamiUitOpen 16:cbb726ac20d8 19 #include "platform.h"
MikamiUitOpen 16:cbb726ac20d8 20
MikamiUitOpen 16:cbb726ac20d8 21 #if DEVICE_LOCALFILESYSTEM
MikamiUitOpen 16:cbb726ac20d8 22
MikamiUitOpen 16:cbb726ac20d8 23 #include "FileSystemLike.h"
MikamiUitOpen 16:cbb726ac20d8 24
MikamiUitOpen 16:cbb726ac20d8 25 namespace mbed {
MikamiUitOpen 16:cbb726ac20d8 26
MikamiUitOpen 16:cbb726ac20d8 27 FILEHANDLE local_file_open(const char* name, int flags);
MikamiUitOpen 16:cbb726ac20d8 28
MikamiUitOpen 16:cbb726ac20d8 29 class LocalFileHandle : public FileHandle {
MikamiUitOpen 16:cbb726ac20d8 30
MikamiUitOpen 16:cbb726ac20d8 31 public:
MikamiUitOpen 16:cbb726ac20d8 32 LocalFileHandle(FILEHANDLE fh);
MikamiUitOpen 16:cbb726ac20d8 33
MikamiUitOpen 16:cbb726ac20d8 34 virtual int close();
MikamiUitOpen 16:cbb726ac20d8 35
MikamiUitOpen 16:cbb726ac20d8 36 virtual ssize_t write(const void *buffer, size_t length);
MikamiUitOpen 16:cbb726ac20d8 37
MikamiUitOpen 16:cbb726ac20d8 38 virtual ssize_t read(void *buffer, size_t length);
MikamiUitOpen 16:cbb726ac20d8 39
MikamiUitOpen 16:cbb726ac20d8 40 virtual int isatty();
MikamiUitOpen 16:cbb726ac20d8 41
MikamiUitOpen 16:cbb726ac20d8 42 virtual off_t lseek(off_t position, int whence);
MikamiUitOpen 16:cbb726ac20d8 43
MikamiUitOpen 16:cbb726ac20d8 44 virtual int fsync();
MikamiUitOpen 16:cbb726ac20d8 45
MikamiUitOpen 16:cbb726ac20d8 46 virtual off_t flen();
MikamiUitOpen 16:cbb726ac20d8 47
MikamiUitOpen 16:cbb726ac20d8 48 protected:
MikamiUitOpen 16:cbb726ac20d8 49 FILEHANDLE _fh;
MikamiUitOpen 16:cbb726ac20d8 50 int pos;
MikamiUitOpen 16:cbb726ac20d8 51 };
MikamiUitOpen 16:cbb726ac20d8 52
MikamiUitOpen 16:cbb726ac20d8 53 /** A filesystem for accessing the local mbed Microcontroller USB disk drive
MikamiUitOpen 16:cbb726ac20d8 54 *
MikamiUitOpen 16:cbb726ac20d8 55 * This allows programs to read and write files on the same disk drive that is used to program the
MikamiUitOpen 16:cbb726ac20d8 56 * mbed Microcontroller. Once created, the standard C file access functions are used to open,
MikamiUitOpen 16:cbb726ac20d8 57 * read and write files.
MikamiUitOpen 16:cbb726ac20d8 58 *
MikamiUitOpen 16:cbb726ac20d8 59 * Example:
MikamiUitOpen 16:cbb726ac20d8 60 * @code
MikamiUitOpen 16:cbb726ac20d8 61 * #include "mbed.h"
MikamiUitOpen 16:cbb726ac20d8 62 *
MikamiUitOpen 16:cbb726ac20d8 63 * LocalFileSystem local("local"); // Create the local filesystem under the name "local"
MikamiUitOpen 16:cbb726ac20d8 64 *
MikamiUitOpen 16:cbb726ac20d8 65 * int main() {
MikamiUitOpen 16:cbb726ac20d8 66 * FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
MikamiUitOpen 16:cbb726ac20d8 67 * fprintf(fp, "Hello World!");
MikamiUitOpen 16:cbb726ac20d8 68 * fclose(fp);
MikamiUitOpen 16:cbb726ac20d8 69 * remove("/local/out.txt"); // Removes the file "out.txt" from the local file system
MikamiUitOpen 16:cbb726ac20d8 70 *
MikamiUitOpen 16:cbb726ac20d8 71 * DIR *d = opendir("/local"); // Opens the root directory of the local file system
MikamiUitOpen 16:cbb726ac20d8 72 * struct dirent *p;
MikamiUitOpen 16:cbb726ac20d8 73 * while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
MikamiUitOpen 16:cbb726ac20d8 74 * printf("%s\n", p->d_name); // to stdout.
MikamiUitOpen 16:cbb726ac20d8 75 * }
MikamiUitOpen 16:cbb726ac20d8 76 * closedir(d);
MikamiUitOpen 16:cbb726ac20d8 77 * }
MikamiUitOpen 16:cbb726ac20d8 78 * @endcode
MikamiUitOpen 16:cbb726ac20d8 79 *
MikamiUitOpen 16:cbb726ac20d8 80 * @note
MikamiUitOpen 16:cbb726ac20d8 81 * If the microcontroller program makes an access to the local drive, it will be marked as "removed"
MikamiUitOpen 16:cbb726ac20d8 82 * on the Host computer. This means it is no longer accessible from the Host Computer.
MikamiUitOpen 16:cbb726ac20d8 83 *
MikamiUitOpen 16:cbb726ac20d8 84 * The drive will only re-appear when the microcontroller program exists. Note that if the program does
MikamiUitOpen 16:cbb726ac20d8 85 * not exit, you will need to hold down reset on the mbed Microcontroller to be able to see the drive again!
MikamiUitOpen 16:cbb726ac20d8 86 */
MikamiUitOpen 16:cbb726ac20d8 87 class LocalFileSystem : public FileSystemLike {
MikamiUitOpen 16:cbb726ac20d8 88
MikamiUitOpen 16:cbb726ac20d8 89 public:
MikamiUitOpen 16:cbb726ac20d8 90 LocalFileSystem(const char* n) : FileSystemLike(n) {
MikamiUitOpen 16:cbb726ac20d8 91
MikamiUitOpen 16:cbb726ac20d8 92 }
MikamiUitOpen 16:cbb726ac20d8 93
MikamiUitOpen 16:cbb726ac20d8 94 virtual FileHandle *open(const char* name, int flags);
MikamiUitOpen 16:cbb726ac20d8 95 virtual int remove(const char *filename);
MikamiUitOpen 16:cbb726ac20d8 96 virtual DirHandle *opendir(const char *name);
MikamiUitOpen 16:cbb726ac20d8 97 };
MikamiUitOpen 16:cbb726ac20d8 98
MikamiUitOpen 16:cbb726ac20d8 99 } // namespace mbed
MikamiUitOpen 16:cbb726ac20d8 100
MikamiUitOpen 16:cbb726ac20d8 101 #endif
MikamiUitOpen 16:cbb726ac20d8 102
MikamiUitOpen 16:cbb726ac20d8 103 #endif