-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio-buffer.html
50 lines (48 loc) · 1.13 KB
/
audio-buffer.html
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
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="audio-buffer">
<script>Polymer((function static(){
const sfx = window["::sfx::"];
const METHODS = {
getChannelData:{
value:function(){
this.node.getChannelData();
return this;
}
},
copyFromChannel:{
value:function(){
this.node.copyFromChannel();
return this;
}
},
copyToChannel:{
value:function(){
this.node.copyToChannel();
return this;
}
},
};
const PROTOTYPE = {
publish:{
channels:2,
length:sfx.sampleRate * 2,
sampleRate:sfx.sampleRate,
},
observe:{
"channels":"createBuffer",
"length":"createBuffer",
"sampleRate":"createBuffer",
},
created:function(){
this.createBuffer();
},
createBuffer:function(){
this.node = sfx.createBuffer(this.channels,this.length,this.sampleRate);
},
};
Object.defineProperties(PROTOTYPE,METHODS);
return PROTOTYPE;
})());
/*
*/</script>
</polymer-element>