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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void AnalyserNode::process(size_t framesToProcess) | 51 void AnalyserNode::process(size_t framesToProcess) |
52 { | 52 { |
53 AudioBus* outputBus = output(0)->bus(); | 53 AudioBus* outputBus = output(0)->bus(); |
54 | 54 |
55 if (!isInitialized() || !input(0)->isConnected()) { | 55 if (!isInitialized() || !input(0)->isConnected()) { |
56 outputBus->zero(); | 56 outputBus->zero(); |
57 return; | 57 return; |
58 } | 58 } |
59 | 59 |
60 AudioBus* inputBus = input(0)->bus(); | 60 AudioBus* inputBus = input(0)->bus(); |
61 | 61 |
62 // Give the analyser the audio which is passing through this AudioNode. | 62 // Give the analyser the audio which is passing through this AudioNode. |
63 m_analyser.writeInput(inputBus, framesToProcess); | 63 m_analyser.writeInput(inputBus, framesToProcess); |
64 | 64 |
65 // For in-place processing, our override of pullInputs() will just pass the
audio data through unchanged if the channel count matches from input to output | 65 // For in-place processing, our override of pullInputs() will just pass the
audio data through unchanged if the channel count matches from input to output |
66 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo. | 66 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo. |
67 if (inputBus != outputBus) | 67 if (inputBus != outputBus) |
68 outputBus->copyFrom(*inputBus); | 68 outputBus->copyFrom(*inputBus); |
69 } | 69 } |
70 | 70 |
71 void AnalyserNode::reset() | 71 void AnalyserNode::reset() |
72 { | 72 { |
73 m_analyser.reset(); | 73 m_analyser.reset(); |
74 } | 74 } |
75 | 75 |
76 void AnalyserNode::setFftSize(unsigned size, ExceptionState& es) | 76 void AnalyserNode::setFftSize(unsigned size, ExceptionState& es) |
77 { | 77 { |
78 if (!m_analyser.setFftSize(size)) | 78 if (!m_analyser.setFftSize(size)) |
79 es.throwDOMException(NotSupportedError); | 79 es.throwDOMException(NotSupportedError); |
80 } | 80 } |
81 | 81 |
82 } // namespace WebCore | 82 } // namespace WebCore |
83 | 83 |
84 #endif // ENABLE(WEB_AUDIO) | 84 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |