-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35f7a9c
commit 5e68145
Showing
15 changed files
with
408 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<layers> | ||
<layer id="forest" nmt="violin.nmt"/> | ||
</layers> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package animata; | ||
|
||
import rwmidi.Controller; | ||
import rwmidi.MidiInput; | ||
import rwmidi.RWMidi; | ||
import microkontrol.controls.Button; | ||
|
||
public class FootController { | ||
public class FootSwitch { | ||
private int cc; | ||
public FootSwitch(int cc) { | ||
this.cc = cc; | ||
// all on channel 16 | ||
in.plug(this, "controllerChangeReceived",15); | ||
} | ||
public void controllerChangeReceived(Controller controller){ | ||
if(controller.getCC() == cc) button.press(); | ||
} | ||
public Button button = new Button(); | ||
|
||
} | ||
|
||
private static FootController instance; | ||
public static FootSwitch[] footSwitches; | ||
protected MidiInput in; | ||
public FootController(String inputName) { | ||
in = RWMidi.getInputDevice(inputName).createInput(); | ||
int[] ccs = {115,114,116,101,100}; | ||
footSwitches = new FootSwitch[ccs.length]; | ||
for (int i = 0; i < ccs.length; i++) { | ||
int cc = ccs[i]; | ||
footSwitches[i] = new FootSwitch(cc); | ||
|
||
} | ||
} | ||
|
||
public static FootController getInstance(){ | ||
if(instance == null) instance = new FootController("MIDI IN <MIn:3> KORG INC."); | ||
return instance; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package animata.controls; | ||
|
||
import microkontrol.MicroKontrol; | ||
import microkontrol.controls.FaderListener; | ||
import processing.xml.XMLElement; | ||
import rwmidi.MidiInput; | ||
import animata.model.Layer; | ||
|
||
public class LayerFader extends Control implements FaderListener { | ||
|
||
private String layer; | ||
|
||
public LayerFader(XMLElement element, MidiInput in) { | ||
super(element, in); | ||
layer = element.getStringAttribute("layer"); | ||
MicroKontrol.getInstance().faders[element.getIntAttribute("fader")].listen(this); | ||
Layer.setAlpha(layer,0f); | ||
} | ||
|
||
public void moved(Float value) { | ||
Layer.setAlpha(layer,value); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package animata.controls; | ||
|
||
import java.awt.event.KeyEvent; | ||
|
||
import animata.model.Layer; | ||
|
||
import processing.core.PApplet; | ||
import processing.xml.XMLElement; | ||
import rwmidi.MidiInput; | ||
|
||
public class LayerToggle extends Control { | ||
|
||
private static PApplet applet; | ||
|
||
private String layer; | ||
|
||
private char toggle; | ||
|
||
public LayerToggle(XMLElement element, MidiInput in) { | ||
super(element,in); | ||
toggle = element.getStringAttribute("key").charAt(0); | ||
layer = element.getStringAttribute("layer"); | ||
applet.registerKeyEvent(this); | ||
Layer.setVisibility(layer, false); // TODO confirm this is desirable default behaviour | ||
} | ||
public void keyEvent(KeyEvent key){ | ||
if(key.getKeyChar() == toggle && key.getID() == KeyEvent.KEY_PRESSED ){ | ||
System.out.println("toggling " + layer); | ||
Layer.toggle(layer); | ||
} | ||
} | ||
public static void init(PApplet theApplet) { | ||
applet = theApplet; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package test; | ||
|
||
import microkontrol.MicroKontrol; | ||
import microkontrol.controls.Button; | ||
import processing.core.PApplet; | ||
import animata.Animata; | ||
import animata.AnimataPlayback; | ||
import animata.FootController; | ||
|
||
public class CrazyLandscape extends PApplet { | ||
private AnimataPlayback playback; | ||
private MicroKontrol mk; | ||
|
||
public void setup() { | ||
size(950, 614, OPENGL); | ||
MicroKontrol.init(this); | ||
Animata.startOSC(this); | ||
playback = new AnimataPlayback(this); | ||
|
||
playback.loadSet("set.xml"); | ||
//playback.debug(); | ||
mk = MicroKontrol.getInstance(); | ||
FootController.getInstance().footSwitches[0].button.listen(Button.PRESSED, this, "doSomething"); | ||
} | ||
public void doSomething(){ | ||
System.out.println("Pressed the switch!"); | ||
} | ||
public void draw() { | ||
if (keyPressed) { | ||
if (keyCode == DOWN) playback.panCameraY(10); | ||
if (keyCode == UP) playback.panCameraY(-10); | ||
if (keyCode == LEFT) playback.panCameraX(-10); | ||
if (keyCode == RIGHT) playback.panCameraX(10); | ||
if( key == 'c') System.out.println("HASHS" + playback.camera); | ||
} | ||
playback.panCameraX(mk.joystick.getX() * 30); | ||
playback.zoomCamera(mk.joystick.getY() * 30); | ||
background(255); | ||
|
||
playback.draw(); | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
PApplet.main(new String[] { "--bgcolor=#c0c0c0", "TestScene" }); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters