-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGRFPreCueState.m
More file actions
executable file
·58 lines (45 loc) · 1.22 KB
/
GRFPreCueState.m
File metadata and controls
executable file
·58 lines (45 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// GRFPreCueState.m
// OrientationChange
//
// Created by John Maunsell on 2/25/06.
// Copyright 2006. All rights reserved.
//
#import "GRFPreCueState.h"
@implementation GRFPreCueState
- (void)stateAction {
long preCueMS = [[task defaults] integerForKey:GRFPrecueMSKey];
if ([[task defaults] boolForKey:GRFFixateKey]) { // fixation required && fixated
[[task dataDoc] putEvent:@"fixate"];
[scheduler schedule:@selector(updateCalibration) toTarget:self withObject:nil
delayMS:preCueMS * 0.8];
if ([[task defaults] boolForKey:GRFDoSoundsKey]) {
[[NSSound soundNamed:kFixateSound] play];
}
}
expireTime = [LLSystemUtil timeFromNow:preCueMS];
}
- (NSString *)name {
return @"GRFPrecue";
}
- (LLState *)nextState {
if ([task mode] == kTaskIdle) {
eotCode = kEOTQuit;
return stateSystem->endtrial;
}
if ([[task defaults] boolForKey:GRFFixateKey] && ![fixWindow inWindowDeg:[task currentEyeDeg]]) {
eotCode = kEOTBroke;
return stateSystem->endtrial;
}
if ([LLSystemUtil timeIsPast:expireTime]) {
return stateSystem->cue;
}
return nil;
}
- (void)updateCalibration;
{
if ([fixWindow inWindowDeg:[task currentEyeDeg]]) {
[[task eyeCalibrator] updateCalibration:[task currentEyeDeg]];
}
}
@end