OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #ifndef OfflineAudioDestinationNode_h | 25 #ifndef OfflineAudioDestinationNode_h |
26 #define OfflineAudioDestinationNode_h | 26 #define OfflineAudioDestinationNode_h |
27 | 27 |
28 #include "modules/webaudio/AudioBuffer.h" | 28 #include "modules/webaudio/AudioBuffer.h" |
29 #include "modules/webaudio/AudioDestinationNode.h" | 29 #include "modules/webaudio/AudioDestinationNode.h" |
30 #include "modules/webaudio/OfflineAudioContext.h" | 30 #include "modules/webaudio/OfflineAudioContext.h" |
31 #include "public/platform/WebThread.h" | 31 #include "public/platform/WebThread.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefPtr.h" | 33 #include "wtf/RefPtr.h" |
| 34 #include <memory> |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class AbstractAudioContext; | 38 class AbstractAudioContext; |
38 class AudioBus; | 39 class AudioBus; |
39 class OfflineAudioContext; | 40 class OfflineAudioContext; |
40 | 41 |
41 class OfflineAudioDestinationHandler final : public AudioDestinationHandler { | 42 class OfflineAudioDestinationHandler final : public AudioDestinationHandler { |
42 public: | 43 public: |
43 static PassRefPtr<OfflineAudioDestinationHandler> create(AudioNode&, AudioBu
ffer* renderTarget); | 44 static PassRefPtr<OfflineAudioDestinationHandler> create(AudioNode&, AudioBu
ffer* renderTarget); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool renderIfNotSuspended(AudioBus* sourceBus, AudioBus* destinationBus, siz
e_t numberOfFrames); | 92 bool renderIfNotSuspended(AudioBus* sourceBus, AudioBus* destinationBus, siz
e_t numberOfFrames); |
92 | 93 |
93 // This AudioHandler renders into this AudioBuffer. | 94 // This AudioHandler renders into this AudioBuffer. |
94 // This Persistent doesn't make a reference cycle including the owner | 95 // This Persistent doesn't make a reference cycle including the owner |
95 // OfflineAudioDestinationNode. | 96 // OfflineAudioDestinationNode. |
96 Persistent<AudioBuffer> m_renderTarget; | 97 Persistent<AudioBuffer> m_renderTarget; |
97 // Temporary AudioBus for each render quantum. | 98 // Temporary AudioBus for each render quantum. |
98 RefPtr<AudioBus> m_renderBus; | 99 RefPtr<AudioBus> m_renderBus; |
99 | 100 |
100 // Rendering thread. | 101 // Rendering thread. |
101 OwnPtr<WebThread> m_renderThread; | 102 std::unique_ptr<WebThread> m_renderThread; |
102 | 103 |
103 // These variables are for counting the number of frames for the current | 104 // These variables are for counting the number of frames for the current |
104 // progress and the remaining frames to be processed. | 105 // progress and the remaining frames to be processed. |
105 size_t m_framesProcessed; | 106 size_t m_framesProcessed; |
106 size_t m_framesToProcess; | 107 size_t m_framesToProcess; |
107 | 108 |
108 // This flag is necessary to distinguish the state of the context between | 109 // This flag is necessary to distinguish the state of the context between |
109 // 'created' and 'suspended'. If this flag is false and the current state | 110 // 'created' and 'suspended'. If this flag is false and the current state |
110 // is 'suspended', it means the context is created and have not started yet. | 111 // is 'suspended', it means the context is created and have not started yet. |
111 bool m_isRenderingStarted; | 112 bool m_isRenderingStarted; |
112 | 113 |
113 // This flag indicates whether the rendering should be suspended or not. | 114 // This flag indicates whether the rendering should be suspended or not. |
114 bool m_shouldSuspend; | 115 bool m_shouldSuspend; |
115 }; | 116 }; |
116 | 117 |
117 class OfflineAudioDestinationNode final : public AudioDestinationNode { | 118 class OfflineAudioDestinationNode final : public AudioDestinationNode { |
118 public: | 119 public: |
119 static OfflineAudioDestinationNode* create(AbstractAudioContext*, AudioBuffe
r* renderTarget); | 120 static OfflineAudioDestinationNode* create(AbstractAudioContext*, AudioBuffe
r* renderTarget); |
120 | 121 |
121 private: | 122 private: |
122 OfflineAudioDestinationNode(AbstractAudioContext&, AudioBuffer* renderTarget
); | 123 OfflineAudioDestinationNode(AbstractAudioContext&, AudioBuffer* renderTarget
); |
123 }; | 124 }; |
124 | 125 |
125 } // namespace blink | 126 } // namespace blink |
126 | 127 |
127 #endif // OfflineAudioDestinationNode_h | 128 #endif // OfflineAudioDestinationNode_h |
OLD | NEW |