Hi,
I have a problem with a script that uses KbCheck:
The basic idea of the program is that it plays a sound, and waits for the user to give an answer by pressing a key. What happens, sometimes, and apparently randomly, is that KbCheck does not give any output while a key is pressed, and the script ends up in a infinite loop. Here is the code
KeyCode(YESresp)=0;
KeyCode(NOresp)=0;
KeyCode(EXITresp)=0;
startrt = PsychPortAudio('Start', pahandle, [], 0, 1);
while ( KeyCode(YESresp)==0 && KeyCode(NOresp)==0 && KeyCode(EXITresp)==0)
[KeyIsDown, endrt, KeyCode]=KbCheck;
WaitSecs(0.001);
end
KbCheck is initialized at the beginning of each loop.
I was wondering whether there might a priority issue between KbCheck and PsychPortAudio.
Thank you
Guillaume
I have a problem with a script that uses KbCheck:
The basic idea of the program is that it plays a sound, and waits for the user to give an answer by pressing a key. What happens, sometimes, and apparently randomly, is that KbCheck does not give any output while a key is pressed, and the script ends up in a infinite loop. Here is the code
KeyCode(YESresp)=0;
KeyCode(NOresp)=0;
KeyCode(EXITresp)=0;
startrt = PsychPortAudio('Start', pahandle, [], 0, 1);
while ( KeyCode(YESresp)==0 && KeyCode(NOresp)==0 && KeyCode(EXITresp)==0)
[KeyIsDown, endrt, KeyCode]=KbCheck;
WaitSecs(0.001);
end
KbCheck is initialized at the beginning of each loop.
I was wondering whether there might a priority issue between KbCheck and PsychPortAudio.
Thank you
Guillaume