# Eyelink playback routine

**URL:** <https://psychtoolbox.discourse.group/t/eyelink-playback-routine/2084>\
**Category:** Uncategorized\
**Created:** [June 15, 2009, 2:45pm UTC](https://psychtoolbox.discourse.group/t/eyelink-playback-routine/2084 "2009-06-15T14:45:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 15, 2009, 2:45pm UTC](https://psychtoolbox.discourse.group/t/eyelink-playback-routine/2084/1 "2009-06-15T14:45:13Z")

</div>

Dear all,  
we have the following problem. We would like to play back eyelink data   
at the end of each trial and probably need the   
eyelink\_wait\_for\_block\_start routine.  
The typical example from the Eyelink Programmer's Guide is:  
  
set\_offline\_mode(); // set up eye tracker for playback  
eyelink\_playback\_start(); // start data playback  
// Wait for first data to arrive  
// Failure may mean no data or file not open  
// This function discards other data in file (buttons and messages)  
// until the start of recording.  
// If you need these events, then don’t use this function.  
// Instead, wait for a sample or event before setting eye\_data,  
// and have a timeout if no data is available in 2000 msec.  
if(!eyelink\_wait\_for\_block\_start(2000, 1, 1))  
{  
alert\_printf("ERROR: playback data did not start!");  
return -1;  
}  
  
As far as we have understood this routine is not implemented in the   
eyelink toolbox.  
Does anybody know if there is a possibility to access the routine via   
the eyelink toolbox or if there is a work around?  
  
Thanks,  
Jutta

---

<div class="post-metadata">

**Author:** ![e\_flister](https://avatars.discourse-cdn.com/v4/letter/e/e36b37/32.png) [@e\_flister](https://psychtoolbox.discourse.group/u/e_flister)\
**Post date:** [June 24, 2009, 2:59pm UTC](https://psychtoolbox.discourse.group/t/eyelink-playback-routine/2084/2 "2009-06-24T14:59:15Z")

</div>

it is quite easy to add eyelink functions yourself. check out the ptb dev branch, and all the c is in:  
\PsychSourceGL\Source\Common\Eyelink  
  
follow the examples there (EyelinkWaitForModeReady.c is a good barebones example -- also search everything in the root directory for 'waitformode' to see the various places you need to register any new functions you write).  
  
if you're on windows, there is a build script for making the mex file (customize it with your local paths):  
\PsychSourceGL\Source\windowsmakeeyelink.m  
  
you can use a free version of visual studio (for c/c++) for the compiling:  
[http://www.microsoft.com/express/download/#webInstall](http://www.microsoft.com/express/download/#webInstall)  
  
on osx, there is an xcode project that knows how to do the build.  
  
if you don't like the sound of that approach, there's tons of workarounds. tell the eyelink to record the data to a file and then transfer that file after the trial/session, or else receive the samples over the link in realtime during the trial and record them in your matlab data structures. or maybe there is some hope of calling the eyelink API via matlab's loadlibrary.  
-e  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), Jutta Billino \<Jutta.Billino@...\> wrote:  
> \>  
> \> Dear all,  
> \> we have the following problem. We would like to play back eyelink data   
> \> at the end of each trial and probably need the   
> \> eyelink\_wait\_for\_block\_start routine.  
> \> The typical example from the Eyelink Programmer's Guide is:  
> \>   
> \> set\_offline\_mode(); // set up eye tracker for playback  
> \> eyelink\_playback\_start(); // start data playback  
> \> // Wait for first data to arrive  
> \> // Failure may mean no data or file not open  
> \> // This function discards other data in file (buttons and messages)  
> \> // until the start of recording.  
> \> // If you need these events, then don't use this function.  
> \> // Instead, wait for a sample or event before setting eye\_data,  
> \> // and have a timeout if no data is available in 2000 msec.  
> \> if(!eyelink\_wait\_for\_block\_start(2000, 1, 1))  
> \> {  
> \> alert\_printf("ERROR: playback data did not start!");  
> \> return -1;  
> \> }  
> \>   
> \> As far as we have understood this routine is not implemented in the   
> \> eyelink toolbox.  
> \> Does anybody know if there is a possibility to access the routine via   
> \> the eyelink toolbox or if there is a work around?  
> \>   
> \> Thanks,  
> \> Jutta  
> \>
