-
Notifications
You must be signed in to change notification settings - Fork 0
/
headturn.zp
153 lines (116 loc) · 3.39 KB
/
headturn.zp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/******************************************************************************\
FILE: headturn.zp
EXPERIMENT: Head-turn Preference Procedure
AUTHOR: Theo Veenker <theo.veenker@beexy.nl>
ADAPTED BY: -
Global structure of experiment:
- welcome
- phase 1 (see subfolder familiarization)
- phase 2 (see subfolder test)
- thankyou
HISTORY:
2013-07-03 TV Created.
2017-01-09 TV Adapted for Zep 2.0.
2017-09-18 CvR Adapted for UiL-OTS setup
\******************************************************************************/
requires 2.0;
// Default/Standard modules
import std_entry_page2;
import std_exit_page2;
import io_beexybox; // Enable to use BeexyBox response box.
// Custom modules
import baby_windows3;
import stimuli;
import multichannel_sound_output_device;
import familiarization::task;
import test::task;
// Experiment version. In piloting stage and later increment this on each
// relevant change.
const int EXPERIMENT_VERSION = 1;
Experiment experiment
{
on_event:entry()
{
stimuli::bootstrap_stimulus_lists();
if(control.state == CONTROL_RUNNING && !error()) show_test_windows();
}
on_event:message()
{
// On Ctrl+F4 jump unconditionally to the thank-you part.
if (message_sender == control && message_arg == SYS_STOP)
{
control.mark_experiment_aborted();
thankyou.enter();
}
}
Part welcome
{
on_event:entry()
{
// Show nice welcome image to infant.
entry_page.add_image(stimuli_dir() + "images/doll.svg");
entry_page.action(this);
control.enable_button(test::BUTTON_GO);
}
}
Part phase1
{
on_event:entry()
{
familiarization::action(this);
}
}
Part phase2
{
on_event:entry()
{
test::action(this);
}
}
Part thankyou
{
on_event:entry()
{
control.end_experiment(); // Check-in session.
// Setup a slide show.
exit_page.add_image(stimuli_dir() + "images/doll.svg");
exit_page.add_image(stimuli_dir() + "images/wagon.svg");
exit_page.add_image(stimuli_dir() + "images/fish.svg");
exit_page.action(this);
// In 2s start playing a (baby song) sound file.
sound_playback.scaling_all = 1.0;
sound_playback.looper.start(now()+2s);
control.target = this;
control.disable_buttons();
control.disable_keys();
control.enable_key(KEY_Escape);
}
on_event:exit()
{
multichannel_sound_output_device.close();
sound_playback.looper.abort();
sound_playback.abort();
}
}
SoundPlayback sound_playback
{
init()
{}
// Sound source/producer object.
SoundFile clip {}
void play(string filename, time tstart)
{
abort();
device = multichannel_sound_output_device;
clip.file = stimuli_dir() + "sounds/" + filename;
start(tstart);
}
Timer looper {
on_event:expire()
{
sound_playback.play("music.wav", event_time);
looper.start(sound_playback.expected_finish_time + 5s);
}
}
}
}