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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Closed; Running to Suspended or Closed. Once Closed, there are no valid t
ransitions. | 88 // Closed; Running to Suspended or Closed. Once Closed, there are no valid t
ransitions. |
89 enum AudioContextState { | 89 enum AudioContextState { |
90 Suspended, | 90 Suspended, |
91 Running, | 91 Running, |
92 Closed | 92 Closed |
93 }; | 93 }; |
94 | 94 |
95 // Create an AudioContext for rendering to the audio hardware. | 95 // Create an AudioContext for rendering to the audio hardware. |
96 static AudioContext* create(Document&, ExceptionState&); | 96 static AudioContext* create(Document&, ExceptionState&); |
97 | 97 |
98 virtual ~AudioContext(); | 98 ~AudioContext() override; |
99 | 99 |
100 DECLARE_VIRTUAL_TRACE(); | 100 DECLARE_VIRTUAL_TRACE(); |
101 | 101 |
102 bool isInitialized() const { return m_isInitialized; } | 102 bool isInitialized() const { return m_isInitialized; } |
103 bool isOfflineContext() { return m_isOfflineContext; } | 103 bool isOfflineContext() { return m_isOfflineContext; } |
104 | 104 |
105 // Document notification | 105 // Document notification |
106 virtual void stop() override final; | 106 void stop() final; |
107 virtual bool hasPendingActivity() const override; | 107 bool hasPendingActivity() const override; |
108 | 108 |
109 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 109 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
110 | 110 |
111 size_t currentSampleFrame() const | 111 size_t currentSampleFrame() const |
112 { | 112 { |
113 return m_destinationNode ? m_destinationNode->audioDestinationHandler().
currentSampleFrame() : 0; | 113 return m_destinationNode ? m_destinationNode->audioDestinationHandler().
currentSampleFrame() : 0; |
114 } | 114 } |
115 | 115 |
116 double currentTime() const | 116 double currentTime() const |
117 { | 117 { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 #if ENABLE(ASSERT) | 209 #if ENABLE(ASSERT) |
210 // Returns true if this thread owns the context's lock. | 210 // Returns true if this thread owns the context's lock. |
211 bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); } | 211 bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); } |
212 #endif | 212 #endif |
213 using AutoLocker = DeferredTaskHandler::AutoLocker; | 213 using AutoLocker = DeferredTaskHandler::AutoLocker; |
214 | 214 |
215 // Returns the maximum numuber of channels we can support. | 215 // Returns the maximum numuber of channels we can support. |
216 static unsigned maxNumberOfChannels() { return MaxNumberOfChannels;} | 216 static unsigned maxNumberOfChannels() { return MaxNumberOfChannels;} |
217 | 217 |
218 // EventTarget | 218 // EventTarget |
219 virtual const AtomicString& interfaceName() const override final; | 219 const AtomicString& interfaceName() const final; |
220 virtual ExecutionContext* executionContext() const override final; | 220 ExecutionContext* executionContext() const final; |
221 | 221 |
222 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); | 222 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); |
223 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 223 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
224 | 224 |
225 void startRendering(); | 225 void startRendering(); |
226 void fireCompletionEvent(); | 226 void fireCompletionEvent(); |
227 void notifyStateChange(); | 227 void notifyStateChange(); |
228 | 228 |
229 // A context is considered closed if: | 229 // A context is considered closed if: |
230 // - closeContext() has been called, even if the audio HW has not yet been | 230 // - closeContext() has been called, even if the audio HW has not yet been |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // This is considering 32 is large enough for multiple channels audio. | 322 // This is considering 32 is large enough for multiple channels audio. |
323 // It is somewhat arbitrary and could be increased if necessary. | 323 // It is somewhat arbitrary and could be increased if necessary. |
324 enum { MaxNumberOfChannels = 32 }; | 324 enum { MaxNumberOfChannels = 32 }; |
325 | 325 |
326 unsigned m_contextId; | 326 unsigned m_contextId; |
327 }; | 327 }; |
328 | 328 |
329 } // namespace blink | 329 } // namespace blink |
330 | 330 |
331 #endif // AudioContext_h | 331 #endif // AudioContext_h |
OLD | NEW |