-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCRSPreCueState.m
executable file
·58 lines (45 loc) · 1.22 KB
/
CRSPreCueState.m
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
//
// CRSPreCueState.m
// OrientationChange
//
// Created by John Maunsell on 2/25/06.
// Copyright 2006. All rights reserved.
//
#import "CRSPreCueState.h"
@implementation CRSPreCueState
- (void)stateAction {
long preCueMS = [[task defaults] integerForKey:CRSPrecueMSKey];
if ([[task defaults] boolForKey:CRSFixateKey]) { // fixation required && fixated
[[task dataDoc] putEvent:@"fixate"];
[scheduler schedule:@selector(updateCalibration) toTarget:self withObject:nil
delayMS:preCueMS * 0.8];
if ([[task defaults] boolForKey:CRSDoSoundsKey]) {
[[NSSound soundNamed:kFixateSound] play];
}
}
expireTime = [LLSystemUtil timeFromNow:preCueMS];
}
- (NSString *)name {
return @"CRSPrecue";
}
- (LLState *)nextState {
if ([task mode] == kTaskIdle) {
eotCode = kEOTQuit;
return stateSystem->endtrial;
}
if ([[task defaults] boolForKey:CRSFixateKey] && ![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