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