-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpanopticon.pde
160 lines (131 loc) · 3.97 KB
/
panopticon.pde
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
154
155
156
157
158
159
160
import ddf.minim.*;
import lemma.library.Event;
import lemma.library.EventHandler;
import lemma.library.Lemma;
import SimpleOpenNI.*;
SimpleOpenNI context;
Minim minim;
AudioPlayer typingSound, lBeepSound, sBeepSound, humSound;
Lemma lemma;
int totalBoothNumber = 6;
int currentIndex = 0;
int outputBoothNb = 2;
boolean transition = false;
Timer timer50;
Timer timer200;
Timer timer5000;
Timer timer15000;
Booth[] booths;
PFont courier;
String IMAGE_PATH = "/Users/martino/Dropbox/Public/panopticon/";
void setup(){
((javax.swing.JFrame) frame).getContentPane().setBackground(new java.awt.Color(0)); //change bgcolor to black
courier = createFont("Courier New", 25);
background(0);
size(1024, 768);
minim = new Minim(this);
typingSound = minim.loadFile("sounds/typing.mp3");
sBeepSound = minim.loadFile("sounds/sbeep.mp3");
lBeepSound = minim.loadFile("sounds/lbeep.mp3");
humSound = minim.loadFile("sounds/hum.mp3");
context = new SimpleOpenNI(this);
if(context.isInit() == false){
println("Can't init SimpleOpenNI, maybe the camera is not connected!");
exit();
return;
}
context.enableIR();
timer50 = new Timer(50);
timer200 = new Timer(200);
timer5000 = new Timer(5000);
timer15000 = new Timer(15000);
booths = new Booth[totalBoothNumber];
for(int i = 0; i < booths.length; i+=1){
booths[i] = new Booth(i);
}
// LEMMA TIME!
lemma = new Lemma(this, "HenSam", "NoamNoam");
for(int i=1; i<=totalBoothNumber; i++){
if (i!=outputBoothNb){
lemma.hear("BrainwaveOut"+i, new ThoughtHandler());
//lemma.hear("Input_MoodRing_"+i, new ColorStripHandler());
lemma.hear("SpiritCenterOut"+i, new PersonHandler());
//lemma.hear("Input_ExtremelyImportant_"+i, new AlertHandler());
//lemma.hear("Input_EmotionalQuotient_"+i, new BeepHandler());
}
}
lemma.hear("B1Pressed_6", new BoothHandler());
startAmbience();
}
void fakeSomeLemmas(){
if(timer200.check())
ColorStripHandler();
if(timer15000.check())
AlertHandler();
if(timer50.check())
BeepHandler();
}
void draw(){
noStroke();
fakeSomeLemmas();
booths[currentIndex].display();
generateOutputs();
lemma.run();
}
int eventNameToRoomNumber(String name){
String roomNumber = name.substring(name.length()-1);
return Integer.parseInt(roomNumber)-1;
}
void startAmbience(){
humSound.loop();
typingSound.loop();
}
void generateOutputs(){
if(timer5000.check()){
String brainwave = generateBrainwave();
lemma.sendEvent("BrainwaveOut"+outputBoothNb, brainwave);
}
if(timer200.check()){
String[] moodRing = generateMoodRing();
lemma.sendEvent("MoodRingOut"+outputBoothNb, moodRing);
float[] spiritCenter = generateSpiritCenter();
lemma.sendEvent("SpiritCenterOut"+outputBoothNb, spiritCenter);
}
if(timer15000.check()){
lemma.sendEvent("ExtremelyImportantOut"+outputBoothNb, "");
}
if(timer50.check()){
float emotionalQuotient = generateEmotionalQuotient();
lemma.sendEvent("EmotionalQuotientOut"+outputBoothNb, emotionalQuotient);
}
}
String generateBrainwave(){
String[] quotes = {"Freedom is Slavery", "2 + 2 = 5", "Ignorance is Strength",
"War is Peace", "Snowden is a Felon", "Put Assange in Jail",
"Now spying on room "+(currentIndex+1)};
return quotes[int(random(quotes.length))];
}
String[] generateMoodRing(){
String[] colors = new String[10];
String[] colorStrip = booths[currentIndex].getColorStrip();
for(int i = 0; i< colors.length; i+=1){
colors[i] = colorStrip[int(random(5))].substring(3,7) + colorStrip[int(random(5))].substring(3,7);
}
return colors;
}
float[] generateSpiritCenter(){
float[] coords = {random(1), random(1), random(1)};
return coords;
}
float generateEmotionalQuotient(){
float x = booths[currentIndex].getPersonCoords()[0];
float y = booths[currentIndex].getPersonCoords()[1];
if(x+y>=100){
return (100/(x+y));
} else {
return (x+y);
}
}
boolean sketchFullScreen(){
return true;
}