| 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 22 matching lines...) Expand all Loading... |
| 33 #include "wtf/RefPtr.h" | 33 #include "wtf/RefPtr.h" |
| 34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
| 35 | 35 |
| 36 #define DEBUG_AUDIONODE_REFERENCES 0 | 36 #define DEBUG_AUDIONODE_REFERENCES 0 |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class AudioContext; | 40 class AudioContext; |
| 41 class AudioNodeInput; | 41 class AudioNodeInput; |
| 42 class AudioNodeOutput; | 42 class AudioNodeOutput; |
| 43 class AudioParam; | 43 class AudioParamHandler; |
| 44 class ExceptionState; | 44 class ExceptionState; |
| 45 | 45 |
| 46 // An AudioNode is the basic building block for handling audio within an AudioCo
ntext. | 46 // An AudioNode is the basic building block for handling audio within an AudioCo
ntext. |
| 47 // It may be an audio source, an intermediate processing module, or an audio des
tination. | 47 // It may be an audio source, an intermediate processing module, or an audio des
tination. |
| 48 // Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inpu
ts and a single output. | 48 // Each AudioNode can have inputs and/or outputs. An AudioSourceNode has no inpu
ts and a single output. |
| 49 // An AudioDestinationNode has one input and no outputs and represents the final
destination to the audio hardware. | 49 // An AudioDestinationNode has one input and no outputs and represents the final
destination to the audio hardware. |
| 50 // Most processing nodes such as filters will have one input and one output, alt
hough multiple inputs and outputs are possible. | 50 // Most processing nodes such as filters will have one input and one output, alt
hough multiple inputs and outputs are possible. |
| 51 | 51 |
| 52 class AudioNode : public RefCountedGarbageCollectedEventTargetWithInlineData<Aud
ioNode> { | 52 class AudioNode : public RefCountedGarbageCollectedEventTargetWithInlineData<Aud
ioNode> { |
| 53 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<A
udioNode>); | 53 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<A
udioNode>); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 bool isInitialized() const { return m_isInitialized; } | 130 bool isInitialized() const { return m_isInitialized; } |
| 131 | 131 |
| 132 unsigned numberOfInputs() const { return m_inputs.size(); } | 132 unsigned numberOfInputs() const { return m_inputs.size(); } |
| 133 unsigned numberOfOutputs() const { return m_outputs.size(); } | 133 unsigned numberOfOutputs() const { return m_outputs.size(); } |
| 134 | 134 |
| 135 AudioNodeInput* input(unsigned); | 135 AudioNodeInput* input(unsigned); |
| 136 AudioNodeOutput* output(unsigned); | 136 AudioNodeOutput* output(unsigned); |
| 137 | 137 |
| 138 // Called from main thread by corresponding JavaScript methods. | 138 // Called from main thread by corresponding JavaScript methods. |
| 139 virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex,
ExceptionState&); | 139 virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex,
ExceptionState&); |
| 140 void connect(AudioParam*, unsigned outputIndex, ExceptionState&); | 140 void connect(AudioParamHandler*, unsigned outputIndex, ExceptionState&); |
| 141 | 141 |
| 142 virtual void disconnect(); | 142 virtual void disconnect(); |
| 143 virtual void disconnect(unsigned outputIndex, ExceptionState&); | 143 virtual void disconnect(unsigned outputIndex, ExceptionState&); |
| 144 virtual void disconnect(AudioNode*, ExceptionState&); | 144 virtual void disconnect(AudioNode*, ExceptionState&); |
| 145 virtual void disconnect(AudioNode*, unsigned outputIndex, ExceptionState&); | 145 virtual void disconnect(AudioNode*, unsigned outputIndex, ExceptionState&); |
| 146 virtual void disconnect(AudioNode*, unsigned outputIndex, unsigned inputInde
x, ExceptionState&); | 146 virtual void disconnect(AudioNode*, unsigned outputIndex, unsigned inputInde
x, ExceptionState&); |
| 147 virtual void disconnect(AudioParam*, ExceptionState&); | 147 virtual void disconnect(AudioParamHandler*, ExceptionState&); |
| 148 virtual void disconnect(AudioParam*, unsigned outputIndex, ExceptionState&); | 148 virtual void disconnect(AudioParamHandler*, unsigned outputIndex, ExceptionS
tate&); |
| 149 | 149 |
| 150 // Like disconnect, but no exception is thrown if the outputIndex is invalid
. Just do nothing | 150 // Like disconnect, but no exception is thrown if the outputIndex is invalid
. Just do nothing |
| 151 // in that case. | 151 // in that case. |
| 152 virtual void disconnectWithoutException(unsigned outputIndex); | 152 virtual void disconnectWithoutException(unsigned outputIndex); |
| 153 | 153 |
| 154 virtual float sampleRate() const { return m_sampleRate; } | 154 virtual float sampleRate() const { return m_sampleRate; } |
| 155 | 155 |
| 156 // processIfNecessary() is called by our output(s) when the rendering graph
needs this AudioNode to process. | 156 // processIfNecessary() is called by our output(s) when the rendering graph
needs this AudioNode to process. |
| 157 // This method ensures that the AudioNode will only process once per renderi
ng time quantum even if it's called repeatedly. | 157 // This method ensures that the AudioNode will only process once per renderi
ng time quantum even if it's called repeatedly. |
| 158 // This handles the case of "fanout" where an output is connected to multipl
e AudioNode inputs. | 158 // This handles the case of "fanout" where an output is connected to multipl
e AudioNode inputs. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ChannelCountMode m_channelCountMode; | 251 ChannelCountMode m_channelCountMode; |
| 252 AudioBus::ChannelInterpretation m_channelInterpretation; | 252 AudioBus::ChannelInterpretation m_channelInterpretation; |
| 253 // The new channel count mode that will be used to set the actual mode in th
e pre or post | 253 // The new channel count mode that will be used to set the actual mode in th
e pre or post |
| 254 // rendering phase. | 254 // rendering phase. |
| 255 ChannelCountMode m_newChannelCountMode; | 255 ChannelCountMode m_newChannelCountMode; |
| 256 }; | 256 }; |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| 259 | 259 |
| 260 #endif // AudioNode_h | 260 #endif // AudioNode_h |
| OLD | NEW |