JA_frames_function.m 631 B

1234567891011121314151617181920212223
  1. function [actual_frames actual_seconds, nominal_frames nominal_seconds] = JA_frames_function(secs, ifi)
  2. % first output = numer of frames output already shortened by a 0.5*frames to insert into
  3. % the (Screen('Flip'), VBL) as waiting
  4. % second output = true seconds to wait for the next flip to happen
  5. % rounds the indicated time to an exact number of frames
  6. nominal_frames = round(secs/ifi);
  7. % subtract half frames in order not to risk an overshoot (longer duration than required)
  8. actual_frames = nominal_frames - 0.5;
  9. % true waiting
  10. actual_seconds = actual_frames*ifi;
  11. nominal_seconds = secs;
  12. end