66
edits
Line 185: | Line 185: | ||
import ddf.minim.*; | import ddf.minim.*; | ||
Minim minim; | Minim minim; | ||
Line 208: | Line 207: | ||
PImage img; | PImage img; | ||
void setup() { | void setup() { | ||
Line 218: | Line 216: | ||
img = loadImage("parkhöhle.jpg"); | img = loadImage("parkhöhle.jpg"); | ||
for (int i = 0; i < n; i++) { | for (int i = 0; i < n; i++) { | ||
players[i] = minim.loadFile(“test-" + (i + 1) + ".mp3"); | players[i] = minim.loadFile(“test-" + (i + 1) + ".mp3"); | ||
} | |||
} | |||
} | } | ||
void draw() { | void draw() { | ||
Line 232: | Line 228: | ||
noStroke(); | noStroke(); | ||
activeLocation = -1; | |||
for(int i = 0; i < locations.length; i ++) { | |||
int[] loc = locations[i]; | |||
int x = loc[0]; | int x = loc[0]; | ||
int y = loc[1]; | int y = loc[1]; | ||
int r = loc[2]; | int r = loc[2]; | ||
if(atLocation(x, y, r)) { | if(atLocation(x, y, r)) { | ||
Line 251: | Line 244: | ||
fill(250, 0); | fill(250, 0); | ||
} | |||
} | |||
} | } | ||
boolean atLocation(int x, int y, int r) { | boolean atLocation(int x, int y, int r) { | ||
return mouseX > (x - r) && mouseX < (x + r) && mouseY > (y - r) && mouseY < (y + r); | return mouseX > (x - r) && mouseX < (x + r) && mouseY > (y - r) && mouseY < (y + r); | ||
} | } | ||
void mousePressed() { | void mousePressed() { | ||
if(activeLocation != -1) { | |||
for (int i = 0; i < n; i++) { | |||
players[i].pause();} | |||
println("Sound number " + (activeLocation + 1)); | println("Sound number " + (activeLocation + 1)); | ||
Line 279: | Line 266: | ||
} | } | ||
void keyPressed() { | void keyPressed() { | ||
for (int i = 0; i < n; i++) { | |||
players[i].pause(); | players[i].pause(); } | ||
int i = (key - '1'); | int i = (key - '1'); | ||
Line 295: | Line 279: | ||
players[i].rewind(); | players[i].rewind(); | ||
players[i].play(); | players[i].play(); | ||
} | } | ||
} | } | ||
void keyPressed() { | void keyPressed() { | ||
println(pmouseX, pmouseY); | println(pmouseX, pmouseY); | ||
} | } | ||
Line 309: | Line 290: | ||
---- | ---- | ||
=== My Final Project === | === My Final Project === |
edits