Donate Win: GetCharWithTicks.dll

andy.snyder.wrote

>If a character is available (i.e., CharAvail) before
>the GetCharWithTicks line is reached, GetCharWithTicks returns the
>most current tick value, not the tick value when the character was
>pressed.
>

I've attached a new version of GetCharWithTicks.dll which corrects that problem. I also fixed it to return the same ASCII codes for the arrow keys as does the Mac GetChar, thanks to Frans Cornelissen for reporting that discrepancy.


Best,

Allen


>Hi Allen,
>
>Dan Shima and I have been trying the GetCharWithTicks.dll you wrote
>for Windows. If a character is available (i.e., CharAvail) before
>the GetCharWithTicks line is reached, GetCharWithTicks returns the
>most current tick value, not the tick value when the character was
>pressed.
>
>Here is a short program to demonstrate this. (And it also simulates
>the basic routine for which we can not use KbCheck.) On our machine,
>if a key is pressed during the WaitSecs(2) period, the reaction time
>is always 2000 milliseconds insetad of something less.
>
>clear all;
>FlushEvents('keyDown');
>fprintf('Press a key.\n');
>starttick = GetRealTicks;
>% Simulate 2 seconds of WAVRECORD command during which
>% subject may or may not hit a key.
>WaitSecs(2);
>if (CharAvail)
> disp('A key was pressed.');
> [char, whentick] = GetCharWithTicks;
> RT = whentick-starttick;
> fprintf('Starttick is %0.0f.\n',starttick);
> fprintf('Whentick is %0.0f.\n',whentick);
> fprintf('Reaction Time is %0.0f milliseconds.\n',RT);
> disp('Reaction Time seems to always be 2000 milliseconds.');
>else
> disp('No key was pressed during 2 seconds.');
>end
>
>
>