|
1 | 1 | function responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress) |
2 | | -% wrapper function to use KbQueue |
3 | | -% The queue will be listening to key presses on the response box as defined |
4 | | -% in the cfg structure : see setParameters for more details. |
| 2 | +% Wrapper function to use KbQueue |
5 | 3 | % |
6 | | -% Check the CPP_getResponseDemo for a quick script on how to use it. |
| 4 | +% The queue will be listening to key presses on a keyboard device: |
| 5 | +% cfg.keyboard.responseBox or cfg.keyboard.keyboard are 2 main examples. |
| 6 | +% |
| 7 | +% When no deviceNumber is set then it will listen to the default device. |
7 | 8 | % |
| 9 | +% Check the CPP_getResponseDemo for a quick script on how to use it. |
8 | 10 | % |
9 | 11 | % |
10 | 12 | % INPUT |
11 | 13 | % |
12 | 14 | % - action: Defines what we want the function to do |
13 | 15 | % - init: to initialise the queue |
14 | 16 | % - start: to start listening to keypresses |
15 | | -% - check: |
16 | | -% - flush: |
17 | | -% - stop: |
| 17 | +% - check: checks all the key presses events since 'start', or since last |
| 18 | +% 'check' or 'flush' (whichever was the most recent) |
| 19 | +% - flush: empties the queue of events in case you want to restart from a clean |
| 20 | +% queue |
| 21 | +% - stop: stops listening to key presses |
18 | 22 | % |
19 | 23 | % - getOnlyPress: if set to true the function will only return the key presses and |
20 | 24 | % will not return when the keys were released (default=true) |
|
149 | 153 | responseEvents(iEvent,1).onset = event.Time; |
150 | 154 | responseEvents(iEvent,1).trial_type = 'response'; |
151 | 155 | responseEvents(iEvent,1).duration = 0; |
152 | | - responseEvents(iEvent,1).key_name = KbName(event.Keycode); |
| 156 | + responseEvents(iEvent,1).keyName = KbName(event.Keycode); |
153 | 157 | responseEvents(iEvent,1).pressed = event.Pressed; |
154 | 158 |
|
155 | 159 | iEvent = iEvent + 1; |
|
0 commit comments