[−][src]Function libeyelink_sys::eyelink_get_sample
pub unsafe extern "C" fn eyelink_get_sample(sample: *mut c_void) -> INT16
@ingroup messaging Gets an integer (unconverted) sample from end of queue, discards any events encountered.
@param sample Pointer to buffer (\c ISAMPLE or \c ALL_DATA type). @return \c 0 if no data. \c 1 if data retrieved.
\b Example:
\code #includeISAMPLE isample; // INTEGER SAMPLE DATA int eye_used = 0; // indicates which eye's data to display float x, y; // gaze position int i; if(!eyelink_wait_for_block_start(100, 1, 0)) { end_trial(); return TRIAL_ERROR; } eye_used = eyelink_eye_available(); switch(eye_used) // select eye, add annotation to EDF file { case RIGHT_EYE: eyemsg_printf("EYE_USED 1 RIGHT"); break; case BINOCULAR: // both eye's data present: use left eye only eye_used = LEFT_EYE; case LEFT_EYE: eyemsg_printf("EYE_USED 0 LEFT"); break; } while(1) { i = eyelink_get_sample(&isample); if(i) { if (x!=MISSING_DATA) x = ((float) isample.gx[eye_used])/ ((float) eyelink_position_prescaler()); else x = (float) MISSING_DATA; if (y!=MISSING_DATA) y = ((float) isample.gy[eye_used])/ ((float) eyelink_position_prescaler()); else y = (float) MISSING_DATA; eyemsg_printf("Sample: %ld %6.2f %6.2f", isample.time, x, y); } ... } \endcode
\b Output:
\code MSG 14839670 Sample: 14839666 539.20 372.60 MSG 14839670 Sample: 14839668 539.20 372.60 MSG 14839674 Sample: 14839670 539.20 372.60 MSG 14839674 Sample: 14839672 539.20 372.60 MSG 14839678 Sample: 14839674 547.90 367.60 MSG 14839678 Sample: 14839676 556.60 362.50 MSG 14839682 Sample: 14839678 565.30 357.40 MSG 14839682 Sample: 14839680 574.10 352.30 MSG 14839686 Sample: 14839682 582.80 347.20 MSG 14839686 Sample: 14839684 591.50 342.00 MSG 14839690 Sample: 14839686 600.30 336.80 MSG 14839690 Sample: 14839688 609.00 331.60 MSG 14839694 Sample: 14839690 617.80 326.40 MSG 14839694 Sample: 14839692 626.60 321.20 MSG 14839698 Sample: 14839694 635.30 315.90 MSG 14839698 Sample: 14839696 644.10 310.70 MSG 14839702 Sample: 14839698 652.90 305.40 MSG 14839702 Sample: 14839700 661.70 300.00 MSG 14839706 Sample: 14839702 670.50 294.70 MSG 14839706 Sample: 14839704 679.30 289.40 MSG 14839710 Sample: 14839706 688.10 284.00 MSG 14839710 Sample: 14839708 696.90 278.60 MSG 14839714 Sample: 14839710 705.80 273.20 MSG 14839714 Sample: 14839712 714.60 267.70 MSG 14839718 Sample: 14839714 723.40 262.30 MSG 14839718 Sample: 14839716 732.30 256.80 MSG 14839722 Sample: 14839718 741.20 251.30 MSG 14839722 Sample: 14839720 750.00 245.80 \endcode
\sa \c eyelink_get_float_data(), \c eyelink_get_last_data(), \c eyelink_get_next_data(), \c eyelink_newest_float_sample() and \c eyelink_newest_sample()