| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Audio - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → </p>
- <h1 translate="no">Audio</h1>
- <section>
- <header>
- <div class="class-description"><p>Represents a non-positional ( global ) audio object.</p>
- <p>This and related audio modules make use of the <a href="https://www.w3.org/TR/webaudio-1.1/" target="_blank" rel="noopener">Web Audio API</a>.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">// create an AudioListener and add it to the camera
- const listener = new THREE.AudioListener();
- camera.add( listener );
- // create a global audio source
- const sound = new THREE.Audio( listener );
- // load a sound and set it as the Audio object's buffer
- const audioLoader = new THREE.AudioLoader();
- audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
- sound.setBuffer( buffer );
- sound.setLoop( true );
- sound.setVolume( 0.5 );
- sound.play();
- });
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="Audio" translate="no">new <a href="#Audio">Audio</a><span class="signature">( listener : <span class="param-type"><a href="AudioListener.html">AudioListener</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new audio.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>listener</strong>
- </td>
- <td class="description last">
- <p>The global audio listener.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="autoplay" translate="no">.<a href="#autoplay">autoplay</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether to start playback automatically or not.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="buffer" translate="no">.<a href="#buffer">buffer</a><span class="type-signature"> : AudioBuffer</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>A reference to an audio buffer.</p>
- <p>Defined via <a href="Audio.html#setBuffer">Audio#setBuffer</a>.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="context" translate="no">.<a href="#context">context</a><span class="type-signature"> : <a href="AudioContext.html">AudioContext</a></span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>The audio context.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="detune" translate="no">.<a href="#detune">detune</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Modify pitch, measured in cents. +/- 100 is a semitone.
- +/- 1200 is an octave.</p>
- <p>Defined via <a href="Audio.html#setDetune">Audio#setDetune</a>.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="duration" translate="no">.<a href="#duration">duration</a><span class="type-signature"> : undefined | number</span> </h3>
- <div class="description">
- <p>Overrides the default duration of the audio.</p>
- <p>Default is <code>undefined</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="filters" translate="no">.<a href="#filters">filters</a><span class="type-signature"> : Array.<AudioNode></span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Can be used to apply a variety of low-order filters to create
- more complex sound effects e.g. via <code>BiquadFilterNode</code>.</p>
- <p>The property is automatically set by <a href="Audio.html#setFilters">Audio#setFilters</a>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="gain" translate="no">.<a href="#gain">gain</a><span class="type-signature"> : GainNode</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>The gain node used for volume control.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="hasPlaybackControl" translate="no">.<a href="#hasPlaybackControl">hasPlaybackControl</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Indicates whether the audio playback can be controlled
- with method like <a href="Audio.html#play">Audio#play</a> or <a href="Audio.html#pause">Audio#pause</a>.</p>
- <p>This flag will be automatically set when audio sources are
- defined.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isPlaying" translate="no">.<a href="#isPlaying">isPlaying</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Indicates whether the audio is playing or not.</p>
- <p>This flag will be automatically set when using <a href="Audio.html#play">Audio#play</a>,
- <a href="Audio.html#pause">Audio#pause</a>, <a href="Audio.html#stop">Audio#stop</a>.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="listener" translate="no">.<a href="#listener">listener</a><span class="type-signature"> : <a href="AudioListener.html">AudioListener</a></span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>The global audio listener.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="loop" translate="no">.<a href="#loop">loop</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Whether the audio should loop or not.</p>
- <p>Defined via <a href="Audio.html#setLoop">Audio#setLoop</a>.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="loopEnd" translate="no">.<a href="#loopEnd">loopEnd</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Defines where in the audio buffer the replay should
- stop, in seconds.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="loopStart" translate="no">.<a href="#loopStart">loopStart</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Defines where in the audio buffer the replay should
- start, in seconds.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="offset" translate="no">.<a href="#offset">offset</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>An offset to the time within the audio buffer the playback
- should begin, in seconds.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="playbackRate" translate="no">.<a href="#playbackRate">playbackRate</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>The playback speed.</p>
- <p>Defined via <a href="Audio.html#setPlaybackRate">Audio#setPlaybackRate</a>.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="source" translate="no">.<a href="#source">source</a><span class="type-signature"> : AudioNode</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Holds a reference to the current audio source.</p>
- <p>The property is automatically by one of the <code>set*()</code> methods.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="sourceType" translate="no">.<a href="#sourceType">sourceType</a><span class="type-signature"> : 'empty' | 'audioNode' | 'mediaNode' | 'mediaStreamNode' | 'buffer'</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Defines the source type.</p>
- <p>The property is automatically set by one of the <code>set*()</code> methods.</p>
- <p>Default is <code>'empty'</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="connect" translate="no">.<a href="#connect">connect</a><span class="signature">()</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Connects to the audio source. This is used internally on
- initialisation and when setting / removing filters.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="disconnect" translate="no">.<a href="#disconnect">disconnect</a><span class="signature">()</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Disconnects to the audio source. This is used internally on
- initialisation and when setting / removing filters.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getDetune" translate="no">.<a href="#getDetune">getDetune</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the detuning of oscillation in cents.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The detuning of oscillation in cents.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFilter" translate="no">.<a href="#getFilter">getFilter</a><span class="signature">()</span><span class="type-signature"> : AudioNode | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the first filter in the list of filters.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The first filter in the list of filters.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFilters" translate="no">.<a href="#getFilters">getFilters</a><span class="signature">()</span><span class="type-signature"> : Array.<AudioNode></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the current set filters.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The list of filters.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getLoop" translate="no">.<a href="#getLoop">getLoop</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the loop flag.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the audio should loop or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getOutput" translate="no">.<a href="#getOutput">getOutput</a><span class="signature">()</span><span class="type-signature"> : GainNode</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the output audio node.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The output node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getPlaybackRate" translate="no">.<a href="#getPlaybackRate">getPlaybackRate</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the current playback rate.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The playback rate.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getVolume" translate="no">.<a href="#getVolume">getVolume</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the volume.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The volume.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="onEnded" translate="no">.<a href="#onEnded">onEnded</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Automatically called when playback finished.</p>
- </div>
- </div>
- <h3 class="name name-method" id="pause" translate="no">.<a href="#pause">pause</a><span class="signature">()</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Pauses the playback of the audio.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="play" translate="no">.<a href="#play">play</a><span class="signature">( delay : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Starts the playback of the audio.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>delay</strong>
- </td>
- <td class="description last">
- <p>The delay, in seconds, at which the audio should start playing.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setBuffer" translate="no">.<a href="#setBuffer">setBuffer</a><span class="signature">( audioBuffer : <span class="param-type">AudioBuffer</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given audio buffer as the source of this instance.</p>
- <p><a href="Audio.html#sourceType">Audio#sourceType</a> is set to <code>buffer</code> and <a href="Audio.html#hasPlaybackControl">Audio#hasPlaybackControl</a> to <code>true</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>audioBuffer</strong>
- </td>
- <td class="description last">
- <p>The audio buffer.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setDetune" translate="no">.<a href="#setDetune">setDetune</a><span class="signature">( value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Defines the detuning of oscillation in cents.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The detuning of oscillation in cents.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFilter" translate="no">.<a href="#setFilter">setFilter</a><span class="signature">( filter : <span class="param-type">AudioNode</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Applies a single filter node to the audio.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>filter</strong>
- </td>
- <td class="description last">
- <p>The filter to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFilters" translate="no">.<a href="#setFilters">setFilters</a><span class="signature">( value : <span class="param-type">Array.<AudioNode></span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets an array of filters and connects them with the audio source.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>A list of filters.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setLoop" translate="no">.<a href="#setLoop">setLoop</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the loop flag.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>Whether the audio should loop or not.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setLoopEnd" translate="no">.<a href="#setLoopEnd">setLoopEnd</a><span class="signature">( value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the loop end value which defines where in the audio buffer the replay should
- stop, in seconds.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The loop end value.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setLoopStart" translate="no">.<a href="#setLoopStart">setLoopStart</a><span class="signature">( value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the loop start value which defines where in the audio buffer the replay should
- start, in seconds.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The loop start value.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setMediaElementSource" translate="no">.<a href="#setMediaElementSource">setMediaElementSource</a><span class="signature">( mediaElement : <span class="param-type">HTMLMediaElement</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given media element as the source of this instance.</p>
- <p><a href="Audio.html#sourceType">Audio#sourceType</a> is set to <code>mediaNode</code> and <a href="Audio.html#hasPlaybackControl">Audio#hasPlaybackControl</a> to <code>false</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>mediaElement</strong>
- </td>
- <td class="description last">
- <p>The media element.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setMediaStreamSource" translate="no">.<a href="#setMediaStreamSource">setMediaStreamSource</a><span class="signature">( mediaStream : <span class="param-type">MediaStream</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given media stream as the source of this instance.</p>
- <p><a href="Audio.html#sourceType">Audio#sourceType</a> is set to <code>mediaStreamNode</code> and <a href="Audio.html#hasPlaybackControl">Audio#hasPlaybackControl</a> to <code>false</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>mediaStream</strong>
- </td>
- <td class="description last">
- <p>The media stream.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setNodeSource" translate="no">.<a href="#setNodeSource">setNodeSource</a><span class="signature">( audioNode : <span class="param-type">AudioNode</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given audio node as the source of this instance.</p>
- <p><a href="Audio.html#sourceType">Audio#sourceType</a> is set to <code>audioNode</code> and <a href="Audio.html#hasPlaybackControl">Audio#hasPlaybackControl</a> to <code>false</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>audioNode</strong>
- </td>
- <td class="description last">
- <p>The audio node like an instance of <code>OscillatorNode</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setPlaybackRate" translate="no">.<a href="#setPlaybackRate">setPlaybackRate</a><span class="signature">( value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the playback rate.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The playback rate to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setVolume" translate="no">.<a href="#setVolume">setVolume</a><span class="signature">( value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the volume.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The volume to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="stop" translate="no">.<a href="#stop">stop</a><span class="signature">( delay : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Audio.html">Audio</a> | undefined</span> </h3>
- <div class="method">
- <div class="description">
- <p>Stops the playback of the audio.</p>
- <p>Can only be used with compatible audio sources that allow playback control.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>delay</strong>
- </td>
- <td class="description last">
- <p>The delay, in seconds, at which the audio should stop playing.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/audio/Audio.js" translate="no" target="_blank" rel="noopener">src/audio/Audio.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|