OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #ifndef AudioContext_h | 25 #ifndef AudioContext_h |
26 #define AudioContext_h | 26 #define AudioContext_h |
27 | 27 |
28 #include "core/dom/ActiveDOMObject.h" | 28 #include "core/dom/ActiveDOMObject.h" |
| 29 #include "core/dom/DOMTypedArray.h" |
29 #include "core/events/EventListener.h" | 30 #include "core/events/EventListener.h" |
30 #include "modules/EventTargetModules.h" | 31 #include "modules/EventTargetModules.h" |
31 #include "modules/webaudio/AsyncAudioDecoder.h" | 32 #include "modules/webaudio/AsyncAudioDecoder.h" |
32 #include "modules/webaudio/AudioDestinationNode.h" | 33 #include "modules/webaudio/AudioDestinationNode.h" |
33 #include "platform/audio/AudioBus.h" | 34 #include "platform/audio/AudioBus.h" |
34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
35 #include "wtf/HashSet.h" | 36 #include "wtf/HashSet.h" |
36 #include "wtf/MainThread.h" | 37 #include "wtf/MainThread.h" |
37 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 virtual bool hasPendingActivity() const override; | 93 virtual bool hasPendingActivity() const override; |
93 | 94 |
94 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 95 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
95 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } | 96 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } |
96 double currentTime() const { return m_destinationNode->currentTime(); } | 97 double currentTime() const { return m_destinationNode->currentTime(); } |
97 float sampleRate() const { return m_destinationNode->sampleRate(); } | 98 float sampleRate() const { return m_destinationNode->sampleRate(); } |
98 | 99 |
99 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); | 100 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); |
100 | 101 |
101 // Asynchronous audio file data decoding. | 102 // Asynchronous audio file data decoding. |
102 void decodeAudioData(ArrayBuffer*, AudioBufferCallback*, AudioBufferCallback
*, ExceptionState&); | 103 void decodeAudioData(DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallb
ack*, ExceptionState&); |
103 | 104 |
104 AudioListener* listener() { return m_listener.get(); } | 105 AudioListener* listener() { return m_listener.get(); } |
105 | 106 |
106 // The AudioNode create methods are called on the main thread (from JavaScri
pt). | 107 // The AudioNode create methods are called on the main thread (from JavaScri
pt). |
107 AudioBufferSourceNode* createBufferSource(); | 108 AudioBufferSourceNode* createBufferSource(); |
108 MediaElementAudioSourceNode* createMediaElementSource(HTMLMediaElement*, Exc
eptionState&); | 109 MediaElementAudioSourceNode* createMediaElementSource(HTMLMediaElement*, Exc
eptionState&); |
109 MediaStreamAudioSourceNode* createMediaStreamSource(MediaStream*, ExceptionS
tate&); | 110 MediaStreamAudioSourceNode* createMediaStreamSource(MediaStream*, ExceptionS
tate&); |
110 MediaStreamAudioDestinationNode* createMediaStreamDestination(); | 111 MediaStreamAudioDestinationNode* createMediaStreamDestination(); |
111 GainNode* createGain(); | 112 GainNode* createGain(); |
112 BiquadFilterNode* createBiquadFilter(); | 113 BiquadFilterNode* createBiquadFilter(); |
113 WaveShaperNode* createWaveShaper(); | 114 WaveShaperNode* createWaveShaper(); |
114 DelayNode* createDelay(ExceptionState&); | 115 DelayNode* createDelay(ExceptionState&); |
115 DelayNode* createDelay(double maxDelayTime, ExceptionState&); | 116 DelayNode* createDelay(double maxDelayTime, ExceptionState&); |
116 PannerNode* createPanner(); | 117 PannerNode* createPanner(); |
117 ConvolverNode* createConvolver(); | 118 ConvolverNode* createConvolver(); |
118 DynamicsCompressorNode* createDynamicsCompressor(); | 119 DynamicsCompressorNode* createDynamicsCompressor(); |
119 AnalyserNode* createAnalyser(); | 120 AnalyserNode* createAnalyser(); |
120 ScriptProcessorNode* createScriptProcessor(ExceptionState&); | 121 ScriptProcessorNode* createScriptProcessor(ExceptionState&); |
121 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, ExceptionState
&); | 122 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, ExceptionState
&); |
122 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, size_t numberO
fInputChannels, ExceptionState&); | 123 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, size_t numberO
fInputChannels, ExceptionState&); |
123 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, size_t numberO
fInputChannels, size_t numberOfOutputChannels, ExceptionState&); | 124 ScriptProcessorNode* createScriptProcessor(size_t bufferSize, size_t numberO
fInputChannels, size_t numberOfOutputChannels, ExceptionState&); |
124 ChannelSplitterNode* createChannelSplitter(ExceptionState&); | 125 ChannelSplitterNode* createChannelSplitter(ExceptionState&); |
125 ChannelSplitterNode* createChannelSplitter(size_t numberOfOutputs, Exception
State&); | 126 ChannelSplitterNode* createChannelSplitter(size_t numberOfOutputs, Exception
State&); |
126 ChannelMergerNode* createChannelMerger(ExceptionState&); | 127 ChannelMergerNode* createChannelMerger(ExceptionState&); |
127 ChannelMergerNode* createChannelMerger(size_t numberOfInputs, ExceptionState
&); | 128 ChannelMergerNode* createChannelMerger(size_t numberOfInputs, ExceptionState
&); |
128 OscillatorNode* createOscillator(); | 129 OscillatorNode* createOscillator(); |
129 PeriodicWave* createPeriodicWave(Float32Array* real, Float32Array* imag, Exc
eptionState&); | 130 PeriodicWave* createPeriodicWave(DOMFloat32Array* real, DOMFloat32Array* ima
g, ExceptionState&); |
130 | 131 |
131 // When a source node has no more processing to do (has finished playing), t
hen it tells the context to dereference it. | 132 // When a source node has no more processing to do (has finished playing), t
hen it tells the context to dereference it. |
132 void notifyNodeFinishedProcessing(AudioNode*); | 133 void notifyNodeFinishedProcessing(AudioNode*); |
133 | 134 |
134 // Called at the start of each render quantum. | 135 // Called at the start of each render quantum. |
135 void handlePreRenderTasks(); | 136 void handlePreRenderTasks(); |
136 | 137 |
137 // Called at the end of each render quantum. | 138 // Called at the end of each render quantum. |
138 void handlePostRenderTasks(); | 139 void handlePostRenderTasks(); |
139 | 140 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 HashSet<AudioNode*> m_deferredCountModeChange; | 347 HashSet<AudioNode*> m_deferredCountModeChange; |
347 | 348 |
348 // This is considering 32 is large enough for multiple channels audio. | 349 // This is considering 32 is large enough for multiple channels audio. |
349 // It is somewhat arbitrary and could be increased if necessary. | 350 // It is somewhat arbitrary and could be increased if necessary. |
350 enum { MaxNumberOfChannels = 32 }; | 351 enum { MaxNumberOfChannels = 32 }; |
351 }; | 352 }; |
352 | 353 |
353 } // namespace blink | 354 } // namespace blink |
354 | 355 |
355 #endif // AudioContext_h | 356 #endif // AudioContext_h |
OLD | NEW |