Beispiel #1
0
        private EdfData TrialNextData(out Constant.EventType returnType, Constant.EventType filterType = Constant.EventType.ANY_TYPE, bool skipSample = false)
        {
            //Constant.EventType type;
            bool    done         = false;
            EdfData ev           = null;
            int     i            = 0;
            uint    trialEndTime = m_CurrentTrial.endtime;

            do
            {
                //console.log("Type: ", type);
                returnType = Edf.GetNextData(m_EdfFile);
                ++i;
                //console.log("Type: ", type);

                if (filterType == Constant.EventType.ANY_TYPE || returnType == filterType || returnType == Constant.EventType.RECORDING_INFO)
                {
                    switch (returnType)
                    {
                    case Constant.EventType.STARTBLINK:
                    case Constant.EventType.STARTSACC:
                    case Constant.EventType.STARTFIX:
                    case Constant.EventType.STARTPARSE:
                    case Constant.EventType.ENDBLINK:
                    case Constant.EventType.ENDSACC:
                    case Constant.EventType.ENDFIX:
                    case Constant.EventType.ENDPARSE:
                    case Constant.EventType.FIXUPDATE:
                    case Constant.EventType.BREAKPARSE:
                    case Constant.EventType.BUTTONEVENT:
                    case Constant.EventType.INPUTEVENT:
                    case Constant.EventType.MESSAGEEVENT:
                    case Constant.EventType.RECORDING_INFO:
                        ev = Edf.GetFloatData(m_EdfFile);

                        if (returnType == Constant.EventType.RECORDING_INFO)
                        {
                            if (filterType == Constant.EventType.ANY_TYPE || returnType == filterType)
                            {
                                done = true;

                                /*
                                 * if(returnType==Constant.EventType.MESSAGEEVENT){
                                 *  Debug.Log((ev as AllfData).fe.message);
                                 * }*/
                            }
                            else
                            {
                                if (ev.time > trialEndTime)
                                {
                                    done = true;
                                    ev   = null;
                                }
                            }
                        }
                        else
                        {
                            /*
                             * if(returnType == Constant.EventType.STARTFIX){
                             *  Debug.Log("Find xxx");
                             * }*/
                            done = true;
                        }



                        break;

                    case Constant.EventType.STARTSAMPLES:
                    case Constant.EventType.STARTEVENTS:
                    case Constant.EventType.ENDSAMPLES:
                    case Constant.EventType.ENDEVENTS:
                        done = true;
                        ev   = Edf.GetFloatData(m_EdfFile);

                        break;

                    case Constant.EventType.SAMPLE_TYPE:
                        if (!skipSample)
                        {
                            done = true;
                            ev   = Edf.GetFloatData(m_EdfFile);
                        }

                        break;

                    /*
                     *
                     * if(recordEvent.time>=trialEndTime){
                     *
                     * }
                     * if(filterType==Constant.EventType.ANY_TYPE || returnType==filterType){
                     *  done = true;
                     *  ev = Edf.GetFloatData(m_EdfFile);
                     * }
                     *
                     * break;*/
                    case Constant.EventType.NO_PENDING_ITEMS:
                        done = true;
                        break;

                    default:
                        done = true;
                        Debug.LogWarning("Unknown type: " + returnType);
                        //return;
                        break;
                    }
                }
                else
                {
                }
                //console.log(done,", ",type,", ",event);
            }while(!done);

            if (ev != null && ev.time > trialEndTime)
            {
                ev = null;
            }

            return(ev);
        }
Beispiel #2
0
 public EdfData TrialNextEvent(out Constant.EventType returnType, Constant.EventType filterType = Constant.EventType.ANY_TYPE)
 {
     return(TrialNextData(out returnType, filterType, true));
 }