-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoRecorder.pde
68 lines (52 loc) · 1.54 KB
/
VideoRecorder.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
/*
VideoRecorder
Feature that records the complete video as a file
Currently disabled due to performance problems
*/
import java.util.Date;
import com.hamoid.*;
import ddf.minim.*;
public class VideoRecorder extends Feature {
VideoExport videoExport;
private boolean recorderEnabled = false;
private boolean armBlinkState = false;
AudioRecorder recorder;
public VideoRecorder(PApplet applet, MidiInterface midi, int midiEnableFaderNumber) {
super(applet, midi, midiEnableFaderNumber);
}
public void setupFeature() {
}
public void featureGotEnabled() {
Date d = new Date();
String filename = String.valueOf(d.getTime());
AudioInput in = currentAudioSource.audioInput;
recorder = minim.createRecorder(in, filename+".wav");
recorder.beginRecord();
videoExport = new VideoExport(this.applet);
videoExport.setMovieFileName(filename+".mp4");
videoExport.setQuality(35, 128);
//videoExport.setDebugging(false);
videoExport.startMovie();
recorderEnabled = true;
}
public void featureGotDisabled() {
videoExport.endMovie();
recorder.endRecord();
recorder.save();
recorderEnabled = false;
}
public void newFaderValue(int value, int number) {
}
public void drawFeature(int currentTimeState) {
if (recorderEnabled) {
videoExport.saveFrame();
}
if (recorderEnabled && (currentTimeState % 10) == 0) {
armBlinkState = !armBlinkState;
}
midiInterface.setControlLED(midiEnableFaderNumber, armBlinkState);
}
public void newNoteValue(int note) {
super.newNoteValue(note);
}
}