| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 { | 128 { |
| 129 // TODO: What is the correct value for the current time if the destinati
on node has gone | 129 // TODO: What is the correct value for the current time if the destinati
on node has gone |
| 130 // away? 0 is a valid time. | 130 // away? 0 is a valid time. |
| 131 return m_destinationNode ? m_destinationNode->audioDestinationHandler().
currentTime() : 0; | 131 return m_destinationNode ? m_destinationNode->audioDestinationHandler().
currentTime() : 0; |
| 132 } | 132 } |
| 133 | 133 |
| 134 float sampleRate() const { return m_destinationNode ? m_destinationNode->han
dler().sampleRate() : 0; } | 134 float sampleRate() const { return m_destinationNode ? m_destinationNode->han
dler().sampleRate() : 0; } |
| 135 | 135 |
| 136 String state() const; | 136 String state() const; |
| 137 AudioContextState contextState() const { return m_contextState; } | 137 AudioContextState contextState() const { return m_contextState; } |
| 138 void throwExceptionForClosedState(ExceptionState&); |
| 138 | 139 |
| 139 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); | 140 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); |
| 140 | 141 |
| 141 // Asynchronous audio file data decoding. | 142 // Asynchronous audio file data decoding. |
| 142 ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer* audioData, Audio
BufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionSt
ate&); | 143 ScriptPromise decodeAudioData(ScriptState*, DOMArrayBuffer* audioData, Audio
BufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionSt
ate&); |
| 143 | 144 |
| 144 // Handles the promise and callbacks when |decodeAudioData| is finished deco
ding. | 145 // Handles the promise and callbacks when |decodeAudioData| is finished deco
ding. |
| 145 void handleDecodeAudioData(AudioBuffer*, ScriptPromiseResolver*, AudioBuffer
Callback* successCallback, AudioBufferCallback* errorCallback); | 146 void handleDecodeAudioData(AudioBuffer*, ScriptPromiseResolver*, AudioBuffer
Callback* successCallback, AudioBufferCallback* errorCallback); |
| 146 | 147 |
| 147 AudioListener* listener() { return m_listener; } | 148 AudioListener* listener() { return m_listener; } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 287 |
| 287 void setClosedContextSampleRate(float newSampleRate) { m_closedContextSample
Rate = newSampleRate; } | 288 void setClosedContextSampleRate(float newSampleRate) { m_closedContextSample
Rate = newSampleRate; } |
| 288 float closedContextSampleRate() const { return m_closedContextSampleRate; } | 289 float closedContextSampleRate() const { return m_closedContextSampleRate; } |
| 289 | 290 |
| 290 void rejectPendingDecodeAudioDataResolvers(); | 291 void rejectPendingDecodeAudioDataResolvers(); |
| 291 | 292 |
| 292 private: | 293 private: |
| 293 bool m_isCleared; | 294 bool m_isCleared; |
| 294 void clear(); | 295 void clear(); |
| 295 | 296 |
| 296 void throwExceptionForClosedState(ExceptionState&); | |
| 297 | |
| 298 // When the context goes away, there might still be some sources which | 297 // When the context goes away, there might still be some sources which |
| 299 // haven't finished playing. Make sure to release them here. | 298 // haven't finished playing. Make sure to release them here. |
| 300 void releaseActiveSourceNodes(); | 299 void releaseActiveSourceNodes(); |
| 301 | 300 |
| 302 void removeFinishedSourceNodes(); | 301 void removeFinishedSourceNodes(); |
| 303 | 302 |
| 304 // Listener for the PannerNodes | 303 // Listener for the PannerNodes |
| 305 Member<AudioListener> m_listener; | 304 Member<AudioListener> m_listener; |
| 306 | 305 |
| 307 // Only accessed in the audio thread. | 306 // Only accessed in the audio thread. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 Member<PeriodicWave> m_periodicWaveTriangle; | 364 Member<PeriodicWave> m_periodicWaveTriangle; |
| 366 | 365 |
| 367 // This is considering 32 is large enough for multiple channels audio. | 366 // This is considering 32 is large enough for multiple channels audio. |
| 368 // It is somewhat arbitrary and could be increased if necessary. | 367 // It is somewhat arbitrary and could be increased if necessary. |
| 369 enum { MaxNumberOfChannels = 32 }; | 368 enum { MaxNumberOfChannels = 32 }; |
| 370 }; | 369 }; |
| 371 | 370 |
| 372 } // namespace blink | 371 } // namespace blink |
| 373 | 372 |
| 374 #endif // AbstractAudioContext_h | 373 #endif // AbstractAudioContext_h |
| OLD | NEW |