Output the audio signal (*.bin) with filtering by IIR filter in the SD card using onboard CODEC. For *.wav file, F746_SD_WavPlayer and F746_SD_GraphicEqualiser are published on mbed. SD カードのオーディオ信号 (*.bin) を遮断周波数可変の IIR フィルタを通して,ボードに搭載されているCODEC で出力する.*.wav 形式のファイル用には,F746_SD_WavPlayer と F746_SD_GraphicEqualiser を mbed で公開している.
Dependencies: BSP_DISCO_F746NG_patch_fixed F746_GUI LCD_DISCO_F746NG SDFileSystem_Warning_Fixed TS_DISCO_F746NG mbed
Revision 1:e891c9b4f980, committed 2016-04-10
- Comitter:
- MikamiUitOpen
- Date:
- Sun Apr 10 04:40:01 2016 +0000
- Parent:
- 0:6748e3332e85
- Child:
- 2:f963cb0d323f
- Commit message:
- 2
Changed in this revision
MyClasses_Functions/FileSelector.hpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MyClasses_Functions/FileSelector.hpp Fri Apr 08 13:11:53 2016 +0000 +++ b/MyClasses_Functions/FileSelector.hpp Sun Apr 10 04:40:01 2016 +0000 @@ -2,7 +2,7 @@ // FileSelector class // SD カード内のファイル名の一覧を表示し,ファイルを選択する // -// 2016/04/05, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/10, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------- #ifndef FILE_SELECTOR_HPP @@ -13,6 +13,8 @@ #include "ButtonGroup.hpp" #include "SD_BinaryReader.hpp" #include "SDFileSystem.h" +#include <algorithm> // sort() で使用 +#include <string> namespace Mikami { @@ -25,6 +27,7 @@ MAX_FILES_(maxFiles), MAX_NAME_LENGTH_(maxNameLength), BASE_COLOR_(0xFF80FFA0), TOUCHED_COLOR_(0xFF80FFFF), fileNames_(new string[maxFiles]), + sortedFileNames_(new string[maxFiles]), lcd_(GuiBase::GetLcdPtr()), sdReader_(reader), prev_(-1) {} @@ -80,11 +83,11 @@ int n; if (rect_->GetTouchedNumber(n)) { - fileNameLabels_[n]->Draw(DeleteBin(n), TOUCHED_COLOR_); + fileNameLabels_[n]->Draw(GetFileNameNoExt(n), TOUCHED_COLOR_); if ((prev_ >= 0) && (prev_ != n)) - fileNameLabels_[prev_]->Draw(DeleteBin(prev_)); + fileNameLabels_[prev_]->Draw(GetFileNameNoExt(prev_)); prev_ = n; - fileName = fileNames_[n]; + fileName = sortedFileNames_[n]; return true; } else @@ -92,12 +95,17 @@ } // ファイルの一覧の表示 - void DisplayFileList() + void DisplayFileList(bool sort = true) { + for (int n=0; n<fileCount_; n++) + sortedFileNames_[n] = fileNames_[n]; + if (sort) + std::sort(sortedFileNames_, sortedFileNames_+fileCount_); + Erase(MAX_NAME_LENGTH_*((sFONT *)(&Font16))->Width, 270-Y_); rect_->DrawAll(); for (int n=0; n<fileCount_; n++) - fileNameLabels_[n]->Draw(DeleteBin(n)); + fileNameLabels_[n]->Draw(GetFileNameNoExt(n)); } void Erase(uint16_t width, uint16_t height, @@ -115,6 +123,7 @@ const uint32_t TOUCHED_COLOR_; string *fileNames_; + string *sortedFileNames_; string *nonString_; ButtonGroup *rect_; Label **fileNameLabels_; @@ -133,10 +142,10 @@ BASE_COLOR_); } - // 拡張子を削除 - string DeleteBin(int n) + // 拡張子を削除した文字列を取得 + string GetFileNameNoExt(int n) { - string name = fileNames_[n]; + string name = sortedFileNames_[n]; name.erase(name.find(".")); return name.substr(0, MAX_NAME_LENGTH_); }
--- a/main.cpp Fri Apr 08 13:11:53 2016 +0000 +++ b/main.cpp Sun Apr 10 04:40:01 2016 +0000 @@ -7,7 +7,7 @@ // 拡張子: "*.bin", "*.BIN" // IIR フィルタ ---- 低域通過および高域通過フィルタ // -// 2016/04/08, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/10, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------- #include "MyFunctions.hpp" @@ -167,3 +167,4 @@ sdReader.Close(); // SD のファイルのクローズ } } +