Mercurial > hg > ape
view listeningTest/multiComp/MpushIc.m @ 15:24be5e9ce25b tip
Update README
author | Brecht De Man <brecht.deman@bcu.ac.uk> |
---|---|
date | Thu, 20 Sep 2018 12:23:20 +0200 |
parents | d113f0626fe3 |
children |
line wrap: on
line source
function MpushIc(hf) sel=get(hf,'selectiontype'); dat=get(hf,'userdata'); drag=dat.drag; obj=get(gcf,'currentobject'); sndId=get(obj,'userdata'); switch sel case 'normal' fidInd=['responses/' dat.sesDat.id,'_',dat.sesDat.sesScript]; fid=fopen(fidInd,'a'); fprintf(fid,'%i ', sndId); % log that this sound has been played dat.playVec(sndId,1) = 1; % check sample as 'played' set(hf,'userdata',dat); % write dat away already here (avoid 'not all sounds played') set(dat.hIcon,'backgroundcolor',[.6 .9 .6]); % all icons turn green % avoid 'Stop Audio' becoming red if(str2double(obj.String)<=dat.nbScale*(dat.nbSnd+4)+1) set(obj,'backgroundcolor','r'); end playSound(dat.sesDat.cuSndList(sndId)); case 'alt' % right mouse (ctrl+button) if drag drag=0; else % if dat.test.sndRef % if ~isempty(find(dat.test.sndRef==sndId)) % return % end % end drag=1; end case 'open' % double-click % ? is this used at all? % BRECHT: log plays in response log fid=['responses/' dat.sesDat.id,'_',dat.sesDat.sesScript]; fprintf(fid,'%i', sndId); dat.vector(sndId,1) = 1; % check sample as 'played' obj=get(gcf,'currentobject'); set(dat.hIcon,'backgroundcolor',[.6 .9 .6]); set(obj,'backgroundcolor','r'); playSound(dat.sesDat.cuSndList(get(obj,'userdata'))); end saveMultiComp(hf); try % in case audio is still playing when finishing dat.drag=drag; set(hf,'userdata',dat); catch err end