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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 unsigned numberOfOutputs() const { return m_outputs.size(); } | 165 unsigned numberOfOutputs() const { return m_outputs.size(); } |
166 | 166 |
167 // Number of output channels. This only matters for ScriptProcessorNodes. | 167 // Number of output channels. This only matters for ScriptProcessorNodes. |
168 virtual unsigned numberOfOutputChannels() const; | 168 virtual unsigned numberOfOutputChannels() const; |
169 | 169 |
170 // The argument must be less than numberOfInputs(). | 170 // The argument must be less than numberOfInputs(). |
171 AudioNodeInput& input(unsigned); | 171 AudioNodeInput& input(unsigned); |
172 // The argument must be less than numberOfOutputs(). | 172 // The argument must be less than numberOfOutputs(). |
173 AudioNodeOutput& output(unsigned); | 173 AudioNodeOutput& output(unsigned); |
174 | 174 |
175 virtual float sampleRate() const { return m_sampleRate; } | |
176 | |
177 // processIfNecessary() is called by our output(s) when the rendering graph | 175 // processIfNecessary() is called by our output(s) when the rendering graph |
178 // needs this AudioNode to process. This method ensures that the AudioNode | 176 // needs this AudioNode to process. This method ensures that the AudioNode |
179 // will only process once per rendering time quantum even if it's called | 177 // will only process once per rendering time quantum even if it's called |
180 // repeatedly. This handles the case of "fanout" where an output is connected | 178 // repeatedly. This handles the case of "fanout" where an output is connected |
181 // to multiple AudioNode inputs. Called from context's audio thread. | 179 // to multiple AudioNode inputs. Called from context's audio thread. |
182 void processIfNecessary(size_t framesToProcess); | 180 void processIfNecessary(size_t framesToProcess); |
183 | 181 |
184 // Called when a new connection has been made to one of our inputs or the | 182 // Called when a new connection has been made to one of our inputs or the |
185 // connection number of channels has changed. This potentially gives us | 183 // connection number of channels has changed. This potentially gives us |
186 // enough information to perform a lazy initialization or, if necessary, a | 184 // enough information to perform a lazy initialization or, if necessary, a |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // m_node directly, use node() instead. | 263 // m_node directly, use node() instead. |
266 // See http://crbug.com/404527 for the detail. | 264 // See http://crbug.com/404527 for the detail. |
267 UntracedMember<AudioNode> m_node; | 265 UntracedMember<AudioNode> m_node; |
268 | 266 |
269 // This untraced member is safe because this is cleared for all of live | 267 // This untraced member is safe because this is cleared for all of live |
270 // AudioHandlers when the BaseAudioContext dies. Do not access m_context | 268 // AudioHandlers when the BaseAudioContext dies. Do not access m_context |
271 // directly, use context() instead. | 269 // directly, use context() instead. |
272 // See http://crbug.com/404527 for the detail. | 270 // See http://crbug.com/404527 for the detail. |
273 UntracedMember<BaseAudioContext> m_context; | 271 UntracedMember<BaseAudioContext> m_context; |
274 | 272 |
275 float m_sampleRate; | |
276 Vector<std::unique_ptr<AudioNodeInput>> m_inputs; | 273 Vector<std::unique_ptr<AudioNodeInput>> m_inputs; |
277 Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; | 274 Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; |
278 | 275 |
279 double m_lastProcessingTime; | 276 double m_lastProcessingTime; |
280 double m_lastNonSilentTime; | 277 double m_lastNonSilentTime; |
281 | 278 |
282 volatile int m_connectionRefCount; | 279 volatile int m_connectionRefCount; |
283 | 280 |
284 bool m_isDisabled; | 281 bool m_isDisabled; |
285 | 282 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> m_connectedNodes; | 372 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> m_connectedNodes; |
376 // Represents audio node graph with Oilpan references. N-th HeapHashSet | 373 // Represents audio node graph with Oilpan references. N-th HeapHashSet |
377 // represents a set of AudioParam objects connected to this AudioNode's N-th | 374 // represents a set of AudioParam objects connected to this AudioNode's N-th |
378 // output. | 375 // output. |
379 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams; | 376 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams; |
380 }; | 377 }; |
381 | 378 |
382 } // namespace blink | 379 } // namespace blink |
383 | 380 |
384 #endif // AudioNode_h | 381 #endif // AudioNode_h |
OLD | NEW |