prestim_ptb.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. %Prestim
  2. %Updated 19_10_2011 Chris van der Togt
  3. %Updated to take PTB3 commands instead of cogent: Sept 2013 Chris Klink
  4. global Par;
  5. %% Das card
  6. BtOn = 0; %if using button presses set to 1
  7. Par.Board = int32(22); %mcc board = 22; Demo-board = 0
  8. Par.nChannels = 8;
  9. if ~isfield(Par, 'DasOn')
  10. Par.DasOn = 0; %persistent value
  11. end
  12. if Par.DasOn ~= 1
  13. %LPStat = dasinit( Par.Board, Par.nChannels); %mexfunction acces!!
  14. dasinit( Par.Board, Par.nChannels); %mexfunction acces!!
  15. Par.DasOn = 1;
  16. end
  17. %% PTB
  18. warning('off','MATLAB:dispatcher:InexactMatch')
  19. if ~isfield(Par,'window') % assume that if a window has been opened, it's still there
  20. ptbInit % initialize PTB
  21. Par.scr=Screen('screens');
  22. Par.ScrNr=max(Par.scr); % use the screen with the highest #
  23. PsychImaging('PrepareConfiguration');
  24. % Check which screen and flip if 3T BOLD
  25. if strcmp(Par.ScreenChoice,'3T') % 3T
  26. % flip horizontal
  27. PsychImaging('AddTask','AllViews','FlipHorizontal');
  28. fprintf([Par.ScreenChoice ' BOLD display: Flipping the screen\n']);
  29. elseif strcmp(Par.ScreenChoice,'Mock')% mock
  30. % specific mock stuff?
  31. elseif strcmp(Par.ScreenChoice,'NIN')% ephys setup
  32. % specific ephys stuff?
  33. else
  34. end
  35. %[Par.window, Par.wrect] = Screen('OpenWindow',Par.ScrNr,0,[],[],2,[],[],1);
  36. [Par.window, Par.wrect] = PsychImaging('OpenWindow',Par.ScrNr,0,[],[],2,[],[],1);
  37. end
  38. %Set-up blend function
  39. [sourceFactorOld,destinationFactorOld,colorMaskOld] = ...
  40. Screen('BlendFunction',Par.window,GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  41. %% set eyerec trigger to 'off'
  42. dasbit(0,1);
  43. %////////////////////global variable Par settings//////////////////////////
  44. % default file assignment
  45. % make sure they exist and have all necessary parameters
  46. Par.RUNFUNC = 'runstim';
  47. Par.STIMSETFILE = 'StimSettings';
  48. Par.PARSETFILE = 'ParSettings';
  49. Par.MONKEY = 'DefMonkey';
  50. eval(Par.PARSETFILE); %loads parameter settings from separate m-file