diff --git a/ECTrainer2/ECTrainerGUI.cpp b/ECTrainer2/ECTrainerGUI.cpp index 15ded95..b1a6c0b 100644 --- a/ECTrainer2/ECTrainerGUI.cpp +++ b/ECTrainer2/ECTrainerGUI.cpp @@ -174,7 +174,7 @@ case '7': PlaySound(_T("../voices/Great_L.wav"), NULL, SND_FILENAME | SND_ASYNC); break; case '8': PlaySound(_T("../voices/Excellent_L.wav"), NULL, SND_FILENAME | SND_ASYNC); break; } - if (key == KEY_ESC) { + if (key == KEY_ESC || cv::getWindowProperty(WIN_MAIN, 0) < 0) { ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::SOFTWARE_END); } @@ -184,10 +184,10 @@ // �C�x���g���[�v�iGUI�̓��C���X���b�h�̂��߃��b�Z�[�W�������Ȃ�) bool ECTrainerGUI::MainLoop() { - while (_AppRunning && cv::getWindowProperty(WIN_MAIN, 0) >= 0) { + while (_AppRunning) { this->Routine(); } - _pEct->StopApp(); + //_pEct->StopApp(); return true; } diff --git a/ECTrainer2/Stimulus.cpp b/ECTrainer2/Stimulus.cpp index 2b52b0e..3610f30 100644 --- a/ECTrainer2/Stimulus.cpp +++ b/ECTrainer2/Stimulus.cpp @@ -49,16 +49,7 @@ double eTime = _StimTimer.Elapse(); // �h���؂�ւ��^�C���L�[�p�[ if (eTime / 1000. > (double)_StimInfoSet[_StimNo].dulation) { - if (_StimInfoSet[_StimNo].type == 2) { - _Movie.Put(L"STOP"); - mwut::DebugPrintf(L"movie put stop.\n"); - } - if (_StimNo + 1 < (int)_StimInfoSet.size()) { - SetStimulus(_StimNo + 1); - ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::EXP_NEXT); - } else { - ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::EXP_END); - } + this->MoveNext(); } // �����ǂݍ��� @@ -75,6 +66,23 @@ return true; } +// ���̎h���ֈړ� +bool Stimulus::MoveNext() { + if (_StimNo < 0) return false; + + if (_StimInfoSet[_StimNo].type == 2) { + _Movie.Put(L"STOP"); + mwut::DebugPrintf(L"movie put stop.\n"); + } + if (_StimNo + 1 < (int)_StimInfoSet.size()) { + SetStimulus(_StimNo + 1); + ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::EXP_NEXT); + } else { + ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::EXP_END); + } + return true; +} + // �C�x���g���� bool Stimulus::EventProc(MSG& msg) { switch (msg.message) { @@ -99,6 +107,10 @@ _StimNo = -1; _Display.Put(cv::imread(OPENING_FILE)); break; + + case (int)ECTMSG::MOVIE_END: // ����Đ��������ɓ��B + this->MoveNext(); + break; } return true; } diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index abbb624..cdd7529 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -48,6 +48,8 @@ bool Routine(); // �C�x���g���� bool EventProc(MSG& msg); + // ���̎h���ֈړ� + bool MoveNext(); // �摜�Ƀ}�[�J�[��`�� //void StimWithMarker(); diff --git a/ECTrainer2/Worker.cpp b/ECTrainer2/Worker.cpp index 84bb38f..237a49c 100644 --- a/ECTrainer2/Worker.cpp +++ b/ECTrainer2/Worker.cpp @@ -199,6 +199,7 @@ case (int)ECTMSG::MOVIE_END: // ����Đ��I�� this->EventLog(_T("Movie End")); + ((BaseProcess*)_pEct->PStimulus())->Tell(ECTMSG::MOVIE_END); break; case (int)ECTMSG::MOVIE_ERROR: // ����G���[