Library for Skeleton of SD card player. SD カードプレーヤのための骨組みとして使うためのライブラリ.このライブラリを登録した際のプログラム:「F746_SD_Player_Demo」
Dependencies: SDFileSystem_Warning_Fixed
Dependents: F746_SD_Player_Demo F746_SD_VarableFilter F746_SD_GraphicEqualizer F746_MySoundMachine ... more
Diff: SD_PlayerSkeleton.cpp
- Revision:
- 8:59d3f9c81c4f
- Parent:
- 7:930d50953ec2
- Child:
- 9:1ba92e340dce
--- a/SD_PlayerSkeleton.cpp Tue Nov 15 13:28:02 2016 +0000 +++ b/SD_PlayerSkeleton.cpp Wed Nov 16 13:38:39 2016 +0000 @@ -1,7 +1,7 @@ //-------------------------------------------------------------- // SD プレーヤー用抽象基底クラス // -// 2016/11/15, Copyright (c) 2016 MIKAMI, Naoki +// 2016/11/16, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------- #include "SD_PlayerSkeleton.hpp" @@ -12,6 +12,7 @@ : FRAME_SIZE_(2048), sn_(FRAME_SIZE_), mySai_(SaiIO::OUTPUT, FRAME_SIZE_, fs), sdReader_(FRAME_SIZE_), + fileName_(""), title_(214, 4, str, Label::CENTER, Font16), selector_(0, 22, 256, 37, sdReader_), menu_(BG_LEFT_, 2, BG_WIDTH_, BG_HEIGHT_, 5, @@ -34,25 +35,17 @@ int32_t loopCount; WaitTouched(0); // OPEN がタッチされるまで待つ - SelectFile(); - bool whileFirst = true; while (true) { - if (!playAfterPause) // PAUSE 後の PLAY ではない場合 + if (playAfterPause) // PAUSE 後の PLAY の場合 + loopCount = SD_Open(); + else // PAUSE 後の PLAY ではない場合 { - if (!whileFirst) // while ループで初回の処理ではない場合 - { - menu_.Activate(1); // PLAY ボタン有効 - if (WaitTouched() == 0) SelectFile(); - } - - whileFirst = false; + if (WaitTouched() == 0) SelectFile(); loopCount = SD_Open(); WaitTouched(1); // PLAY がタッチされるまで待つ } - else // PAUSE 後の PLAY の場合 - loopCount = SD_Open(); selector_.Erase(0, 0, BG_LEFT_-4, 272); title_.Draw(); @@ -88,8 +81,8 @@ { case 1: playAfterPause = true; // 最初から PLAY break; - case 3: mySai_.ResumeOut(); // PAUSE したところから - menu_.Activate(2); // PLAY 再開 + case 3: mySai_.ResumeOut(); // PAUSE 箇所から PLAY 再開 + menu_.Activate(2); menu_.Inactivate(3); menu_.TouchedColor(1); break; @@ -104,10 +97,9 @@ SignalProcessing(); } mySai_.StopOut(); - menu_.Activate(0); // OPEN ボタン有効 - if (!playAfterPause) - menu_.Activate(1); // PLAY ボタン有効 - for (int n=2; n<5; n++) // その他のボタンは無効 + menu_.Activate(0); // OPEN ボタン有効 + menu_.Draw(1); // PLAY ボタンの色を初期状態にする + for (int n=2; n<5; n++) // その他のボタンは無効 menu_.Inactivate(n); sdReader_.Close(); // SD のファイルのクローズ @@ -128,13 +120,13 @@ // SD カードのファイルのオープン int32_t SD_PlayerSkeleton::SD_Open() { + if (fileName_.empty()) SelectFile(); sdReader_.Open(fileName_); sdReader_.IsWavFile(); return sdReader_.GetSize()/FRAME_SIZE_; } // ファイルの選択 - // selectedName: 選択されたファイル名 void SD_PlayerSkeleton::SelectFile() { selector_.DisplayFileList(); @@ -153,7 +145,7 @@ Modefy(); // アプリ固有のパラメータ変更(仮想関数) } - // メニュ-のボタンがタッチされるまで DoIfHandled() を実行しながら待つ + // メニューのボタンがタッチされるまで DoIfHandled() を実行しながら待つ int SD_PlayerSkeleton::WaitTouched() { int touchNum;