-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmidisender.js
More file actions
48 lines (38 loc) · 848 Bytes
/
midisender.js
File metadata and controls
48 lines (38 loc) · 848 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var exec = require('cordova/exec');
var MIDISender = function() {};
// -----
/**
* @param {number} channelNum 0-15
* @param {number} programNum 1-128
* @return {void}
*/
MIDISender.sendProgramChange = function(channelNum, programNum)
{
// add 192 for the 192-207 program change range
channelNum = parseInt(channelNum) + 192;
exec(function(){}, function(){}, "MIDISender", "sendProgramChange", [channelNum, programNum]);
};
// -----
/**
* @param {function} callback
* @return {void}
*/
MIDISender.getIncoming = function(callback)
{
exec(
function(data)
{
if(angular.isObject(data) && angular.isDefined(data.channel))
{
data.channel = parseInt(data.channel) - 192;
callback.call(this, data);
}
},
function() {},
"MIDISender",
"getIncoming",
{}
);
};
// -----
module.exports = MIDISender;