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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class AnalyserNode; | 50 class AnalyserNode; |
51 class AudioBuffer; | 51 class AudioBuffer; |
52 class AudioBufferCallback; | 52 class AudioBufferCallback; |
53 class AudioBufferSourceNode; | 53 class AudioBufferSourceNode; |
54 class AudioListener; | 54 class AudioListener; |
55 class AudioSummingJunction; | 55 class AudioSummingJunction; |
56 class BiquadFilterNode; | 56 class BiquadFilterNode; |
57 class ChannelMergerNode; | 57 class ChannelMergerNode; |
58 class ChannelSplitterNode; | 58 class ChannelSplitterNode; |
59 class ConvolverNode; | 59 class ConvolverNode; |
| 60 class DecodeAudioDataOptions; |
60 class DelayNode; | 61 class DelayNode; |
61 class Dictionary; | 62 class Dictionary; |
62 class Document; | 63 class Document; |
63 class DynamicsCompressorNode; | 64 class DynamicsCompressorNode; |
64 class ExceptionState; | 65 class ExceptionState; |
65 class GainNode; | 66 class GainNode; |
66 class HTMLMediaElement; | 67 class HTMLMediaElement; |
67 class IIRFilterNode; | 68 class IIRFilterNode; |
68 class MediaElementAudioSourceNode; | 69 class MediaElementAudioSourceNode; |
69 class MediaStreamAudioDestinationNode; | 70 class MediaStreamAudioDestinationNode; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 float sampleRate() const { return m_destinationNode ? m_destinationNode->han
dler().sampleRate() : 0; } | 135 float sampleRate() const { return m_destinationNode ? m_destinationNode->han
dler().sampleRate() : 0; } |
135 | 136 |
136 String state() const; | 137 String state() const; |
137 AudioContextState contextState() const { return m_contextState; } | 138 AudioContextState contextState() const { return m_contextState; } |
138 void throwExceptionForClosedState(ExceptionState&); | 139 void throwExceptionForClosedState(ExceptionState&); |
139 | 140 |
140 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); | 141 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); |
141 | 142 |
142 // Asynchronous audio file data decoding. | 143 // Asynchronous audio file data decoding. |
143 ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer* audioData, Audio
BufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionSt
ate&); | 144 ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer* audioData, Audio
BufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionSt
ate&); |
| 145 ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer* audioData, const
DecodeAudioDataOptions&, ExceptionState&); |
144 | 146 |
145 // Handles the promise and callbacks when |decodeAudioData| is finished deco
ding. | 147 // Handles the promise and callbacks when |decodeAudioData| is finished deco
ding. |
146 void handleDecodeAudioData(AudioBuffer*, ScriptPromiseResolver*, AudioBuffer
Callback* successCallback, AudioBufferCallback* errorCallback); | 148 void handleDecodeAudioData(AudioBuffer*, ScriptPromiseResolver*, AudioBuffer
Callback* successCallback, AudioBufferCallback* errorCallback); |
147 | 149 |
148 AudioListener* listener() { return m_listener; } | 150 AudioListener* listener() { return m_listener; } |
149 | 151 |
150 virtual bool hasRealtimeConstraint() = 0; | 152 virtual bool hasRealtimeConstraint() = 0; |
151 | 153 |
152 // The AudioNode create methods are called on the main thread (from JavaScri
pt). | 154 // The AudioNode create methods are called on the main thread (from JavaScri
pt). |
153 AudioBufferSourceNode* createBufferSource(ExceptionState&); | 155 AudioBufferSourceNode* createBufferSource(ExceptionState&); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 295 |
294 void setClosedContextSampleRate(float newSampleRate) { m_closedContextSample
Rate = newSampleRate; } | 296 void setClosedContextSampleRate(float newSampleRate) { m_closedContextSample
Rate = newSampleRate; } |
295 float closedContextSampleRate() const { return m_closedContextSampleRate; } | 297 float closedContextSampleRate() const { return m_closedContextSampleRate; } |
296 | 298 |
297 void rejectPendingDecodeAudioDataResolvers(); | 299 void rejectPendingDecodeAudioDataResolvers(); |
298 | 300 |
299 private: | 301 private: |
300 bool m_isCleared; | 302 bool m_isCleared; |
301 void clear(); | 303 void clear(); |
302 | 304 |
| 305 ScriptPromise decodeAudioData( |
| 306 ScriptState*, |
| 307 DOMArrayBuffer* audioData, |
| 308 bool disableResampling, |
| 309 AudioBufferCallback* successCallback, |
| 310 AudioBufferCallback* errorCallback, |
| 311 ExceptionState&); |
| 312 |
303 // When the context goes away, there might still be some sources which | 313 // When the context goes away, there might still be some sources which |
304 // haven't finished playing. Make sure to release them here. | 314 // haven't finished playing. Make sure to release them here. |
305 void releaseActiveSourceNodes(); | 315 void releaseActiveSourceNodes(); |
306 | 316 |
307 void removeFinishedSourceNodes(); | 317 void removeFinishedSourceNodes(); |
308 | 318 |
309 // Listener for the PannerNodes | 319 // Listener for the PannerNodes |
310 Member<AudioListener> m_listener; | 320 Member<AudioListener> m_listener; |
311 | 321 |
312 // Only accessed in the audio thread. | 322 // Only accessed in the audio thread. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 Member<PeriodicWave> m_periodicWaveTriangle; | 383 Member<PeriodicWave> m_periodicWaveTriangle; |
374 | 384 |
375 // This is considering 32 is large enough for multiple channels audio. | 385 // This is considering 32 is large enough for multiple channels audio. |
376 // It is somewhat arbitrary and could be increased if necessary. | 386 // It is somewhat arbitrary and could be increased if necessary. |
377 enum { MaxNumberOfChannels = 32 }; | 387 enum { MaxNumberOfChannels = 32 }; |
378 }; | 388 }; |
379 | 389 |
380 } // namespace blink | 390 } // namespace blink |
381 | 391 |
382 #endif // BaseAudioContext_h | 392 #endif // BaseAudioContext_h |
OLD | NEW |