Skip to content

Commit 9554957

Browse files
committed
make sure the visual target is displayed
- this is not pretty but it gets the job done for now
1 parent 3e1b309 commit 9554957

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

setParameters.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
cfg.fixation.yDisplacement = 0;
8282

8383
cfg.target.maxNbPerBlock = 2;
84-
cfg.target.duration = 0.05; % In secs
84+
cfg.target.duration = 0.5; % In secs
8585

8686
cfg.extraColumns = {'direction', 'speed', 'target', 'event', 'block', 'keyName'};
8787

subfun/doAudMot.m

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,37 +54,42 @@
5454
%
5555
% end
5656

57-
thisFixation.fixation = cfg.fixation;
58-
thisFixation.screen = cfg.screen;
59-
drawFixation(thisFixation);
60-
vbl = Screen('Flip', cfg.screen.win);
61-
6257
% Start the sound presentation
6358
PsychPortAudio('FillBuffer', cfg.audio.pahandle, sound);
6459
PsychPortAudio('Start', cfg.audio.pahandle);
6560
onset = GetSecs;
6661

67-
status = PsychPortAudio('GetStatus', cfg.audio.pahandle);
62+
% draw first fixation and get a first visual time stamp
63+
% ideally we would want to synch that first time stamp and the sound start
64+
thisFixation.fixation = cfg.fixation;
65+
thisFixation.screen = cfg.screen;
66+
if isTarget == 1
67+
thisFixation.fixation.color = cfg.fixation.colorTarget;
68+
end
69+
drawFixation(thisFixation);
70+
vbl = Screen('Flip', cfg.screen.win);
6871

69-
while status.Active
72+
while 1
7073

74+
% set default cross cross color but update if target time is not
75+
% finished
7176
thisFixation.fixation.color = cfg.fixation.color;
72-
7377
if GetSecs < (onset + targetDuration) && isTarget == 1
74-
thisFixation.fixation.color = cfg.fixation.colorTarget
78+
thisFixation.fixation.color = cfg.fixation.colorTarget;
7579
end
7680

7781
drawFixation(thisFixation);
78-
79-
Screen('Flip', cfg.screen.win);
8082
vbl = Screen('Flip', cfg.screen.win, vbl + cfg.screen.ifi);
8183

8284
status = PsychPortAudio('GetStatus', cfg.audio.pahandle);
85+
if ~status.Active
86+
break;
87+
end
8388

8489
end
8590

8691
% Get the end time
87-
waitForEndOfPlayback = 1;
92+
waitForEndOfPlayback = 1; % hard coding that will need to be moved out
8893
[onset, ~, ~, estStopTime] = PsychPortAudio('Stop', cfg.audio.pahandle, ...
8994
waitForEndOfPlayback);
9095

0 commit comments

Comments
 (0)