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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<html>
<head>
<script type="text/javascript" src="/code/jquery.js"></script>
<script type="text/javascript" src="../base/base.js"></script>
<script type="text/javascript">
window.app = new CSApplication(
{
csdUrl: "timeline.csd",
files: ["test.mp3"],
onPlay: function () {
$("#start").hide();
runTest();
}
}
);
function toggle(target, channel, multiplier) {
var item = new Nexus.Toggle(target);
item.on("change", function(v) {
app.setControlChannel(channel, (v ? 1 : 0) * multiplier);
});
}
function slider(target, channel, multiplier) {
var item = new Nexus.Slider(target);
item.on("change", function(v) {
app.setControlChannel(channel, v * multiplier);
});
}
function dial(target, channel, multiplier) {
var item = new Nexus.Dial(target);
item.on("change", function(v) {
app.setControlChannel(channel, v * multiplier);
});
}
function makeRow(tbody, name, text, widgetType, multiplier) {
var row = $("<tr />");
for (var x = 0; x < 4; x++) {
var id = name + (x + 1);
var cell = $("<td />").appendTo(row);
var widget = $("<div />").attr("id", id).appendTo(cell);
var label = $("<div />").text(text).appendTo(cell);
}
tbody.append(row);
for (var x = 0; x < 4; x++) {
var id = name + (x + 1);
widgetType("#" + id, id, multiplier);
}
}
function makeMixer() {
var maxeq = 2;
var maxsend = 2;
var maxamp = 1.5;
var items = {
compmodel: ["Component model", toggle, 1],
lowcut: ["Low cut", toggle, 1],
eqhigh: ["EQ high", dial, maxeq],
eqmid: ["EQ mid", dial, maxeq],
eqlow: ["EQ low", dial, maxeq],
auxA: ["Aux 1", dial, maxsend],
preA: ["Aux 1 prefade", toggle, 1],
auxB: ["Aux 2", dial, maxsend],
preB: ["Aux 2 prefade", toggle, 1],
auxC: ["Aux 3", dial, maxsend],
preC: ["Aux 3 prefade", toggle, 1],
auxD: ["Aux 4", dial, maxsend],
preD: ["Aux 4 prefade", toggle, 1],
gain: ["Gain", dial, 1.5],
};
var tbl = $("<table />").appendTo($("#mixer"));
var tbody = $("<tbody />").appendTo(tbl);
for (var k in items) {
makeRow(tbody, k, items[k][0], items[k][1], items[k][2]);
}
}
$(function() {
$("#start").click(function() {
app.play();
});
$("#callback").click(function() {
var cbid = app.createCallback(function(data) {
$("#callback_response").text("Response from CBID " + data.cbid);
});
app.insertScore("cbtest", [0, 1, cbid]);
});
});
</script>
</head>
<body>
<button id="start">Start</button>
<!--<button id="callback">Callback test</button>
<div id="callback_response"></div>
-->
<div id="mixer"></div>
</body>
</html>
|