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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 class AudioNodeOutput; | 43 class AudioNodeOutput; |
44 class AudioParam; | 44 class AudioParam; |
45 class ExceptionState; | 45 class ExceptionState; |
46 | 46 |
47 // An AudioNode is the basic building block for handling audio within an AudioCo ntext. | 47 // An AudioNode is the basic building block for handling audio within an AudioCo ntext. |
48 // It may be an audio source, an intermediate processing module, or an audio des tination. | 48 // It may be an audio source, an intermediate processing module, or an audio des tination. |
49 // Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inpu ts and a single output. | 49 // Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inpu ts and a single output. |
50 // An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. | 50 // An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. |
51 // Most processing nodes such as filters will have one input and one output, alt hough multiple inputs and outputs are possible. | 51 // Most processing nodes such as filters will have one input and one output, alt hough multiple inputs and outputs are possible. |
52 | 52 |
53 class AudioNode : public ScriptWrappable, public EventTargetWithInlineData { | 53 class AudioNode : public NoBaseWillBeRefCountedGarbageCollected<AudioNode>, publ ic ScriptWrappable, public EventTargetWithInlineData { |
Mads Ager (chromium)
2014/04/03 08:39:33
I don't think we want this to be RefCountedGarbage
keishi
2014/04/08 02:33:40
Done.
| |
54 public: | 54 public: |
55 enum { ProcessingSizeInFrames = 128 }; | 55 enum { ProcessingSizeInFrames = 128 }; |
56 | 56 |
57 AudioNode(AudioContext*, float sampleRate); | 57 AudioNode(AudioContext*, float sampleRate); |
58 virtual ~AudioNode(); | 58 virtual ~AudioNode(); |
59 | 59 |
60 AudioContext* context() { return m_context.get(); } | 60 AudioContext* context() { return m_context.get(); } |
61 const AudioContext* context() const { return m_context.get(); } | 61 const AudioContext* context() const { return m_context.get(); } |
62 | 62 |
63 enum NodeType { | 63 enum NodeType { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 String channelInterpretation(); | 172 String channelInterpretation(); |
173 void setChannelInterpretation(const String&, ExceptionState&); | 173 void setChannelInterpretation(const String&, ExceptionState&); |
174 | 174 |
175 ChannelCountMode internalChannelCountMode() const { return m_channelCountMod e; } | 175 ChannelCountMode internalChannelCountMode() const { return m_channelCountMod e; } |
176 AudioBus::ChannelInterpretation internalChannelInterpretation() const { retu rn m_channelInterpretation; } | 176 AudioBus::ChannelInterpretation internalChannelInterpretation() const { retu rn m_channelInterpretation; } |
177 | 177 |
178 // EventTarget | 178 // EventTarget |
179 virtual const AtomicString& interfaceName() const OVERRIDE FINAL; | 179 virtual const AtomicString& interfaceName() const OVERRIDE FINAL; |
180 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; | 180 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; |
181 | 181 |
182 virtual void trace(Visitor*); | |
183 | |
184 #if ENABLE(OILPAN) | |
185 virtual void clearKeepAlive() { } | |
186 #endif | |
187 | |
182 protected: | 188 protected: |
183 // Inputs and outputs must be created before the AudioNode is initialized. | 189 // Inputs and outputs must be created before the AudioNode is initialized. |
184 void addInput(PassOwnPtr<AudioNodeInput>); | 190 void addInput(PassOwnPtr<AudioNodeInput>); |
185 void addOutput(PassOwnPtr<AudioNodeOutput>); | 191 void addOutput(PassOwnPtr<AudioNodeOutput>); |
186 | 192 |
187 // Called by processIfNecessary() to cause all parts of the rendering graph connected to us to process. | 193 // Called by processIfNecessary() to cause all parts of the rendering graph connected to us to process. |
188 // Each rendering quantum, the audio data for each of the AudioNode's inputs will be available after this method is called. | 194 // Each rendering quantum, the audio data for each of the AudioNode's inputs will be available after this method is called. |
189 // Called from context's audio thread. | 195 // Called from context's audio thread. |
190 virtual void pullInputs(size_t framesToProcess); | 196 virtual void pullInputs(size_t framesToProcess); |
191 | 197 |
192 // Force all inputs to take any channel interpretation changes into account. | 198 // Force all inputs to take any channel interpretation changes into account. |
193 void updateChannelsForInputs(); | 199 void updateChannelsForInputs(); |
194 | 200 |
195 private: | 201 private: |
196 volatile bool m_isInitialized; | 202 volatile bool m_isInitialized; |
197 NodeType m_nodeType; | 203 NodeType m_nodeType; |
198 RefPtr<AudioContext> m_context; | 204 RefPtrWillBeMember<AudioContext> m_context; |
199 float m_sampleRate; | 205 float m_sampleRate; |
200 Vector<OwnPtr<AudioNodeInput> > m_inputs; | 206 Vector<OwnPtr<AudioNodeInput> > m_inputs; |
201 Vector<OwnPtr<AudioNodeOutput> > m_outputs; | 207 Vector<OwnPtr<AudioNodeOutput> > m_outputs; |
202 | 208 |
203 double m_lastProcessingTime; | 209 double m_lastProcessingTime; |
204 double m_lastNonSilentTime; | 210 double m_lastNonSilentTime; |
205 | 211 |
206 // Ref-counting | 212 // Ref-counting |
207 volatile int m_normalRefCount; | 213 volatile int m_normalRefCount; |
208 volatile int m_connectionRefCount; | 214 volatile int m_connectionRefCount; |
(...skipping 11 matching lines...) Expand all Loading... | |
220 | 226 |
221 protected: | 227 protected: |
222 unsigned m_channelCount; | 228 unsigned m_channelCount; |
223 ChannelCountMode m_channelCountMode; | 229 ChannelCountMode m_channelCountMode; |
224 AudioBus::ChannelInterpretation m_channelInterpretation; | 230 AudioBus::ChannelInterpretation m_channelInterpretation; |
225 }; | 231 }; |
226 | 232 |
227 } // namespace WebCore | 233 } // namespace WebCore |
228 | 234 |
229 #endif // AudioNode_h | 235 #endif // AudioNode_h |
OLD | NEW |