-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathControls.pde
80 lines (76 loc) · 2.5 KB
/
Controls.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
78
79
80
import java.awt.Desktop;
void keyPressed() {
if (key=='z' || key=='Z') reverseZ = !reverseZ;
if (key=='d' || key=='D'){
if(!debug && debugDisplayMidi){ //if debug was turned off, show OSC screen first
debug = true;
debugDisplayMidi = false;
}else if(debug && !debugDisplayMidi){ //if already showing the OSC screen, switch to MIDI screen
debugDisplayMidi = true;
}else{
debugDisplayMidi = false;
debug = !debug;
}
}
if (keyCode==9){ //tab
debug = !debug;
}
if (key=='t' || key=='T') showTraces = !showTraces;
if (key=='m' || key=='M'){
sendMidi = !sendMidi;
if(sendMidi) debugDisplayMidi = true;
}
if (key=='o' || key=='O'){
sendOsc = !sendOsc;
if(sendOsc) debugDisplayMidi = false;
}
if (key=='f' || key=='F') openAppFolderHandler();
if(key=='r' || key=='R' || keyCode==33 || keyCode==34 || key==' '){ //pgup, pgdn
record = !record;
firstRun = false;
if(!record) openAppFolderHandler();
}
}
void openAppFolderHandler(){
if(System.getProperty("os.name").equals("Mac OS X")){
try{
print("Trying OS X Finder method.");
//open(sketchPath(""));
//String[] params = { };
Desktop.getDesktop().open(new File(sketchPath("data")));
Desktop.getDesktop().open(new File(sketchPath("ManosOsc.app/Contents/Resources/Java/data")));
Desktop.getDesktop().open(new File(sketchPath("ManosOsc_LM.app/Contents/Resources/Java/data")));
}catch(Exception e){ }
}else{
try{
print("Trying Windows Explorer method.");
Desktop.getDesktop().open(new File(sketchPath("") + "/data"));
}catch(Exception e){ }
}
}
//run at startup to account for different locations and OS conventions
void scriptsFolderHandler(){
String s = scriptsFilePath;
if(System.getProperty("os.name").equals("Mac OS X")){
try{
print("Trying OS X Finder method.");
//open(sketchPath(""));
//String[] params = { };
/*
File f = new File(dataPath("file.xml"));
if (!f.exists()) {
println("File does not exist");
}
*/
scriptsFilePath = dataPath("") + "/" + s;
//scriptsFilePath = sketchPath("data/" + s);
//scriptsFilePath = sketchPath("ManosOsc.app/Contents/Resources/Java/data/" + s);
//scriptsFilePath = sketchPath("ManosOsc_LM.app/Contents/Resources/Java/data/" + s);
}catch(Exception e){ }
}else{
try{
print("Trying Windows Explorer method.");
scriptsFilePath = sketchPath("") + "/data/" + s;
}catch(Exception e){ }
}
}