Pārlūkot izejas kodu

new commit

master
Victor Giers pirms 4 mēnešiem
vecāks
revīzija
7208035df0
8 mainītis faili ar 75 papildinājumiem un 32 dzēšanām
  1. 1
    1
      data/saves.sav
  2. Binārs
      data/sox.png
  3. Binārs
      data/sox.raw
  4. Binārs
      data/sox_sonified.raw
  5. 24
    3
      effects.pde
  6. 27
    8
      manglr2.pde
  7. 22
    19
      secondapplet.pde
  8. 1
    1
      source.pde

+ 1
- 1
data/saves.sav Parādīt failu

@@ -1,2 +1,2 @@
//globals
uptime = 118948355
uptime = 119045247

Binārs
data/sox.png Parādīt failu


Binārs
data/sox.raw Parādīt failu


Binārs
data/sox_sonified.raw Parādīt failu


+ 24
- 3
effects.pde Parādīt failu

@@ -7,7 +7,10 @@ boolean webcamRunning;
void startWebcam() {
String[] cameras = Capture.list();
println("Hi");
println(cameras);
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
//println(cameras);
cam.start();
webcamRunning = true;
}
@@ -18,12 +21,13 @@ void stopWebcam() {

class WEBCAM extends Shader {
PImage img;
int rw, rh, x, y, w, h, croptop, cropbottom, cropleft, cropright, contrast, brightness, hue, saturation;
int rw, rh, x, y, w, h, croptop, cropbottom, cropleft, cropright, contrast, brightness, hue, saturation, camSelected, camSelectedPrev;
final int[] blends = {BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN};
WEBCAM() {
rw = canvas.width;
rh = canvas.height;
name = "Webcam";
println(Capture.list().length);
img = createImage(rw, rh, ARGB);
if (!webcamRunning) startWebcam();
//params.add(new Param("mode", INTVAL, 0, 1, new int[]{RANDOM, SQUAR}));
@@ -40,6 +44,9 @@ class WEBCAM extends Shader {
params.add(new Param("hue", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("saturation", FLOATVAL, 0.0, 1.0, new int[]{TRIANG, SINE, RAMPUPDOWN }));
params.add(new Param("blend mode", INTVAL, 0, this.blends.length-1, new int[]{RANDOM }));
params.add(new Param("webcam", INTVAL, 0, Capture.list().length-1, new int[]{TRIANG, SINE, RAMPUPDOWN, }));
camSelected = (int)params.get(13).value;
camSelectedPrev = (int)params.get(13).value;
}
void apply() {
rw = canvas.width;
@@ -49,7 +56,21 @@ class WEBCAM extends Shader {
w = int(params.get(2).value*(rw*2));
h = int(params.get(3).value*(rh*2));

if(cam.available()) img = cam.get();

camSelected = (int)params.get(13).value;
/*
if (camSelected != camSelectedPrev) {
currentCam = camSelected;
camSelectedPrev = camSelected;
stopWebcam();
startWebcam();
//new Capture(this, 1920,1080, Capture.list()[camSelected]);
}*/



//params.get(13) //camera id
if (cam.available()) img = cam.get();
img = webcamImg.get();

canvas.beginDraw();

+ 27
- 8
manglr2.pde Parādīt failu

@@ -42,14 +42,24 @@ boolean autoPlay = false;
boolean videoRecord = false;
//boolean webcamMode = false;

//Capture[] cams;
//ArrayList<Capture> cams = new ArrayList<Capture>();

Capture cam;
String[] cameras;
int currentCam;

String[] params;



PImage droppedImage;
void dropEvent(DropEvent theDropEvent) {

sourceManager.importURI(theDropEvent.filePath());
}


SecondApplet gui;
PApplet mainApplet;
void setup() {
@@ -77,14 +87,22 @@ void setup() {
}
fallbackImage = loadImage(dataPath("0.png"));
bin = loadImage(dataPath("bin.png"));
String[] cameras = Capture.list();

cameras = Capture.list();
/*
for (int i = 0; i < cameras.length-1; i++) {
try {
cams.add(new Capture(this, 1920, 1080, cameras[i]));
}
catch(Exception e) {
println(e);
}
}
*/
cam = new Capture(this, 1920,1080, "pipeline:autovideosrc");
//falls du nicht mit mir in die oper möchtest gehe ich mit pe, sie hat morgen abend keine termine und würde sich natürlich in beiden fällen freuen. von ihr auch noch alles gute zum geburtstag hatte ich vergessen zu sagen.
//ich bin auch aufgeregt. vielleicht doch lieber mit dem zug. einfach versuchen sich einfach was zu gönnen. zu deinem schwarzen kleid ziehe ich
//cam = new Capture(this, 1920,1080, "Video Assist 5\" 3G");


OS = getOS();

String[] args = {"SecondFrame"};
@@ -104,6 +122,7 @@ void setup() {
PImage webcamImg;
void captureEvent(Capture c) {
c.read();
Capture cam = cams.get(currentCam);
webcamImg = cam.get();
}

@@ -146,7 +165,7 @@ void draw() {
fill(#ff0000);
ellipse(width-100, height-100, 30, 30);
}


if (recording) {

+ 22
- 19
secondapplet.pde Parādīt failu

@@ -63,12 +63,12 @@ public class SecondApplet extends PApplet {



/* webcam = cp5.addToggle("webcam")
.setPosition(100, height-65)
.setSize(12, 12)
.setValue(false)
.plugTo(this, "CP5_webcamAction");
webcam.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20);*/
/* webcam = cp5.addToggle("webcam")
.setPosition(100, height-65)
.setSize(12, 12)
.setValue(false)
.plugTo(this, "CP5_webcamAction");
webcam.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20);*/

Toggle robot = cp5.addToggle("autoPlay")
.setPosition(100, height-50)
@@ -102,16 +102,16 @@ public class SecondApplet extends PApplet {
startRobot = true;
autoPlay = !autoPlay;
}
/*
/*
void CP5_webcamAction()  {
webcamMode = !webcamMode;
if (webcamMode) sourceManager.startWebcam();
else {
sourceManager.stopWebcam();
source = null; //to trigger auto-fallback next frame
}
}
*/
webcamMode = !webcamMode;
if (webcamMode) sourceManager.startWebcam();
else {
sourceManager.stopWebcam();
source = null; //to trigger auto-fallback next frame
}
}
*/
void CP5_nativeResoAction() {
renderSize = max(nativeResoX, nativeResoY);
//renderer.setSize(nativeResoX, nativeResoY);
@@ -611,10 +611,13 @@ public class SecondApplet extends PApplet {

if (random(1)<0.01) {
int removeMe = int(random(shaderList.size()-1));
println("removing" + removeMe);
bricks.get(removeMe).press();
shaderManager.removeShader(removeMe);
pressedBrick = -1;
if ((removeMe == 0 && bricks.get(removeMe).name.equals("Webcam")) == false) {
println(bricks.get(removeMe).name);
println("removing" + removeMe);
bricks.get(removeMe).press();
shaderManager.removeShader(removeMe);
pressedBrick = -1;
}
}
}


+ 1
- 1
source.pde Parādīt failu

@@ -1,4 +1,4 @@
Capture cam;
Movie movie;
boolean moviePlaying, imageChanged;
PImage fallbackImage;

Notiek ielāde…
Atcelt
Saglabāt