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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 unsigned numberOfOutputs() const { return m_outputs.size(); } | 160 unsigned numberOfOutputs() const { return m_outputs.size(); } |
161 | 161 |
162 // Number of output channels. This only matters for ScriptProcessorNodes. | 162 // Number of output channels. This only matters for ScriptProcessorNodes. |
163 virtual unsigned numberOfOutputChannels() const; | 163 virtual unsigned numberOfOutputChannels() const; |
164 | 164 |
165 // The argument must be less than numberOfInputs(). | 165 // The argument must be less than numberOfInputs(). |
166 AudioNodeInput& input(unsigned); | 166 AudioNodeInput& input(unsigned); |
167 // The argument must be less than numberOfOutputs(). | 167 // The argument must be less than numberOfOutputs(). |
168 AudioNodeOutput& output(unsigned); | 168 AudioNodeOutput& output(unsigned); |
169 | 169 |
170 virtual float sampleRate() const { return m_sampleRate; } | |
171 | |
172 // processIfNecessary() is called by our output(s) when the rendering graph | 170 // processIfNecessary() is called by our output(s) when the rendering graph |
173 // needs this AudioNode to process. This method ensures that the AudioNode | 171 // needs this AudioNode to process. This method ensures that the AudioNode |
174 // will only process once per rendering time quantum even if it's called | 172 // will only process once per rendering time quantum even if it's called |
175 // repeatedly. This handles the case of "fanout" where an output is connected | 173 // repeatedly. This handles the case of "fanout" where an output is connected |
176 // to multiple AudioNode inputs. Called from context's audio thread. | 174 // to multiple AudioNode inputs. Called from context's audio thread. |
177 void processIfNecessary(size_t framesToProcess); | 175 void processIfNecessary(size_t framesToProcess); |
178 | 176 |
179 // Called when a new connection has been made to one of our inputs or the | 177 // Called when a new connection has been made to one of our inputs or the |
180 // connection number of channels has changed. This potentially gives us | 178 // connection number of channels has changed. This potentially gives us |
181 // enough information to perform a lazy initialization or, if necessary, a | 179 // enough information to perform a lazy initialization or, if necessary, a |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // m_node directly, use node() instead. | 253 // m_node directly, use node() instead. |
256 // See http://crbug.com/404527 for the detail. | 254 // See http://crbug.com/404527 for the detail. |
257 UntracedMember<AudioNode> m_node; | 255 UntracedMember<AudioNode> m_node; |
258 | 256 |
259 // This untraced member is safe because this is cleared for all of live | 257 // This untraced member is safe because this is cleared for all of live |
260 // AudioHandlers when the BaseAudioContext dies. Do not access m_context | 258 // AudioHandlers when the BaseAudioContext dies. Do not access m_context |
261 // directly, use context() instead. | 259 // directly, use context() instead. |
262 // See http://crbug.com/404527 for the detail. | 260 // See http://crbug.com/404527 for the detail. |
263 UntracedMember<BaseAudioContext> m_context; | 261 UntracedMember<BaseAudioContext> m_context; |
264 | 262 |
265 float m_sampleRate; | |
266 Vector<std::unique_ptr<AudioNodeInput>> m_inputs; | 263 Vector<std::unique_ptr<AudioNodeInput>> m_inputs; |
267 Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; | 264 Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; |
268 | 265 |
269 double m_lastProcessingTime; | 266 double m_lastProcessingTime; |
270 double m_lastNonSilentTime; | 267 double m_lastNonSilentTime; |
271 | 268 |
272 volatile int m_connectionRefCount; | 269 volatile int m_connectionRefCount; |
273 | 270 |
274 bool m_isDisabled; | 271 bool m_isDisabled; |
275 | 272 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> m_connectedNodes; | 362 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> m_connectedNodes; |
366 // Represents audio node graph with Oilpan references. N-th HeapHashSet | 363 // Represents audio node graph with Oilpan references. N-th HeapHashSet |
367 // represents a set of AudioParam objects connected to this AudioNode's N-th | 364 // represents a set of AudioParam objects connected to this AudioNode's N-th |
368 // output. | 365 // output. |
369 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams; | 366 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams; |
370 }; | 367 }; |
371 | 368 |
372 } // namespace blink | 369 } // namespace blink |
373 | 370 |
374 #endif // AudioNode_h | 371 #endif // AudioNode_h |
OLD | NEW |