Last change
on this file since 28388 was 28388, checked in by davidb, 11 years ago |
Set of JS, CSS, PNG etc web resources to support a mixture of audio player/document display capabilities
|
File size:
680 bytes
|
Line | |
---|
1 | <!DOCTYPE html>
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <script src="../sink-light.js"></script>
|
---|
5 | <script>
|
---|
6 | (function(){
|
---|
7 |
|
---|
8 | var noise = new Float32Array(100000),
|
---|
9 | dev;
|
---|
10 |
|
---|
11 | for (dev=0; dev<noise.length; dev+=2){
|
---|
12 | noise[dev] = noise[dev+1] = Math.random() * 0.3;
|
---|
13 | }
|
---|
14 |
|
---|
15 | window.onload = function(){
|
---|
16 | dev = Sink();
|
---|
17 |
|
---|
18 | dev.on('error', function(e){
|
---|
19 | console.error(e);
|
---|
20 | });
|
---|
21 | };
|
---|
22 |
|
---|
23 | window.sync = function(){
|
---|
24 | dev.writeBufferSync(noise);
|
---|
25 | };
|
---|
26 |
|
---|
27 | window.async = function(){
|
---|
28 | dev.writeBufferAsync(noise, +document.getElementById('d').value);
|
---|
29 | };
|
---|
30 |
|
---|
31 | }());
|
---|
32 |
|
---|
33 | </script>
|
---|
34 | </head>
|
---|
35 | <body>
|
---|
36 | <button onclick="async()">Async</button> <input id="d" placeholder="Async delay"> <br/>
|
---|
37 | <button onclick="sync()">Sync</button>
|
---|
38 | </body>
|
---|
39 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.