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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 public: | 78 public: |
79 // Create an AudioContext for rendering to the audio hardware. | 79 // Create an AudioContext for rendering to the audio hardware. |
80 static PassRefPtr<AudioContext> create(Document&, ExceptionState&); | 80 static PassRefPtr<AudioContext> create(Document&, ExceptionState&); |
81 | 81 |
82 // Deprecated: create an AudioContext for offline (non-realtime) rendering. | 82 // Deprecated: create an AudioContext for offline (non-realtime) rendering. |
83 static PassRefPtr<AudioContext> create(Document&, unsigned numberOfChannels,
size_t numberOfFrames, float sampleRate, ExceptionState&); | 83 static PassRefPtr<AudioContext> create(Document&, unsigned numberOfChannels,
size_t numberOfFrames, float sampleRate, ExceptionState&); |
84 | 84 |
85 virtual ~AudioContext(); | 85 virtual ~AudioContext(); |
86 | 86 |
87 bool isInitialized() const; | 87 bool isInitialized() const; |
| 88 void lazyInitialize(); |
88 | 89 |
89 bool isOfflineContext() { return m_isOfflineContext; } | 90 bool isOfflineContext() { return m_isOfflineContext; } |
90 | 91 |
91 // Document notification | 92 // Document notification |
92 virtual void stop() OVERRIDE FINAL; | 93 virtual void stop() OVERRIDE FINAL; |
93 virtual bool hasPendingActivity() const OVERRIDE; | 94 virtual bool hasPendingActivity() const OVERRIDE; |
94 | 95 |
95 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 96 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
96 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } | 97 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } |
97 double currentTime() const { return m_destinationNode->currentTime(); } | 98 double currentTime() const { return m_destinationNode->currentTime(); } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 239 |
239 protected: | 240 protected: |
240 explicit AudioContext(Document*); | 241 explicit AudioContext(Document*); |
241 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); | 242 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); |
242 | 243 |
243 static bool isSampleRateRangeGood(float sampleRate); | 244 static bool isSampleRateRangeGood(float sampleRate); |
244 | 245 |
245 private: | 246 private: |
246 void constructCommon(); | 247 void constructCommon(); |
247 | 248 |
248 void lazyInitialize(); | |
249 void uninitialize(); | 249 void uninitialize(); |
250 | 250 |
251 // ExecutionContext calls stop twice. | 251 // ExecutionContext calls stop twice. |
252 // We'd like to schedule only one stop action for them. | 252 // We'd like to schedule only one stop action for them. |
253 bool m_isStopScheduled; | 253 bool m_isStopScheduled; |
254 static void stopDispatch(void* userData); | 254 static void stopDispatch(void* userData); |
255 bool m_isCleared; | 255 bool m_isCleared; |
256 void clear(); | 256 void clear(); |
257 | 257 |
258 void scheduleNodeDeletion(); | 258 void scheduleNodeDeletion(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // It is somewhat arbitrary and could be increased if necessary. | 327 // It is somewhat arbitrary and could be increased if necessary. |
328 enum { MaxNumberOfChannels = 32 }; | 328 enum { MaxNumberOfChannels = 32 }; |
329 | 329 |
330 // Number of AudioBufferSourceNodes that are active (playing). | 330 // Number of AudioBufferSourceNodes that are active (playing). |
331 int m_activeSourceCount; | 331 int m_activeSourceCount; |
332 }; | 332 }; |
333 | 333 |
334 } // WebCore | 334 } // WebCore |
335 | 335 |
336 #endif // AudioContext_h | 336 #endif // AudioContext_h |
OLD | NEW |