Skip to content

Commit f9fae5e

Browse files
committed
refactor doAudMot (and rename it)
1 parent b466640 commit f9fae5e

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

audioLocTranslational.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
% % % REFACTOR THIS FUNCTION % % %
9898
% play the sounds and collect onset and duration of the event
99-
[onset, duration] = doAudMot(cfg, thisEvent);
99+
[onset, duration] = doAuditoryMotion(cfg, thisEvent);
100100

101101
thisEvent.event = iEvent;
102102
thisEvent.block = iBlock;

subfun/doAudMot.m renamed to subfun/doAuditoryMotion.m

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [onset, duration] = doAudMot(cfg, thisEvent)
1+
function [onset, duration] = doAuditoryMotion(cfg, thisEvent)
22

33
% Play the auditopry stimulation of moving in 4 directions or static noise bursts
44
%
@@ -11,48 +11,36 @@
1111
% - thisEvent: structure that the parameters regarding the event to present
1212
%
1313
% Output:
14-
% -
14+
% - onset in machine time
15+
% - duration in seconds
1516
%
1617

1718
%% Get parameters
1819

19-
sound = [];
20-
2120
direction = thisEvent.direction(1);
2221
isTarget = thisEvent.target(1);
2322
targetDuration = cfg.target.duration;
2423

2524
soundData = cfg.soundData;
2625

27-
% if isTarget == 0
26+
switch direction
27+
case -1
28+
fieldName = 'S';
29+
case 90
30+
fieldName = 'U';
31+
case 270
32+
fieldName = 'D';
33+
case 0
34+
fieldName = 'R';
35+
case 180
36+
fieldName = 'L';
37+
end
2838

29-
if direction == -1
30-
sound = soundData.S;
31-
elseif direction == 90
32-
sound = soundData.U;
33-
elseif direction == 270
34-
sound = soundData.D;
35-
elseif direction == 0
36-
sound = soundData.R;
37-
elseif direction == 180
38-
sound = soundData.L;
39+
if isTarget == 1
40+
fieldName = [fieldName '_T'];
3941
end
4042

41-
% elseif isTarget == 1
42-
%
43-
% if direction == -1
44-
% sound = soundData.S_T;
45-
% elseif direction == 90
46-
% sound = soundData.U_T;
47-
% elseif direction == 270
48-
% sound = soundData.D_T;
49-
% elseif direction == 0
50-
% sound = soundData.R_T;
51-
% elseif direction == 180
52-
% sound = soundData.L_T;
53-
% end
54-
%
55-
% end
43+
sound = soundData.(fieldName);
5644

5745
% Start the sound presentation
5846
PsychPortAudio('FillBuffer', cfg.audio.pahandle, sound);

0 commit comments

Comments
 (0)