| 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 24 matching lines...) Expand all Loading... |
| 35 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
| 36 | 36 |
| 37 #define DEBUG_AUDIONODE_REFERENCES 0 | 37 #define DEBUG_AUDIONODE_REFERENCES 0 |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class AudioContext; | 41 class AudioContext; |
| 42 class AudioNodeInput; | 42 class AudioNodeInput; |
| 43 class AudioNodeOutput; | 43 class AudioNodeOutput; |
| 44 class AudioParam; | 44 class AudioParam; |
| 45 class ExceptionState; | 45 |
| 46 typedef int ExceptionCode; |
| 46 | 47 |
| 47 // An AudioNode is the basic building block for handling audio within an AudioCo
ntext. | 48 // 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. | 49 // 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. | 50 // 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. | 51 // 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. | 52 // Most processing nodes such as filters will have one input and one output, alt
hough multiple inputs and outputs are possible. |
| 52 | 53 |
| 53 class AudioNode : public ScriptWrappable, public EventTarget { | 54 class AudioNode : public ScriptWrappable, public EventTarget { |
| 54 public: | 55 public: |
| 55 enum { ProcessingSizeInFrames = 128 }; | 56 enum { ProcessingSizeInFrames = 128 }; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 bool isInitialized() const { return m_isInitialized; } | 121 bool isInitialized() const { return m_isInitialized; } |
| 121 void lazyInitialize(); | 122 void lazyInitialize(); |
| 122 | 123 |
| 123 unsigned numberOfInputs() const { return m_inputs.size(); } | 124 unsigned numberOfInputs() const { return m_inputs.size(); } |
| 124 unsigned numberOfOutputs() const { return m_outputs.size(); } | 125 unsigned numberOfOutputs() const { return m_outputs.size(); } |
| 125 | 126 |
| 126 AudioNodeInput* input(unsigned); | 127 AudioNodeInput* input(unsigned); |
| 127 AudioNodeOutput* output(unsigned); | 128 AudioNodeOutput* output(unsigned); |
| 128 | 129 |
| 129 // Called from main thread by corresponding JavaScript methods. | 130 // Called from main thread by corresponding JavaScript methods. |
| 130 virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex,
ExceptionState&); | 131 virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex,
ExceptionCode&); |
| 131 void connect(AudioParam*, unsigned outputIndex, ExceptionState&); | 132 void connect(AudioParam*, unsigned outputIndex, ExceptionCode&); |
| 132 virtual void disconnect(unsigned outputIndex, ExceptionState&); | 133 virtual void disconnect(unsigned outputIndex, ExceptionCode&); |
| 133 | 134 |
| 134 virtual float sampleRate() const { return m_sampleRate; } | 135 virtual float sampleRate() const { return m_sampleRate; } |
| 135 | 136 |
| 136 // processIfNecessary() is called by our output(s) when the rendering graph
needs this AudioNode to process. | 137 // processIfNecessary() is called by our output(s) when the rendering graph
needs this AudioNode to process. |
| 137 // This method ensures that the AudioNode will only process once per renderi
ng time quantum even if it's called repeatedly. | 138 // This method ensures that the AudioNode will only process once per renderi
ng time quantum even if it's called repeatedly. |
| 138 // This handles the case of "fanout" where an output is connected to multipl
e AudioNode inputs. | 139 // This handles the case of "fanout" where an output is connected to multipl
e AudioNode inputs. |
| 139 // Called from context's audio thread. | 140 // Called from context's audio thread. |
| 140 void processIfNecessary(size_t framesToProcess); | 141 void processIfNecessary(size_t framesToProcess); |
| 141 | 142 |
| 142 // Called when a new connection has been made to one of our inputs or the co
nnection number of channels has changed. | 143 // Called when a new connection has been made to one of our inputs or the co
nnection number of channels has changed. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 161 // will take tailTime() and latencyTime() into account when determining whet
her the node will propagate silence. | 162 // will take tailTime() and latencyTime() into account when determining whet
her the node will propagate silence. |
| 162 virtual bool propagatesSilence() const; | 163 virtual bool propagatesSilence() const; |
| 163 bool inputsAreSilent(); | 164 bool inputsAreSilent(); |
| 164 void silenceOutputs(); | 165 void silenceOutputs(); |
| 165 void unsilenceOutputs(); | 166 void unsilenceOutputs(); |
| 166 | 167 |
| 167 void enableOutputsIfNecessary(); | 168 void enableOutputsIfNecessary(); |
| 168 void disableOutputsIfNecessary(); | 169 void disableOutputsIfNecessary(); |
| 169 | 170 |
| 170 unsigned long channelCount(); | 171 unsigned long channelCount(); |
| 171 virtual void setChannelCount(unsigned long, ExceptionState&); | 172 virtual void setChannelCount(unsigned long, ExceptionCode&); |
| 172 | 173 |
| 173 String channelCountMode(); | 174 String channelCountMode(); |
| 174 void setChannelCountMode(const String&, ExceptionState&); | 175 void setChannelCountMode(const String&, ExceptionCode&); |
| 175 | 176 |
| 176 String channelInterpretation(); | 177 String channelInterpretation(); |
| 177 void setChannelInterpretation(const String&, ExceptionState&); | 178 void setChannelInterpretation(const String&, ExceptionCode&); |
| 178 | 179 |
| 179 ChannelCountMode internalChannelCountMode() const { return m_channelCountMod
e; } | 180 ChannelCountMode internalChannelCountMode() const { return m_channelCountMod
e; } |
| 180 AudioBus::ChannelInterpretation internalChannelInterpretation() const { retu
rn m_channelInterpretation; } | 181 AudioBus::ChannelInterpretation internalChannelInterpretation() const { retu
rn m_channelInterpretation; } |
| 181 | 182 |
| 182 // EventTarget | 183 // EventTarget |
| 183 virtual const AtomicString& interfaceName() const OVERRIDE; | 184 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 184 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; | 185 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
| 185 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } | 186 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } |
| 186 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } | 187 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } |
| 187 | 188 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 229 |
| 229 protected: | 230 protected: |
| 230 unsigned m_channelCount; | 231 unsigned m_channelCount; |
| 231 ChannelCountMode m_channelCountMode; | 232 ChannelCountMode m_channelCountMode; |
| 232 AudioBus::ChannelInterpretation m_channelInterpretation; | 233 AudioBus::ChannelInterpretation m_channelInterpretation; |
| 233 }; | 234 }; |
| 234 | 235 |
| 235 } // namespace WebCore | 236 } // namespace WebCore |
| 236 | 237 |
| 237 #endif // AudioNode_h | 238 #endif // AudioNode_h |
| OLD | NEW |