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 DEFINE_EVENT_TARGET_REFCOUNTING(ThreadSafeRefCountedWillBeThreadSafeRefCount
edGarbageCollected<AudioContext>); | 78 DEFINE_EVENT_TARGET_REFCOUNTING(ThreadSafeRefCountedWillBeThreadSafeRefCount
edGarbageCollected<AudioContext>); |
79 public: | 79 public: |
80 // Create an AudioContext for rendering to the audio hardware. | 80 // Create an AudioContext for rendering to the audio hardware. |
81 static PassRefPtrWillBeRawPtr<AudioContext> create(Document&, ExceptionState
&); | 81 static PassRefPtrWillBeRawPtr<AudioContext> create(Document&, ExceptionState
&); |
82 | 82 |
83 virtual ~AudioContext(); | 83 virtual ~AudioContext(); |
84 | 84 |
85 virtual void trace(Visitor*); | 85 virtual void trace(Visitor*); |
86 | 86 |
87 bool isInitialized() const; | 87 bool isInitialized() const; |
88 // The constructor of an AudioNode must call this to initialize the context. | |
89 void lazyInitialize(); | |
90 | |
91 bool isOfflineContext() { return m_isOfflineContext; } | 88 bool isOfflineContext() { return m_isOfflineContext; } |
92 | 89 |
93 // Document notification | 90 // Document notification |
94 virtual void stop() OVERRIDE FINAL; | 91 virtual void stop() OVERRIDE FINAL; |
95 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const OVERRIDE; |
96 | 93 |
97 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 94 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
98 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } | 95 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } |
99 double currentTime() const { return m_destinationNode->currentTime(); } | 96 double currentTime() const { return m_destinationNode->currentTime(); } |
100 float sampleRate() const { return m_destinationNode->sampleRate(); } | 97 float sampleRate() const { return m_destinationNode->sampleRate(); } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 232 |
236 protected: | 233 protected: |
237 explicit AudioContext(Document*); | 234 explicit AudioContext(Document*); |
238 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); | 235 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); |
239 | 236 |
240 static bool isSampleRateRangeGood(float sampleRate); | 237 static bool isSampleRateRangeGood(float sampleRate); |
241 | 238 |
242 private: | 239 private: |
243 void constructCommon(); | 240 void constructCommon(); |
244 | 241 |
| 242 void initialize(); |
245 void uninitialize(); | 243 void uninitialize(); |
246 | 244 |
247 // ExecutionContext calls stop twice. | 245 // ExecutionContext calls stop twice. |
248 // We'd like to schedule only one stop action for them. | 246 // We'd like to schedule only one stop action for them. |
249 bool m_isStopScheduled; | 247 bool m_isStopScheduled; |
250 static void stopDispatch(void* userData); | 248 static void stopDispatch(void* userData); |
251 bool m_isCleared; | 249 bool m_isCleared; |
252 void clear(); | 250 void clear(); |
253 | 251 |
254 void scheduleNodeDeletion(); | 252 void scheduleNodeDeletion(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 AsyncAudioDecoder m_audioDecoder; | 319 AsyncAudioDecoder m_audioDecoder; |
322 | 320 |
323 // This is considering 32 is large enough for multiple channels audio. | 321 // This is considering 32 is large enough for multiple channels audio. |
324 // It is somewhat arbitrary and could be increased if necessary. | 322 // It is somewhat arbitrary and could be increased if necessary. |
325 enum { MaxNumberOfChannels = 32 }; | 323 enum { MaxNumberOfChannels = 32 }; |
326 }; | 324 }; |
327 | 325 |
328 } // WebCore | 326 } // WebCore |
329 | 327 |
330 #endif // AudioContext_h | 328 #endif // AudioContext_h |
OLD | NEW |