예제 #1
0
//SEAN excluded
int run_trials_org(void)
{
  int i=0;
  int trial;
  
  target_foreground_color = RGB(0,0,0);          // set background for calibration
  target_background_color = RGB(255,255,255);    // This should match the display
  set_calibration_colors(target_foreground_color, target_background_color);
  
  /*TRIAL_VAR_LABELS message is recorded for EyeLink Data Viewer analysis
  It specifies the list of trial variables for the trial
  This should be written once only and put before the recording of individual trials */
  eyemsg_printf("TRIAL_VAR_LABELS TRIAL_WORD");
  
  /* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
  
  
  
		/* loop through trials */
  for(trial=1;trial<=NTRIALS;trial++)
  {
    if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
    {
      return ABORT_EXPT;
    }
				/* RUN THE TRIAL */
    i = do_simple_trial(trial);
    end_realtime_mode();          // safety: make sure realtime mode stopped
    
    
    
    
    switch(i)         	/* REPORT ANY ERRORS */
    {
    case ABORT_EXPT:        /* handle experiment abort or disconnect */
      eyemsg_printf("EXPERIMENT ABORTED");
      return ABORT_EXPT;
    case REPEAT_TRIAL:	  /* trial restart requested */
      eyemsg_printf("TRIAL REPEATED");
      trial--;
      break;
    case SKIP_TRIAL:	  /* skip trial */
      eyemsg_printf("TRIAL ABORTED");
      break;
    case TRIAL_OK:          // successful trial
      eyemsg_printf("TRIAL OK");
      break;
    default:                // other error code
      eyemsg_printf("TRIAL ERROR");
      break;
    }
  }  // END OF TRIAL LOOP
  return 0;
}
/******************************** TRIAL LOOP ************************************

	This code sequences trials within a block  It calls run_trial() to 
	execute a trial, then interperts result code. It places a result message 
	in the EDF file. This example allows trials to be repeated from 
	the tracker ABORT menu. 
 ********************************************************************************/
int run_trials(void)
{
  int i;
  int trial;
  
  SETCOLOR(target_foreground_color,0,0,0);       /* set background for calibration */
  SETCOLOR(target_background_color,255,255,255); /* This should match the display */
  set_calibration_colors(&target_foreground_color, &target_background_color); 
        
  /* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
				
  /* loop through trials */
  for(trial=1;trial<=NTRIALS;trial++)
    {
      if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
		{
			return ABORT_EXPT;
		}
		/* RUN THE TRIAL */
		i = do_simple_trial(trial);
		end_realtime_mode();          /* safety: make sure realtime mode stopped */

		switch(i)         	/* REPORT ANY ERRORS */
		{
		case ABORT_EXPT:        /* handle experiment abort or disconnect */
			eyemsg_printf("EXPERIMENT ABORTED");
			return ABORT_EXPT;
		case REPEAT_TRIAL:	  /* trial restart requested */
			eyemsg_printf("TRIAL REPEATED");
			trial--;
			break;
		case SKIP_TRIAL:	  /* skip trial */
			eyemsg_printf("TRIAL ABORTED");
			break;
		case TRIAL_OK:          /* successful trial */
		    eyemsg_printf("TRIAL OK");
		    break;
		default:                /* other error code */
		    eyemsg_printf("TRIAL ERROR");
			break;
		}
    }  /* END OF TRIAL LOOP */
  return 0;
}