Skip to content

Commit 1b4cfb7

Browse files
FedericaFederica
authored andcommitted
Implemented some comments
1 parent 6eeb9c8 commit 1b4cfb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+71
-29
lines changed
Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
%% Demo showing how to use the createFramesTextureStructure and playVideoFrames functions
44

5-
% This small script shows how to use the getReponse function
5+
% as it is, it presents two example videos in succession
6+
67

78
% add parent directory to matlab path (so we can access the CPP_PTB functions)
89
addpath(fullfile(pwd, '..'));
@@ -30,31 +31,62 @@
3031
[cfg.screen.win, cfg.screen.winRect] = Screen('OpenWindow', cfg.screen.idx, cfg.color.background);
3132

3233

33-
%% Video related info
34+
%% Strcuture for video related info
3435

3536
% The name of your "video" and its images format
36-
cfg.video.name = 'coffee';
37+
video.names = {'coffee','leaves'};
38+
39+
% The number of frames of your video you want to present
40+
% If left empty, all available frames are taken
41+
video.frame.numbers = [];
42+
% video.frame.numbers = 30;
43+
% video.frame.numbers = [30,15];
3744

3845
% The format fo the images
39-
cfg.video.frame.format = '.jpeg'; % can be any img format compatible with the "imread" function
46+
video.frame.format = '.jpeg'; % can be any img format compatible with the "imread" function
4047

4148
% the folder where the images are (from the current folder)
42-
cfg.video.path = '/video_frames/';
49+
video.stimuli.folder = 'stimuli/';
4350

4451
% The frame rate at which you want to present your video
45-
cfg.video.frame.rate = 29.97;
52+
video.frame.rate = 29.97;
4653

47-
% The number of frames of your video you want to present
48-
cfg.video.frame.number = 30;
54+
% Time bw videos in s
55+
video.isi = 1;
4956

57+
58+
%% present the videos in a loop
5059

60+
for trial = 1:length(video.names)
61+
62+
% select name and folder where current video is
63+
video.name = video.names{trial};
64+
video.path = fullfile(video.stimuli.folder,video.name);
65+
66+
67+
% how many frames are going to be presented
68+
if numel(video.frame.numbers) < 1
69+
video.frame.number = size(dir([video.path,'/*',video.frame.format]),1);
70+
71+
elseif numel(video.frame.numbers) > 1
72+
video.frame.number = video.frame.numbers(trial);
73+
74+
else
75+
video.frame.number = video.frame.numbers;
76+
end
77+
78+
5179
% Read the images and create the stucture with their textures
52-
cfg = createFramesTextureStructure(cfg);
53-
80+
[video, cfg] = createFramesTextureStructure(video, cfg);
5481

5582
% Play the video
56-
playVideoFrames(cfg);
83+
playVideoFrames(video, cfg);
84+
85+
% ISI (better would be to use Flip)
86+
WaitSecs(video.isi);
87+
88+
end
5789

5890

5991
% The end
60-
sca;
92+
sca;

0 commit comments

Comments
 (0)