-
Notifications
You must be signed in to change notification settings - Fork 2
/
Synesthesia.js
49 lines (36 loc) · 1.27 KB
/
Synesthesia.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
module.declare("Synesthesia",
["Utilities", "Synesthesia:UI"],
function () {
var Utilities = module.require("Utilities");
var UI = module.require("Synesthesia:UI");
var Synesthesia = (function () {
function Synesthesia (params) {
this.params = (typeof params !== "undefined" ? params : {});
if (typeof Synesthesia.AudioContext === "undefined") {
throw new Error("Synesthesia: AudioContext not supported!");
}
this.context = new Synesthesia.AudioContext();
this.container = this.params.container;
this.UI = new UI({
synesthesia: this,
container: this.container
});
}
Synesthesia.requestAnimationFrame = (
window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : null ||
window.webkitRequestAnimationFrame ? window.webkitRequestAnimationFrame.bind(window) : null
);
Synesthesia.AudioContext = window.AudioContext || window.webkitAudioContext;
Synesthesia.prototype.getContext = function () {
return this.context;
};
Synesthesia.prototype.getDestination = function () {
return this.context.destination;
};
Synesthesia.prototype.getUI = function () {
return this.UI;
};
return Synesthesia;
})();
return Synesthesia;
});