localizer_detect.m 1.58 KB
Newer Older
1 2
% revision 1.00.1 beta, 07/01/04

3
function response = localizer_detect
4 5 6 7 8 9 10

global def
global work
global simwork

% we select only the left channels, the model is monaural
simwork.tmpSig = work.signal;
11
simwork.DOA = [];
12

13 14 15 16 17
% for each interval, run doa=localizer_preproc(interval sound), 
% so that we have an estimate of the DOA for each presented interval
% NOTE!!! the target interval of the current trial is always in the 
% first two columns of work.signal (so also of simwork.tmpSig), no matter
% in which order it was presented to the subject!
18
for i=1:def.intervalnum
19
	simwork.DOA(i) = eval([work.vpname '_preproc(simwork.tmpSig(:,2*i-1:2*i))']);		% actual sig processing
20 21
end

22 23 24 25 26 27
% Create the reasoning-scheme of the machine:
% The task for the subject is always: press the interval, which you think 
% was different from two other intervals, so response is always 1,2 or 3.
% How will the machine respond if the DOA estimated for all intervals is
% the same? How would it be if they are all different?

28 29
if length(unique(simwork.DOA))==1
    response=randi(3);
30 31 32 33 34 35
else
where=simwork.DOA(1)-simwork.DOA(2:3);
if where(1)==where(2)
    response=1;
elseif where(1)==0
    response=3;
36
elseif where(2)==0
37
    response=2;
38 39
elseif where(1)~=where(2)
    response=randi(3);
40 41 42
end
end

43 44 45 46 47
  
% NOTE!!! the target interval of the current trial is always in the 
% first two columns of work.signal (so also of simwork.tmpSig), no matter
% in which order it was presented to the subject! Therefore the right anwer 
% is always response=1. If it is 2 or 3, we set it here to 0 (wrong):
48 49 50 51
if response ~= 1
   response = 0;
end

52 53 54
end


55
% eof