-
Notifications
You must be signed in to change notification settings - Fork 13
/
OSC.control.js
58 lines (46 loc) · 1.2 KB
/
OSC.control.js
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
49
50
51
52
53
54
55
56
57
58
// Written by Jürgen Moßgraber - mossgrabers.de
// (c) 2014
// Licensed under GPLv3 - http://www.gnu.org/licenses/gpl.html
loadAPI (1);
load ("helper/ClassLoader.js");
load ("daw/ClassLoader.js");
load ("osc/ClassLoader.js");
load ("Config.js");
host.defineController ("Open Sound Control", "OSC", "1.1", "94DD41B0-EFEE-11E3-AC10-0800200C9A66");
host.defineMidiPorts (1, 0);
//var RECEIVE_HOST = '127.0.0.1';
var RECEIVE_HOST = '192.168.178.44';
var RECEIVE_PORT = 8000;
var SEND_HOST = '192.168.178.38';
//var SEND_HOST = '127.0.0.1';
var SEND_PORT = 9000;
var model = null;
var parser = null;
var writer = null;
String.prototype.getBytes = function ()
{
var bytes = [];
for (var i = 0; i < this.length; i++)
bytes.push (this.charCodeAt(i));
return bytes;
};
function init ()
{
var scales = new Scales (36, 100, 8, 8);
scales.setChromatic (true);
model = new Model (70, scales);
parser = new OSCParser (model, RECEIVE_HOST, RECEIVE_PORT);
writer = new OSCWriter (model, SEND_HOST, SEND_PORT);
scheduleTask (function ()
{
writer.flush (true);
}, null, 1000);
println ("Initialized.");
}
function exit ()
{
}
function flush ()
{
writer.flush ();
}