Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem_Warning_Fixed
SD_PlayerSkeleton.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-11-15
- Revision:
- 7:930d50953ec2
- Parent:
- 6:6fe2b62f259d
- Child:
- 8:59d3f9c81c4f
File content as of revision 7:930d50953ec2:
//--------------------------------------------------------------
// SD プレーヤー用抽象基底クラス(ヘッダ)
//
// 2016/11/15, Copyright (c) 2016 MIKAMI, Naoki
//--------------------------------------------------------------
#ifndef F746_SD_PLAYER_SKELETON_HPP
#define F746_SD_PLAYER_SKELETON_HPP
#include "SAI_InOut.hpp"
#include "F746_GUI.hpp"
#include "FileSelectorWav.hpp"
#include "SD_WavReader.hpp"
using namespace Mikami;
namespace Mikami
{
class SD_PlayerSkeleton
{
public:
// リセット・ボタンを使う場合は resetButton を true とする
SD_PlayerSkeleton(string str, int fs, bool resetButton = false);
virtual ~SD_PlayerSkeleton() { if (reset_ != NULL) delete reset_; }
// SD プレーヤーの処理の実行
void Execute();
protected:
// ボタン用の定数
static const uint16_t BG_LEFT_ = 414;
static const uint16_t BG_WIDTH_ = 66;
static const uint16_t BG_HEIGHT_ = 36;
const int32_t FRAME_SIZE_; // フレームバッファのサイズ
Array<int16_t> sn_; // フレームバッファ
SaiIO mySai_;
SD_WavReader sdReader_; // SD カード読み込み用オブジェクト
// 選択されたファイル名を取得
string GetFileName() { return fileName_; }
// 選択されたファイル名から拡張子を除いたものを取得
string GetFileNameNoExt();
private:
string fileName_; // 選択されたファイル名
Label title_; // 上部に表示されるタイトル
FileSelector selector_;
ButtonGroup menu_;
ResetButton *reset_; // リセットボタン用オブジェクトのポインタ
// SD カードのファイルのオープン
int32_t SD_Open();
// ファイルの選択
void SelectFile();
// パネルが操作された場合の処理
void DoIfHandled();
// メニュ-のボタンがタッチされるまで DoIfHandled() を実行しながら待つ
void WaitTouched(int num)
{ while (!menu_.Touched(num)) DoIfHandled(); }
int WaitTouched();
// コピー・コンストラクタとオブジェクトの代入演算子は使用禁止
SD_PlayerSkeleton(const SD_PlayerSkeleton&);
SD_PlayerSkeleton& operator=(const SD_PlayerSkeleton&);
//-------------------------------------
// 以下は仮想関数
//-------------------------------------
// 1フレーム分の信号処理
virtual void SignalProcessing() = 0;
// 信号処理のパラメータ変更など
virtual void Modefy() {}
// 曲の再生時の表示
virtual void Display() {}
// 信号処理で必要になるクリア処理
virtual void Clear() {}
};
}
#endif // F746_SD_PLAYER_SKELETON_HPP