AudioListener.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. Create a non-positional ( global ) audio object.<br /><br />
  15. This uses the [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API].
  16. </div>
  17. <h2>Example</h2>
  18. <div>[example:misc_sound misc / sound ]</div>
  19. <code>
  20. //Create an AudioListener and add it to the camera
  21. var listener = new THREE.AudioListener();
  22. camera.add( listener );
  23. // create a global audio source
  24. var sound = new THREE.Audio( listener );
  25. var audioLoader = new THREE.AudioLoader();
  26. //Load a sound and set it as the Audio object's buffer
  27. audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
  28. sound.setBuffer( buffer );
  29. sound.setLoop(true);
  30. sound.setVolume(0.5);
  31. sound.play();
  32. });
  33. </code>
  34. <h2>Constructor</h2>
  35. <h3>[name]( )</h3>
  36. <div>
  37. Create a new AudioListener.
  38. </div>
  39. <h2>Properties</h2>
  40. <h3>[property:AudioContext context]</h3>
  41. <div>The [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext] of the [page:AudioListener listener] given in the constructor.</div>
  42. <h3>[property:GainNode gain]</h3>
  43. <div>A [link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode] created
  44. using [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]().</div>
  45. <h3>[property:AudioNode filter]</h3>
  46. <div>Default is *null*.</div>
  47. <h2>Methods</h2>
  48. <h3>[method:GainNode getInput]()</h3>
  49. <div>
  50. Return the [page:AudioListener.gain gainNode].
  51. </div>
  52. <h3>[method:null removeFilter]()</h3>
  53. <div>
  54. Set the [page:AudioListener.filter filter] property to *null*.
  55. </div>
  56. <h3>[method:AudioNode getFilter]()</h3>
  57. <div>
  58. Returns the value of the [page:AudioListener.filter filter] property.
  59. </div>
  60. <h3>[method:null setFilter]( [page:AudioNode value] )</h3>
  61. <div>
  62. Set the [page:AudioListener.filter filter] property to *value*.
  63. </div>
  64. <h3>[method:Number getMasterVolume]()</h3>
  65. <div>
  66. Return the volume.
  67. </div>
  68. <h3>[method:null setMasterVolume]( [page:Number value] )</h3>
  69. <div>
  70. Set the volume.
  71. </div>
  72. <h2>Source</h2>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </body>
  75. </html>