| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>AudioLoader - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
- <h1 translate="no">AudioLoader</h1>
- <section>
- <header>
- <div class="class-description"><p>Class for loading audio buffers. Audios are internally
- loaded via <a href="FileLoader.html">FileLoader</a>.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const audioListener = new THREE.AudioListener();
- const ambientSound = new THREE.Audio( audioListener );
- const loader = new THREE.AudioLoader();
- const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' );
- ambientSound.setBuffer( audioBuffer );
- ambientSound.play();
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="AudioLoader" translate="no">new <a href="#AudioLoader">AudioLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new audio loader.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>manager</code></td>
- <td class="description last"><p>The loading manager.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type">onProgressCallback</span>, onError : <span class="param-type">onErrorCallback</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Starts loading from the given URL and passes the loaded audio buffer
- to the <code>onLoad()</code> callback.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>url</code></td>
- <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onLoad</code></td>
- <td class="description last"><p>Executed when the loading process has been finished.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onProgress</code></td>
- <td class="description last"><p>Executed while the loading is in progress.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onError</code></td>
- <td class="description last"><p>Executed when errors occur.</p></td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/loaders/AudioLoader.js" target="_blank" rel="noopener" translate="no">src/loaders/AudioLoader.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|