diff --git a/ECTrainer2/ECTrainer.h b/ECTrainer2/ECTrainer.h index b40426b..93c0092 100644 --- a/ECTrainer2/ECTrainer.h +++ b/ECTrainer2/ECTrainer.h @@ -5,9 +5,9 @@ #include //#define TOBII_ADDR "192.168.71.50" -#define TOBII_ADDR "192.168.23.155" -//#define EYEDEVICE_GLASS2 -#define EYEDEVICE_NONE +#define TOBII_ADDR "192.168.23.156" +#define EYEDEVICE_GLASS2 +//#define EYEDEVICE_NONE class BaseProcess; class ECTrainerGUI; diff --git a/ECTrainer2/ECTrainer2.vcxproj b/ECTrainer2/ECTrainer2.vcxproj index e0b80be..3619b6b 100644 --- a/ECTrainer2/ECTrainer2.vcxproj +++ b/ECTrainer2/ECTrainer2.vcxproj @@ -139,7 +139,7 @@ Windows true true - true + false diff --git a/ECTrainer2/Worker.cpp b/ECTrainer2/Worker.cpp index 667b49c..97b7d39 100644 --- a/ECTrainer2/Worker.cpp +++ b/ECTrainer2/Worker.cpp @@ -17,18 +17,15 @@ , _TargetImage() , _FullScreenImage() , _FBLevel(1) - , _IsInside(false) { _pExpTimer = new mwut::HPTimer(); _pContactTimer = new mwut::HPTimer(); - _pNohitTimer = new mwut::HPTimer(); } // �f�X�g���N�^ Worker::~Worker() { mwut::SafeDelete((void**)&_pExpTimer); mwut::SafeDelete((void**)&_pContactTimer); - mwut::SafeDelete((void**)&_pNohitTimer); } // ������ @@ -64,6 +61,7 @@ int hit = -1; double dtMin = 0; int fb = 0; + double frameInterval = _pContactTimer->Interval(); std::vector elems = _pEct->PStimulus()->GetMovieObject(); if (stimNo >= 0) { cv::Mat stimImg = _StimImage.clone(); @@ -88,22 +86,12 @@ cv::circle(stimImg, gazeI * scale, (int)(20 * scale), CV_RGB(0, 0, 255), 3); if (hit >= 0) { - _pNohitTimer->Reset(); - if (!_IsInside) { // �����������Ă����u�� - _IsInside = true; - _pContactTimer->Reset(); - } else { - if (_pContactTimer->Elapse() >= (double)(FEEDBACK_TIME * _FBLevel)) { - this->PostMsg((ECTMSG)((int)ECTMSG::FB_OK + _FBLevel - 1)); - fb = _FBLevel++; - if (_FBLevel > 5) this->ResetParams(); // �ŏIFB��Ƀ��Z�b�g - } - } - } else { - if (_IsInside && _pNohitTimer->Elapse() >= (double)NOHIT_TIME) { - if (_FBLevel > 1) PostMsg(ECTMSG::FB_GOOUT); - this->ResetParams(); // �����O�ꂪ��莞�Ԍo�߂���ƃ��Z�b�g - fb = -1; + _ContactTime += frameInterval; + + if (_ContactTime >= (double)(FEEDBACK_TIME * _FBLevel)) { + this->PostMsg((ECTMSG)((int)ECTMSG::FB_OK + _FBLevel - 1)); + fb = _FBLevel++; + if (_FBLevel > 5) this->ResetParams(); // �ŏIFB��Ƀ��Z�b�g } } } @@ -119,7 +107,7 @@ _ftprintf(_fpLogData, _T(",%.1f,%.1f"), gazeV.x, gazeV.y); // �����_�i����J�������W�j _ftprintf(_fpLogData, _T(",%.1f,%.1f"), gazeI.x, gazeI.y); // �����_�i�摜���W�j _ftprintf(_fpLogData, _T(",%d"), hit + 1); // �^�[�Q�b�g���� - _ftprintf(_fpLogData, _T(",%.2f"), hit < 0 ? -1 : _pContactTimer->Elapse() / 1000.); // �ڕW�R���^�N�g���� + _ftprintf(_fpLogData, _T(",%.2f"), _ContactTime / 1000.); // �ڕW�R���^�N�g���� _ftprintf(_fpLogData, _T(",%d"), fb); // �t�B�[�h�o�b�N _ftprintf(_fpLogData, _T(",%d"), _pEct->PBitalMonitor()->GetRR()); // �o�C�^���o��(RR�Ԋu�j // �z���O���t�B�s��o�� @@ -140,8 +128,7 @@ void Worker::ResetParams() { _pContactTimer->Reset(); _FBLevel = 1; - _pNohitTimer->Reset(); - _IsInside = false; + _ContactTime = 0; } // �C�x���g���� @@ -212,7 +199,7 @@ this->ResetParams(); break; - case (int)ECTMSG::SYSTEM_ERROR: // ���̎h���Ɉړ� + case (int)ECTMSG::SYSTEM_ERROR: // �V�X�e���G���[ this->EventLog(_T("System Error")); _AppStatus = APP_STATUS::IDLE; ((BaseProcess*)_pEct->PStimulus())->PostMsg(ECTMSG::SYSTEM_ERROR); diff --git a/ECTrainer2/Worker.h b/ECTrainer2/Worker.h index 29083ba..0d8743c 100644 --- a/ECTrainer2/Worker.h +++ b/ECTrainer2/Worker.h @@ -30,17 +30,19 @@ const TCHAR* DATA_LOG_FILE = _T("LogData"); const TCHAR* EVENT_LOG_FILE = _T("LogEvent.txt"); const int FEEDBACK_TIME = 3000; // �t�B�[�h�o�b�N�̎��ԁi1���x���jmsec - const int NOHIT_TIME = 100; // �������O�ꂽ�Ɣ��肷�鎞�� msec + //const int NOHIT_TIME = 100; // �������O�ꂽ�Ɣ��肷�鎞�� msec APP_STATUS _AppStatus; // �A�v���P�[�V������� FILE* _fpLogData; // �f�[�^���O�t�@�C���|�C���^ - mwut::HPTimer* _pExpTimer; // �����o�ߎ��� - mwut::HPTimer* _pContactTimer; // �ڕW�R���^�N�g���� - mwut::HPTimer* _pNohitTimer; // �����O�ꎞ�� + mwut::HPTimer* _pExpTimer; // �����o�߃^�C�}�[ + mwut::HPTimer* _pContactTimer; // �ڕW�R���^�N�g�^�C�}�[ + //mwut::HPTimer* _pNohitTimer; // �����O�ꎞ�� + double _ContactTime; // �R���^�N�g�ݐώ��� RingBuffer _TargetImage; // �^�[�Q�b�g�摜 cv::Mat _StimImage; // �h���摜 RingBuffer _FullScreenImage; // �S��ʗp�摜 int _FBLevel; // �t�B�[�h�o�b�N���x�� 1�`5 - bool _IsInside; // �������^�[�Q�b�g�ɂ��邩 + //bool _IsInside; // �������^�[�Q�b�g�ɂ��邩 + // ��{���� bool Routine(); // �C�x���g���� @@ -71,4 +73,6 @@ cv::Mat GetFullScreenImg() { return _FullScreenImage.Get(); } // �C�x���g���O�o�� void EventLog(const TCHAR* msg); + // �R���^�N�g�ݐώ��Ԃ��擾 + double GetContactTime() { return _ContactTime; } }; diff --git a/ECTrainer2/myWinUtils.cpp b/ECTrainer2/myWinUtils.cpp index 038c70e..0bd6218 100644 --- a/ECTrainer2/myWinUtils.cpp +++ b/ECTrainer2/myWinUtils.cpp @@ -128,6 +128,7 @@ HPTimer::HPTimer() { QueryPerformanceFrequency(&_nFreq); QueryPerformanceCounter(&_nBegin); + _nLast = _nBegin; } // �o�ߎ��ԎZ�o