Last active
August 29, 2015 14:01
-
-
Save AxGord/6abf66967f15b76d4ac6 to your computer and use it in GitHub Desktop.
Use midi controllers for Code Snippets. Soft: Windows, Haxe, Pony, Nodejs, node-midi, Autohotkey. I'm use Automap/Launchpad. File name == midi code.
This file contains hidden or 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
Send, trace(); | |
Send, {Left} | |
Send, {Left} |
This file contains hidden or 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
Send, function(){SPACE} |
This file contains hidden or 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
import js.Node; | |
import pony.fs.Dir; | |
import pony.midi.MidiDevice; | |
class MidiCodeSnippets { | |
static function main() { | |
var midi = new MidiDevice(0); | |
for (u in new Dir('.').content()) if (u.isFile && u.file.ext == 'ahk') { | |
var n = Std.parseInt(u.file.name); | |
if (n != null) midi.on - n - 0 + u.file.name << run; | |
} | |
} | |
static function run(f:String):Void Node.child_process.exec(f, null, null); | |
} |
This file contains hidden or 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
import js.Node; | |
import pony.fs.File; | |
import pony.midi.MidiCode; | |
import pony.midi.MidiDevice; | |
//second way | |
class MidiCodeSnippets2 { | |
static function main() new MidiDevice(0).on.add(handler); | |
static function handler(key:MidiCode, velocity:MidiCode):Void { | |
if (velocity != 0) return; | |
var f = new File(key + '.ahk'); | |
if (!f.exists) return; | |
Node.child_process.exec(f.name, null, null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment