Skip to content

Instantly share code, notes, and snippets.

@mikesol
Created December 18, 2016 16:41
Show Gist options
  • Save mikesol/955dcdbdbc69b4d6aabe020727dbd91a to your computer and use it in GitHub Desktop.
Save mikesol/955dcdbdbc69b4d6aabe020727dbd91a to your computer and use it in GitHub Desktop.
La programmation réactive gère des évènements musicaux
currentSeq = tops[top] ? tops[top].scene || new EvSeq(new EventEmitter()) : currentSeq;
if (verb === states.STAGED || verb === states.SHIT) {
console.log("playing " + top);
if (verb === states.SHIT) {
// reset currentSeq
currentSeq.stop();
}
// TODO: figure out a way to unsubscribe observables...this will probably in a memory leak
Observable.fromEvent(tops[top].event || new EventEmitter(), 'sc')
.subscribe(function(msg) {
console.log("msg="+msg);
sc.server.send.msg(msg);
});
currentSeq.play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment