forked from 2bbb/node-abletonlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (24 loc) · 702 Bytes
/
index.js
File metadata and controls
27 lines (24 loc) · 702 Bytes
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
const nbind = require('nbind');
const binding = nbind.init(__dirname);
const lib = binding.lib;
lib.AbletonLink.prototype.startUpdate = function(interval_ms, callback) {
this.update();
if(callback) {
this.timer = setInterval(() => {
this.update();
callback(this.beat, this.phase, this.bpm);
}, interval_ms);
callback(this.beat, this.phase, this.bpm);
} else {
this.timer = setInterval(() => {
this.update();
}, interval_ms);
}
};
lib.AbletonLink.prototype.stopUpdate = function() {
if(this.timer) {
clearInterval(this.timer);
this.timer = null;
}
}
module.exports = lib.AbletonLink;