messy first pass at processing2 port
[SugarCubes.git] / Internals.pde
1 /**
2 * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
3 *
4 * //\\ //\\ //\\ //\\
5 * ///\\\ ///\\\ ///\\\ ///\\\
6 * \\\/// \\\/// \\\/// \\\///
7 * \\// \\// \\// \\//H
8 *
9 * EXPERTS ONLY!! EXPERTS ONLY!!
10 *
11 * If you are an artist, you may ignore this file! It just sets
12 * up the framework to run the patterns. Should not need modification
13 * for general animation work.
14 */
15
16 import glucose.*;
17 import glucose.model.*;
18 import heronarts.lx.*;
19 import heronarts.lx.effect.*;
20 import heronarts.lx.modulator.*;
21 import heronarts.lx.parameter.*;
22 import heronarts.lx.pattern.*;
23 import heronarts.lx.transform.*;
24 import heronarts.lx.transition.*;
25 import ddf.minim.*;
26 import ddf.minim.analysis.*;
27 import processing.opengl.*;
28 import rwmidi.*;
29 import java.lang.reflect.*;
30 import javax.media.opengl.*;
31
32 final int VIEWPORT_WIDTH = 900;
33 final int VIEWPORT_HEIGHT = 700;
34
35 // The trailer is measured from the outside of the black metal (but not including the higher welded part on the front)
36 final float TRAILER_WIDTH = 240;
37 final float TRAILER_DEPTH = 97;
38 final float TRAILER_HEIGHT = 33;
39
40 int targetFramerate = 60;
41 int startMillis, lastMillis;
42
43 // Core engine variables
44 GLucose glucose;
45 LX lx;
46 LXPattern[] patterns;
47 Effects effects;
48 MappingTool mappingTool;
49 PandaDriver[] pandaBoards;
50 PresetManager presetManager;
51 MidiEngine midiEngine;
52
53 // Display configuration mode
54 boolean mappingMode = false;
55 boolean debugMode = false;
56 DebugUI debugUI;
57 boolean uiOn = true;
58 boolean simulationOn = true;
59 boolean diagnosticsOn = false;
60 LXPattern restoreToPattern = null;
61 PImage logo;
62 float[] hsb = new float[3];
63
64 // Handles to UI objects
65 UIContext[] overlays;
66 UIPatternDeck uiPatternA;
67 UICrossfader uiCrossfader;
68 UIMidi uiMidi;
69 UIMapping uiMapping;
70 UIDebugText uiDebugText;
71 UISpeed uiSpeed;
72
73 // Camera variables
74 float eyeR, eyeA, eyeX, eyeY, eyeZ, midX, midY, midZ;
75
76 /**
77 * Engine construction and initialization.
78 */
79
80 LXTransition _transition(GLucose glucose) {
81 return new DissolveTransition(glucose.lx).setDuration(1000);
82 }
83
84 LXPattern[] _leftPatterns(GLucose glucose) {
85 LXPattern[] patterns = patterns(glucose);
86 for (LXPattern p : patterns) {
87 p.setTransition(_transition(glucose));
88 }
89 return patterns;
90 }
91
92 LXPattern[] _rightPatterns(GLucose glucose) {
93 LXPattern[] patterns = _leftPatterns(glucose);
94 LXPattern[] rightPatterns = new LXPattern[patterns.length+1];
95 int i = 0;
96 rightPatterns[i++] = new BlankPattern(glucose).setTransition(_transition(glucose));
97 for (LXPattern p : patterns) {
98 rightPatterns[i++] = p;
99 }
100 return rightPatterns;
101 }
102
103 LXEffect[] _effectsArray(Effects effects) {
104 List<LXEffect> effectList = new ArrayList<LXEffect>();
105 for (Field f : effects.getClass().getDeclaredFields()) {
106 try {
107 Object val = f.get(effects);
108 if (val instanceof LXEffect) {
109 effectList.add((LXEffect)val);
110 }
111 } catch (IllegalAccessException iax) {}
112 }
113 return effectList.toArray(new LXEffect[]{});
114 }
115
116 void logTime(String evt) {
117 int now = millis();
118 println(evt + ": " + (now - lastMillis) + "ms");
119 lastMillis = now;
120 }
121
122 void setup() {
123 startMillis = lastMillis = millis();
124
125 // Initialize the Processing graphics environment
126 size(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, OPENGL);
127 frameRate(targetFramerate);
128 noSmooth();
129 // hint(ENABLE_OPENGL_4X_SMOOTH); // no discernable improvement?
130 logTime("Created viewport");
131
132 // Create the GLucose engine to run the cubes
133 glucose = new GLucose(this, buildModel());
134 lx = glucose.lx;
135 lx.enableKeyboardTempo();
136 logTime("Built GLucose engine");
137
138 // Set the patterns
139 LXEngine engine = lx.engine;
140 engine.setPatterns(patterns = _leftPatterns(glucose));
141 engine.addDeck(_rightPatterns(glucose));
142 logTime("Built patterns");
143 glucose.setTransitions(transitions(glucose));
144 logTime("Built transitions");
145 glucose.lx.addEffects(_effectsArray(effects = new Effects()));
146 logTime("Built effects");
147
148 // Preset manager
149 presetManager = new PresetManager();
150 logTime("Loaded presets");
151
152 // MIDI devices
153 midiEngine = new MidiEngine();
154 logTime("Setup MIDI devices");
155
156 // Build output driver
157 PandaMapping[] pandaMappings = buildPandaList();
158 pandaBoards = new PandaDriver[pandaMappings.length];
159 int pbi = 0;
160 for (PandaMapping pm : pandaMappings) {
161 pandaBoards[pbi++] = new PandaDriver(pm.ip, glucose.model, pm);
162 }
163 mappingTool = new MappingTool(glucose, pandaMappings);
164 logTime("Built PandaDriver");
165
166 // Build overlay UI
167 debugUI = new DebugUI(pandaMappings);
168 overlays = new UIContext[] {
169 uiPatternA = new UIPatternDeck(lx.engine.getDeck(GLucose.LEFT_DECK), "PATTERN A", 4, 4, 140, 324),
170 new UIBlendMode(4, 332, 140, 86),
171 new UIEffects(4, 422, 140, 144),
172 new UITempo(4, 570, 140, 50),
173 uiSpeed = new UISpeed(4, 624, 140, 50),
174
175 new UIPatternDeck(lx.engine.getDeck(GLucose.RIGHT_DECK), "PATTERN B", width-144, 4, 140, 324),
176 uiMidi = new UIMidi(midiEngine, width-144, 332, 140, 158),
177 new UIOutput(width-144, 494, 140, 106),
178
179 uiCrossfader = new UICrossfader(width/2-90, height-90, 180, 86),
180
181 uiDebugText = new UIDebugText(148, height-138, width-304, 44),
182 uiMapping = new UIMapping(mappingTool, 4, 4, 140, 324),
183 };
184 uiMapping.setVisible(false);
185 logTime("Built overlay UI");
186
187 // Load logo image
188 logo = loadImage("data/logo.png");
189
190 // Setup camera
191 midX = TRAILER_WIDTH/2.;
192 midY = glucose.model.yMax/2;
193 midZ = TRAILER_DEPTH/2.;
194 eyeR = -290;
195 eyeA = .15;
196 eyeY = midY + 70;
197 eyeX = midX + eyeR*sin(eyeA);
198 eyeZ = midZ + eyeR*cos(eyeA);
199
200 // Add mouse scrolling event support
201 addMouseWheelListener(new java.awt.event.MouseWheelListener() {
202 public void mouseWheelMoved(java.awt.event.MouseWheelEvent mwe) {
203 mouseWheel(mwe.getWheelRotation());
204 }});
205
206 println("Total setup: " + (millis() - startMillis) + "ms");
207 println("Hit the 'p' key to toggle Panda Board output");
208 }
209
210 /**
211 * Core render loop and drawing functionality.
212 */
213 void draw() {
214 long drawStart = System.nanoTime();
215
216 // Draws the simulation and the 2D UI overlay
217 background(40);
218
219 color[] simulationColors;
220 color[] sendColors;
221 simulationColors = sendColors = glucose.getColors();
222 String displayMode = uiCrossfader.getDisplayMode();
223 if (displayMode == "A") {
224 simulationColors = lx.engine.getDeck(GLucose.LEFT_DECK).getColors();
225 } else if (displayMode == "B") {
226 simulationColors = lx.engine.getDeck(GLucose.RIGHT_DECK).getColors();
227 }
228 if (debugMode) {
229 debugUI.maskColors(simulationColors);
230 debugUI.maskColors(sendColors);
231 }
232
233 long simulationStart = System.nanoTime();
234 if (simulationOn) {
235 drawSimulation(simulationColors);
236 }
237 long simulationNanos = System.nanoTime() - simulationStart;
238
239 // 2D Overlay UI
240 long uiStart = System.nanoTime();
241 drawUI();
242 long uiNanos = System.nanoTime() - uiStart;
243
244 long gammaStart = System.nanoTime();
245 // Gamma correction here. Apply a cubic to the brightness
246 // for better representation of dynamic range
247 for (int i = 0; i < sendColors.length; ++i) {
248 lx.RGBtoHSB(sendColors[i], hsb);
249 float b = hsb[2];
250 sendColors[i] = lx.hsb(360.*hsb[0], 100.*hsb[1], 100.*(b*b*b));
251 }
252 long gammaNanos = System.nanoTime() - gammaStart;
253
254 long sendStart = System.nanoTime();
255 for (PandaDriver p : pandaBoards) {
256 p.send(sendColors);
257 }
258 long sendNanos = System.nanoTime() - sendStart;
259
260 long drawNanos = System.nanoTime() - drawStart;
261
262 if (diagnosticsOn) {
263 drawDiagnostics(drawNanos, simulationNanos, uiNanos, gammaNanos, sendNanos);
264 }
265 }
266
267 void drawDiagnostics(long drawNanos, long simulationNanos, long uiNanos, long gammaNanos, long sendNanos) {
268 float ws = 4 / 1000000.;
269 int thirtyfps = 1000000000 / 30;
270 int sixtyfps = 1000000000 / 60;
271 int x = width - 138;
272 int y = height - 14;
273 int h = 10;
274 noFill();
275 stroke(#999999);
276 rect(x, y, thirtyfps * ws, h);
277 noStroke();
278 int xp = x;
279 float hv = 0;
280 for (long val : new long[] {lx.timer.drawNanos, simulationNanos, uiNanos, gammaNanos, sendNanos }) {
281 fill(lx.hsb(hv % 360, 100, 80));
282 rect(xp, y, val * ws, h-1);
283 hv += 140;
284 xp += val * ws;
285 }
286 noFill();
287 stroke(#333333);
288 line(x+sixtyfps*ws, y+1, x+sixtyfps*ws, y+h-1);
289
290 y = y - 14;
291 xp = x;
292 float tw = thirtyfps * ws;
293 noFill();
294 stroke(#999999);
295 rect(x, y, tw, h);
296 h = 5;
297 noStroke();
298 for (long val : new long[] {
299 lx.engine.timer.deckNanos,
300 lx.engine.timer.copyNanos,
301 lx.engine.timer.fxNanos}) {
302 float amt = val / (float) lx.timer.drawNanos;
303 fill(lx.hsb(hv % 360, 100, 80));
304 rect(xp, y, amt * tw, h-1);
305 hv += 140;
306 xp += amt * tw;
307 }
308
309 xp = x;
310 y += h;
311 hv = 120;
312 for (long val : new long[] {
313 lx.engine.getDeck(0).timer.runNanos,
314 lx.engine.getDeck(1).timer.runNanos,
315 lx.engine.getDeck(1).getFaderTransition().timer.blendNanos}) {
316 float amt = val / (float) lx.timer.drawNanos;
317 fill(lx.hsb(hv % 360, 100, 80));
318 rect(xp, y, amt * tw, h-1);
319 hv += 140;
320 xp += amt * tw;
321 }
322 }
323
324 void drawSimulation(color[] simulationColors) {
325 camera(
326 eyeX, eyeY, eyeZ,
327 midX, midY, midZ,
328 0, -1, 0
329 );
330
331 translate(0, 40, 0);
332
333 noStroke();
334 fill(#141414);
335 drawBox(0, -TRAILER_HEIGHT, 0, 0, 0, 0, TRAILER_WIDTH, TRAILER_HEIGHT, TRAILER_DEPTH, TRAILER_HEIGHT/2.);
336 fill(#070707);
337 stroke(#222222);
338 beginShape();
339 vertex(0, 0, 0);
340 vertex(TRAILER_WIDTH, 0, 0);
341 vertex(TRAILER_WIDTH, 0, TRAILER_DEPTH);
342 vertex(0, 0, TRAILER_DEPTH);
343 endShape();
344
345 // Draw the logo on the front of platform
346 pushMatrix();
347 translate(0, 0, -1);
348 float s = .07;
349 scale(s, -s, s);
350 image(logo, TRAILER_WIDTH/2/s-logo.width/2, TRAILER_HEIGHT/2/s-logo.height/2-2/s);
351 popMatrix();
352
353 noStroke();
354 if (glucose.model.bassBox.exists) {
355 drawBassBox(glucose.model.bassBox, false);
356 }
357 for (Speaker speaker : glucose.model.speakers) {
358 drawSpeaker(speaker);
359 }
360 for (Cube c : glucose.model.cubes) {
361 drawCube(c);
362 }
363
364 noFill();
365 strokeWeight(2);
366 beginShape(POINTS);
367 for (LXPoint p : glucose.model.points) {
368 stroke(simulationColors[p.index]);
369 vertex(p.x, p.y, p.z);
370 }
371 endShape();
372 }
373
374 void drawBassBox(BassBox b, boolean hasSub) {
375
376 float in = .15;
377
378 if (hasSub) {
379 noStroke();
380 fill(#191919);
381 pushMatrix();
382 translate(b.x + BassBox.EDGE_WIDTH/2., b.y + BassBox.EDGE_HEIGHT/2, b.z + BassBox.EDGE_DEPTH/2.);
383 box(BassBox.EDGE_WIDTH-20*in, BassBox.EDGE_HEIGHT-20*in, BassBox.EDGE_DEPTH-20*in);
384 popMatrix();
385 }
386
387 noStroke();
388 fill(#393939);
389 drawBox(b.x+in, b.y+in, b.z+in, 0, 0, 0, BassBox.EDGE_WIDTH-in*2, BassBox.EDGE_HEIGHT-in*2, BassBox.EDGE_DEPTH-in*2, Cube.CHANNEL_WIDTH-in);
390
391 pushMatrix();
392 translate(b.x+(Cube.CHANNEL_WIDTH-in)/2., b.y + BassBox.EDGE_HEIGHT-in, b.z + BassBox.EDGE_DEPTH/2.);
393 float lastOffset = 0;
394 for (float offset : BoothFloor.STRIP_OFFSETS) {
395 translate(offset - lastOffset, 0, 0);
396 box(Cube.CHANNEL_WIDTH-in, 0, BassBox.EDGE_DEPTH - 2*in);
397 lastOffset = offset;
398 }
399 popMatrix();
400
401 pushMatrix();
402 translate(b.x + (Cube.CHANNEL_WIDTH-in)/2., b.y + BassBox.EDGE_HEIGHT/2., b.z + in);
403 for (int j = 0; j < 2; ++j) {
404 pushMatrix();
405 for (int i = 0; i < BassBox.NUM_FRONT_STRUTS; ++i) {
406 translate(BassBox.FRONT_STRUT_SPACING, 0, 0);
407 box(Cube.CHANNEL_WIDTH-in, BassBox.EDGE_HEIGHT - in*2, 0);
408 }
409 popMatrix();
410 translate(0, 0, BassBox.EDGE_DEPTH - 2*in);
411 }
412 popMatrix();
413
414 pushMatrix();
415 translate(b.x + in, b.y + BassBox.EDGE_HEIGHT/2., b.z + BassBox.SIDE_STRUT_SPACING + (Cube.CHANNEL_WIDTH-in)/2.);
416 box(0, BassBox.EDGE_HEIGHT - in*2, Cube.CHANNEL_WIDTH-in);
417 translate(BassBox.EDGE_WIDTH-2*in, 0, 0);
418 box(0, BassBox.EDGE_HEIGHT - in*2, Cube.CHANNEL_WIDTH-in);
419 popMatrix();
420
421 }
422
423 void drawCube(Cube c) {
424 float in = .15;
425 noStroke();
426 fill(#393939);
427 drawBox(c.x+in, c.y+in, c.z+in, c.rx, c.ry, c.rz, Cube.EDGE_WIDTH-in*2, Cube.EDGE_HEIGHT-in*2, Cube.EDGE_WIDTH-in*2, Cube.CHANNEL_WIDTH-in);
428 }
429
430 void drawSpeaker(Speaker s) {
431 float in = .15;
432
433 noStroke();
434 fill(#191919);
435 pushMatrix();
436 translate(s.x, s.y, s.z);
437 rotate(s.ry / 180. * PI, 0, -1, 0);
438 translate(Speaker.EDGE_WIDTH/2., Speaker.EDGE_HEIGHT/2., Speaker.EDGE_DEPTH/2.);
439 box(Speaker.EDGE_WIDTH-20*in, Speaker.EDGE_HEIGHT-20*in, Speaker.EDGE_DEPTH-20*in);
440 translate(0, Speaker.EDGE_HEIGHT/2. + Speaker.EDGE_HEIGHT*.8/2, 0);
441
442 fill(#222222);
443 box(Speaker.EDGE_WIDTH*.6, Speaker.EDGE_HEIGHT*.8, Speaker.EDGE_DEPTH*.75);
444 popMatrix();
445
446 noStroke();
447 fill(#393939);
448 drawBox(s.x+in, s.y+in, s.z+in, 0, s.ry, 0, Speaker.EDGE_WIDTH-in*2, Speaker.EDGE_HEIGHT-in*2, Speaker.EDGE_DEPTH-in*2, Cube.CHANNEL_WIDTH-in);
449 }
450
451 void drawBox(float x, float y, float z, float rx, float ry, float rz, float xd, float yd, float zd, float sw) {
452 pushMatrix();
453 translate(x, y, z);
454 rotate(rx / 180. * PI, -1, 0, 0);
455 rotate(ry / 180. * PI, 0, -1, 0);
456 rotate(rz / 180. * PI, 0, 0, -1);
457 for (int i = 0; i < 4; ++i) {
458 float wid = (i % 2 == 0) ? xd : zd;
459
460 beginShape();
461 vertex(0, 0);
462 vertex(wid, 0);
463 vertex(wid, yd);
464 vertex(wid - sw, yd);
465 vertex(wid - sw, sw);
466 vertex(0, sw);
467 endShape();
468 beginShape();
469 vertex(0, sw);
470 vertex(0, yd);
471 vertex(wid - sw, yd);
472 vertex(wid - sw, yd - sw);
473 vertex(sw, yd - sw);
474 vertex(sw, sw);
475 endShape();
476
477 translate(wid, 0, 0);
478 rotate(HALF_PI, 0, -1, 0);
479 }
480 popMatrix();
481 }
482
483
484
485 void drawUI() {
486 camera();
487 PGraphicsOpenGL gl = (PGraphicsOpenGL) g;
488
489 //gl.glClear(javax.media.opengl.GL.GL_DEPTH_BUFFER_BIT);
490 //((PGraphicsOpenGL)g).endGL();
491 strokeWeight(1);
492
493 if (uiOn) {
494 for (UIContext context : overlays) {
495 context.draw();
496 }
497 }
498
499 // Always draw FPS meter
500 fill(#555555);
501 textSize(9);
502 textAlign(LEFT, BASELINE);
503 text("FPS: " + ((int) (frameRate*10)) / 10. + " / " + targetFramerate + " (-/+)", 4, height-4);
504
505 if (debugMode) {
506 debugUI.draw();
507 }
508 }
509
510
511 /**
512 * Top-level keyboard event handling
513 */
514 void keyPressed() {
515 if (mappingMode) {
516 mappingTool.keyPressed(uiMapping);
517 }
518 switch (key) {
519 case '1':
520 case '2':
521 case '3':
522 case '4':
523 case '5':
524 case '6':
525 case '7':
526 case '8':
527 if (!midiEngine.isQwertyEnabled()) {
528 presetManager.select(midiEngine.getFocusedDeck(), key - '1');
529 }
530 break;
531
532 case '!':
533 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 0);
534 break;
535 case '@':
536 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 1);
537 break;
538 case '#':
539 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 2);
540 break;
541 case '$':
542 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 3);
543 break;
544 case '%':
545 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 4);
546 break;
547 case '^':
548 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 5);
549 break;
550 case '&':
551 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 6);
552 break;
553 case '*':
554 if (!midiEngine.isQwertyEnabled()) presetManager.store(midiEngine.getFocusedDeck(), 7);
555 break;
556
557 case '-':
558 case '_':
559 frameRate(--targetFramerate);
560 break;
561 case '=':
562 case '+':
563 frameRate(++targetFramerate);
564 break;
565 case 'b':
566 effects.boom.trigger();
567 break;
568 case 'd':
569 if (!midiEngine.isQwertyEnabled()) {
570 debugMode = !debugMode;
571 println("Debug output: " + (debugMode ? "ON" : "OFF"));
572 }
573 break;
574 case 'm':
575 if (!midiEngine.isQwertyEnabled()) {
576 mappingMode = !mappingMode;
577 uiPatternA.setVisible(!mappingMode);
578 uiMapping.setVisible(mappingMode);
579 if (mappingMode) {
580 restoreToPattern = lx.getPattern();
581 lx.setPatterns(new LXPattern[] { mappingTool });
582 } else {
583 lx.setPatterns(patterns);
584 LXTransition pop = restoreToPattern.getTransition();
585 restoreToPattern.setTransition(null);
586 lx.goPattern(restoreToPattern);
587 restoreToPattern.setTransition(pop);
588 }
589 }
590 break;
591 case 't':
592 if (!midiEngine.isQwertyEnabled()) {
593 lx.engine.setThreaded(!lx.engine.isThreaded());
594 }
595 break;
596 case 'p':
597 for (PandaDriver p : pandaBoards) {
598 p.toggle();
599 }
600 break;
601 case 'q':
602 if (!midiEngine.isQwertyEnabled()) {
603 diagnosticsOn = !diagnosticsOn;
604 }
605 break;
606 case 's':
607 if (!midiEngine.isQwertyEnabled()) {
608 simulationOn = !simulationOn;
609 }
610 break;
611 case 'u':
612 if (!midiEngine.isQwertyEnabled()) {
613 uiOn = !uiOn;
614 }
615 break;
616 }
617 }
618
619 /**
620 * Top-level mouse event handling
621 */
622 int mx, my;
623 void mousePressed() {
624 boolean debugged = false;
625 if (debugMode) {
626 debugged = debugUI.mousePressed();
627 }
628 if (!debugged) {
629 for (UIContext context : overlays) {
630 context.mousePressed(mouseX, mouseY);
631 }
632 }
633 mx = mouseX;
634 my = mouseY;
635 }
636
637 void mouseDragged() {
638 boolean dragged = false;
639 for (UIContext context : overlays) {
640 dragged |= context.mouseDragged(mouseX, mouseY);
641 }
642 if (!dragged) {
643 int dx = mouseX - mx;
644 int dy = mouseY - my;
645 mx = mouseX;
646 my = mouseY;
647 eyeA += dx*.003;
648 eyeX = midX + eyeR*sin(eyeA);
649 eyeZ = midZ + eyeR*cos(eyeA);
650 eyeY += dy;
651 }
652 }
653
654 void mouseReleased() {
655 for (UIContext context : overlays) {
656 context.mouseReleased(mouseX, mouseY);
657 }
658 }
659
660 void mouseWheel(int delta) {
661 boolean wheeled = false;
662 for (UIContext context : overlays) {
663 wheeled |= context.mouseWheel(mouseX, mouseY, delta);
664 }
665
666 if (!wheeled) {
667 eyeR = constrain(eyeR - delta, -500, -80);
668 eyeX = midX + eyeR*sin(eyeA);
669 eyeZ = midZ + eyeR*cos(eyeA);
670 }
671 }