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 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #if ENABLE(WEB_AUDIO) | 26 #if ENABLE(WEB_AUDIO) |
27 #include "modules/webaudio/AudioDestinationNode.h" | 27 #include "modules/webaudio/AudioDestinationNode.h" |
28 | 28 |
29 #include "modules/webaudio/AudioContext.h" | 29 #include "modules/webaudio/AudioContext.h" |
30 #include "modules/webaudio/AudioNodeInput.h" | 30 #include "modules/webaudio/AudioNodeInput.h" |
31 #include "modules/webaudio/AudioNodeOutput.h" | 31 #include "modules/webaudio/AudioNodeOutput.h" |
32 #include "platform/audio/AudioUtilities.h" | 32 #include "platform/audio/AudioUtilities.h" |
33 #include "platform/audio/DenormalDisabler.h" | 33 #include "platform/audio/DenormalDisabler.h" |
34 #include "wtf/Atomics.h" | |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node, float sampleRa te) | 38 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node, float sampleRa te) |
38 : AudioHandler(NodeTypeDestination, node, sampleRate) | 39 : AudioHandler(NodeTypeDestination, node, sampleRate) |
39 , m_currentSampleFrame(0) | 40 , m_currentSampleFrame(0) |
40 { | 41 { |
41 addInput(); | 42 addInput(); |
42 } | 43 } |
43 | 44 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 destinationBus->copyFrom(*renderedBus); | 84 destinationBus->copyFrom(*renderedBus); |
84 } | 85 } |
85 | 86 |
86 // Process nodes which need a little extra help because they are not connect ed to anything, but still need to process. | 87 // Process nodes which need a little extra help because they are not connect ed to anything, but still need to process. |
87 context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames); | 88 context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames); |
88 | 89 |
89 // Let the context take care of any business at the end of each render quant um. | 90 // Let the context take care of any business at the end of each render quant um. |
90 context()->handlePostRenderTasks(); | 91 context()->handlePostRenderTasks(); |
91 | 92 |
92 // Advance current sample-frame. | 93 // Advance current sample-frame. |
93 m_currentSampleFrame += numberOfFrames; | 94 atomicAdd(&m_currentSampleFrame, numberOfFrames); |
tkent
2015/05/22 00:47:12
I don't think using atomicAdd() here is correct.
a
Raymond Toy
2015/05/22 16:13:48
Done. Thanks for the hint.
| |
94 } | 95 } |
95 | 96 |
96 // ---------------------------------------------------------------- | 97 // ---------------------------------------------------------------- |
97 | 98 |
98 AudioDestinationNode::AudioDestinationNode(AudioContext& context) | 99 AudioDestinationNode::AudioDestinationNode(AudioContext& context) |
99 : AudioNode(context) | 100 : AudioNode(context) |
100 { | 101 { |
101 } | 102 } |
102 | 103 |
103 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const | 104 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const |
104 { | 105 { |
105 return static_cast<AudioDestinationHandler&>(handler()); | 106 return static_cast<AudioDestinationHandler&>(handler()); |
106 } | 107 } |
107 | 108 |
108 unsigned long AudioDestinationNode::maxChannelCount() const | 109 unsigned long AudioDestinationNode::maxChannelCount() const |
109 { | 110 { |
110 return audioDestinationHandler().maxChannelCount(); | 111 return audioDestinationHandler().maxChannelCount(); |
111 } | 112 } |
112 | 113 |
113 } // namespace blink | 114 } // namespace blink |
114 | 115 |
115 #endif // ENABLE(WEB_AUDIO) | 116 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |