[mainWindow,wRect]=Screen('OpenWindow',0);
を
[mainWindow,wRect] = Screen('OpenWindow', 0, [], [50 50 1000 700]);
のように書き換えて、フルスクリーンではなく、ウィンドウ表示にして動作確認をしてみるとよいと思います。
エラーが出ているときは、Matlabのコマンドウィンドウ上に表示されます。
同じtest0510のプログラムに対してWin8.1とWin10で動作の違いが生じる理由は何でしょうか。コマンドウィンドウにはASIOのことが触れられていますが、ASIOが関連あるのでしょうか(ちなみに、Win8.1にはASIOドライバーを入れていますが、Win10には入れていません)。
function test0510
% Clear the workspace and the screen
sca;
close all;
clearvars;
Screen('Preference', 'SkipSyncTests', 0);
InitializePsychSound(1);
black=[0 0 0];
KbName('UnifyKeyNames');
myKeyCheck;
[mainWindow,wRect]=Screen('OpenWindow',0);
[xCenter,yCenter]=RectCenter(wRect);
fixposition=[xCenter-10 yCenter-10 xCenter+10 yCenter+10];
sr = 44100;
dur = 1;
fr = 300;
beep = MakeBeep(fr, dur, sr);
nrchannels=size(beep,1);
if nrchannels < 2
beep = [beep; beep];
nrchannels = 2;
end
pahandle = PsychPortAudio('Open');
PsychPortAudio('FillBuffer', pahandle, beep);
keyOn=0;i=0;
while keyOn==0%どのキーも押されていない間に以下のプログラムが進行
time=0; start = GetSecs; rng('shuffle'); beepTime = 2*rand;
Screen('FillRect',mainWindow);Screen('Flip', mainWindow);
while beepTime>time && keyOn==0%音が出るまでのbeepTime時間を待機
time=GetSecs-start;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1%待機中にどこかのキーが押されたらプログラム終了
keyOn=1;
end
end%beepTimeの時間を過ぎたら中央にドットと音を提示
i=i+1;%提示回数がカウントされる
PsychPortAudio('start', pahandle, 1);%音の再生スタート(1秒間)
Screen('FillOval',mainWindow,black,fixposition);%中央ドットの表示
Screen('DrawText', mainWindow,[num2str(beepTime,3) 's'], xCenter*1.6, yCenter*1.8);%beepTimeの時間を表示
Screen('DrawText', mainWindow,[num2str(i) 'times'], xCenter*0.1, yCenter*1.8);%提示回数の表示
Screen('Flip', mainWindow);
time1=0; start1=GetSecs;
while 1>time1 && keyOn==0%音が提示される1秒間を待機
time1=GetSecs-start1;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1%待機中にどこかのキーが押されたらプログラム終了
keyOn=1;
end
end
Screen('Flip', mainWindow);
end
%終了処理
sca;
Screen('CloseAll');