-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoEffectController.pde
77 lines (66 loc) · 1.87 KB
/
VideoEffectController.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
/*
VideoEffectController
Feature that adds filter to the Video image
*/
import ch.bildspur.postfx.builder.*;
import ch.bildspur.postfx.pass.*;
import ch.bildspur.postfx.*;
public class VideoEffectController extends Feature {
PostFX fx;
public float midiNoiseFactor = 0;
public float midiVigneteSize = 0;
public boolean midiSobelEnabled = false;
public float midiPixealte = height;
public float midiBrightPass = 0;
public VideoEffectController(PApplet applet, MidiInterface midi, int midiEnableFaderNumber) {
super(applet, midi, midiEnableFaderNumber);
}
public void setupFeature() {
fx = new PostFX(this.applet);
midi.registerForFaderValue(this, 52);
midi.registerForFaderValue(this, 53);
midi.registerForFaderValue(this, 51);
midi.registerForFaderValue(this, 50);
midi.registerForNoteValue(this, 16);
}
public void newFaderValue(int value, int number) {
if (number == 52) {
midiNoiseFactor = map(value, 0, 127, 0, 0.8);
}
if (number == 53) {
midiVigneteSize = map(value, 0, 127, 0, 1.5);
}
if (number == 51) {
midiBrightPass = map(value, 0, 127, 0, 1);
}
if (number == 50) {
midiPixealte = map(value, 0, 127, width/2, 1);
}
}
public void newNoteValue(int note) {
super.newNoteValue(note);
if (note == 16) {
midiSobelEnabled = !midiSobelEnabled;
this.midi.setControlLED(note, this.midiSobelEnabled);
}
}
public void featureGotEnabled() {
}
public void drawFeature(int currentTimeState) {
PostFXBuilder builder = fx.render();
if (this.midiNoiseFactor > 0) {
builder = builder.noise(midiNoiseFactor, 0.4);
}
if (this.midiPixealte < width/2) {
builder = builder.pixelate(midiPixealte);
}
if (this.midiBrightPass > 0) {
builder = builder.brightPass(midiBrightPass);
}
if (this.midiSobelEnabled) {
builder = builder.sobel();
}
builder = builder.vignette(midiVigneteSize, 0.4);
builder.compose();
}
}