OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2011 The Native Client Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can |
| 4 be found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 8 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 9 <html> |
| 10 <head> |
| 11 <META HTTP-EQUIV="Pragma" CONTENT="no-cache" /> |
| 12 <META HTTP-EQUIV="Expires" CONTENT="-1" /> |
| 13 <script type="text/javascript" src="nacltest.js"></script> |
| 14 <title>PPAPI Audio</title> |
| 15 </head> |
| 16 |
| 17 <body> |
| 18 <h1>Native Client PPAPI Audio</h1> |
| 19 <div id="attach"></div> |
| 20 <br />Verify that a 400Hz tone is emitted on the left channel.<br /> |
| 21 <br />Verify that a 1000Hz tone is emitted on the right |
| 22 channel.<br /> |
| 23 <br />Note: This example depends on your system supporting audio |
| 24 output.<br /> |
| 25 |
| 26 <script type="text/javascript"> |
| 27 //<![CDATA[ |
| 28 function setupTests(tester, plugin) { |
| 29 |
| 30 tester.addAsyncTest('TestPlayback', function(status) { |
| 31 // Register a message listener to receive test result. |
| 32 var messageListener = status.wrap(function(message) { |
| 33 status.log('Received message: ' + message.data); |
| 34 plugin.removeEventListener('message', messageListener, false); |
| 35 status.assertEqual(message.data, 'StopOutput:PASSED'); |
| 36 status.pass(); |
| 37 }); |
| 38 plugin.addEventListener("message", messageListener, false); |
| 39 |
| 40 // Tell the nexe to start playing audio. |
| 41 plugin.postMessage('StartPlayback'); |
| 42 }); |
| 43 } |
| 44 |
| 45 var playback; |
| 46 if (location.hash == "#mute") { |
| 47 playback = 'amplitude_l="0" amplitude_r="0" duration_msec="1000"' + |
| 48 'headless="1"'; |
| 49 } else { |
| 50 playback = 'amplitude_l="1" amplitude_r="1" duration_msec="10000"'; |
| 51 } |
| 52 var node = document.createElement('div'); |
| 53 node.innerHTML = '<embed id="naclModule" ' + |
| 54 'name="naclModule" ' + |
| 55 'width=0 height=0 ' + |
| 56 'src="ppapi_example_audio.nmf" ' + |
| 57 'basic_tests="1" ' + |
| 58 'stress_tests="0" ' + |
| 59 'style="background-color:gray" ' + |
| 60 'type="application/x-nacl" ' + |
| 61 playback + ' />'; |
| 62 document.getElementById('attach').appendChild(node); |
| 63 |
| 64 var tester = new Tester(); |
| 65 setupTests(tester, $('naclModule')); |
| 66 tester.waitFor($('naclModule')); |
| 67 tester.run(); |
| 68 //]]> |
| 69 </script> |
| 70 </body> |
| 71 </html> |
OLD | NEW |