pb_runLSL.m 1.79 KB
Newer Older
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
1
2
3
4
5
6
7
8
9
10
function ses = pb_runLSL()
% PB_RUNLSL()
%
% PB_RUNLSL()  ...
%
% See also ...

% PBToolbox (2018): JJH: j.heckman@donders.ru.nl

   streams  = {'type=''Digital Events @ lslder00'' and name=''Digital Events 1''', ...
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
11
               'type=''Pupil Capture @ pupil-desktop'' and name=''Pupil Primitive Data - Eye 0''', ...
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
12
13
14
               'type=''Optitrack @ MOTIVE'' and name=''Motive Data'''};
         
   ses      = lsl_session();
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
15
   str      = lsl_istream.empty(0,3);
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
16

Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
17
   for iStrm = 1:1%length(streams)
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
18
      % Find, select and make streams for LSL.
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
19
20
21
      tmp = strrep(streams(iStrm),'type=''','');
      tmp = tmp{1}(1:find(tmp{1} == '@',1)-2);
      disp([newline 'Looking for ' tmp ' stream...'])
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
22
      
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
23
24
      info  = lsl_streaminfos(streams{iStrm})
      l     = info.list()
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
25
26
27
28
29
30
      if isempty(l); error('No streams found'); end

      for iList = 1:size(l ,1)
        fprintf('%d: name: ''%s'' type: ''%s''\n',iList,l{iList}.name,l{iList}.type);
      end

Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
31
      str(iStrm) = lsl_istream(info{1})
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
32
33
34
35
      ses.add_stream(str(iStrm));
   end
   
   addlistener(str(1),'DataAvailable',@ev_listener);
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
36
   %addlistener(str(2),'DataAvailable',@pl_listener);
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
   % addlistener(str(3),'DataAvailable',@ot_listener);
end

function ev_listener(src, event)
%    disp('ev_listener called')
   event
end

function pl_listener(src, event)
%    disp('pl_listener called');
%    event
end

function ot_listener(src, event)
%    disp('ot_listener called');
%    event
end

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % 
%                                                           %
%       Part of Programmeer Beer Toolbox (PBToolbox)        %
%       Written by: Jesse J. Heckman (2018)                 %
%                                                           %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %