diff --git a/ECTrainer2/ECTrainerGUI.cpp b/ECTrainer2/ECTrainerGUI.cpp index ef69d31..79751b8 100644 --- a/ECTrainer2/ECTrainerGUI.cpp +++ b/ECTrainer2/ECTrainerGUI.cpp @@ -120,6 +120,9 @@ cvui::beginRow(); cvui::printf("Stage "); cvui::counter(Ect()->PWorker()->StartStagePtr()); + if (*Ect()->PWorker()->StartStagePtr() < 0) *Ect()->PWorker()->StartStagePtr() = 0; + if (*Ect()->PWorker()->StartStagePtr() > Ect()->PStimulus()->GetStageMax()) + *Ect()->PWorker()->StartStagePtr() = Ect()->PStimulus()->GetStageMax(); cvui::endRow(); break; case APP_STATUS::STIM: diff --git a/ECTrainer2/Stimulus.cpp b/ECTrainer2/Stimulus.cpp index 0dd9a89..6e60768 100644 --- a/ECTrainer2/Stimulus.cpp +++ b/ECTrainer2/Stimulus.cpp @@ -35,6 +35,7 @@ // テーブルから構造体へ格納 _TotalExpTime = 0; _StimInfoSet.clear(); + _StageMax = 0; for (int r = 0; r < table.size(); r++) { if (table[r].size() != 6 || atoi(table[r][0].c_str()) < 1) continue; StimInfo st; @@ -46,6 +47,7 @@ st.csvfile = table[r][3]; st.smallmovie = table[r][4]; st.stage = atoi(table[r][5].c_str()); + if (st.stage > _StageMax) _StageMax = st.stage; if (st.filepath.size() > 0) { _StimInfoSet.push_back(st); _TotalExpTime += st.dulation; diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index 3f8d3a6..a0511ff 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -48,6 +48,7 @@ cv::VideoCapture _cap; // 動画オブジェクト float _TotalExpTime; // 合計実験時間 int _Stage; // 刺激ステージ + int _StageMax; // 刺激ステージ最大値 // ECTrainerインスタンス取得 ECTrainer* Ect() { return (ECTrainer*)_pUserdata; } @@ -101,4 +102,6 @@ bool IsSoftCalib() { return _StimNo < 0 ? false : _StimInfoSet[_StimNo].type == StimInfo::TYPE_CALIB; } // ステージ取得 int GetStage() { return _Stage; } + // 最大ステージ取得 + int GetStageMax() { return _StageMax; } };