| 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 15 matching lines...) Expand all Loading... |
| 26 #define AudioContext_h | 26 #define AudioContext_h |
| 27 | 27 |
| 28 #include "bindings/v8/ScriptWrappable.h" | 28 #include "bindings/v8/ScriptWrappable.h" |
| 29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
| 30 #include "core/dom/EventListener.h" | 30 #include "core/dom/EventListener.h" |
| 31 #include "core/dom/EventTarget.h" | 31 #include "core/dom/EventTarget.h" |
| 32 #include "core/platform/audio/AudioBus.h" | 32 #include "core/platform/audio/AudioBus.h" |
| 33 #include "core/platform/audio/HRTFDatabaseLoader.h" | 33 #include "core/platform/audio/HRTFDatabaseLoader.h" |
| 34 #include "modules/webaudio/AsyncAudioDecoder.h" | 34 #include "modules/webaudio/AsyncAudioDecoder.h" |
| 35 #include "modules/webaudio/AudioDestinationNode.h" | 35 #include "modules/webaudio/AudioDestinationNode.h" |
| 36 #include "modules/webmidi/MIDIAccess.h" |
| 36 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
| 37 #include "wtf/MainThread.h" | 38 #include "wtf/MainThread.h" |
| 38 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 39 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 42 #include "wtf/ThreadSafeRefCounted.h" | 43 #include "wtf/ThreadSafeRefCounted.h" |
| 43 #include "wtf/Threading.h" | 44 #include "wtf/Threading.h" |
| 44 #include "wtf/Vector.h" | 45 #include "wtf/Vector.h" |
| 45 #include "wtf/text/AtomicStringHash.h" | 46 #include "wtf/text/AtomicStringHash.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 using ThreadSafeRefCounted<AudioContext>::ref; | 243 using ThreadSafeRefCounted<AudioContext>::ref; |
| 243 using ThreadSafeRefCounted<AudioContext>::deref; | 244 using ThreadSafeRefCounted<AudioContext>::deref; |
| 244 | 245 |
| 245 void startRendering(); | 246 void startRendering(); |
| 246 void fireCompletionEvent(); | 247 void fireCompletionEvent(); |
| 247 | 248 |
| 248 static unsigned s_hardwareContextCount; | 249 static unsigned s_hardwareContextCount; |
| 249 | 250 |
| 250 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 251 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 251 | 252 |
| 253 MIDIAccess* midiAccess() { return m_midiAccess.get(); } |
| 254 |
| 252 protected: | 255 protected: |
| 253 explicit AudioContext(Document*); | 256 explicit AudioContext(Document*); |
| 254 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); | 257 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl
oat sampleRate); |
| 255 | 258 |
| 256 static bool isSampleRateRangeGood(float sampleRate); | 259 static bool isSampleRateRangeGood(float sampleRate); |
| 257 | 260 |
| 258 private: | 261 private: |
| 259 void constructCommon(); | 262 void constructCommon(); |
| 260 | 263 |
| 261 void lazyInitialize(); | 264 void lazyInitialize(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 bool m_isOfflineContext; | 345 bool m_isOfflineContext; |
| 343 | 346 |
| 344 AsyncAudioDecoder m_audioDecoder; | 347 AsyncAudioDecoder m_audioDecoder; |
| 345 | 348 |
| 346 // This is considering 32 is large enough for multiple channels audio. | 349 // This is considering 32 is large enough for multiple channels audio. |
| 347 // It is somewhat arbitrary and could be increased if necessary. | 350 // It is somewhat arbitrary and could be increased if necessary. |
| 348 enum { MaxNumberOfChannels = 32 }; | 351 enum { MaxNumberOfChannels = 32 }; |
| 349 | 352 |
| 350 // Number of AudioBufferSourceNodes that are active (playing). | 353 // Number of AudioBufferSourceNodes that are active (playing). |
| 351 int m_activeSourceCount; | 354 int m_activeSourceCount; |
| 355 |
| 356 RefPtr<MIDIAccess> m_midiAccess; |
| 352 }; | 357 }; |
| 353 | 358 |
| 354 } // WebCore | 359 } // WebCore |
| 355 | 360 |
| 356 #endif // AudioContext_h | 361 #endif // AudioContext_h |
| OLD | NEW |