Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/modules/webaudio/AudioBasicProcessorNode.cpp

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 ASSERT(processor()); 64 ASSERT(processor());
65 processor()->uninitialize(); 65 processor()->uninitialize();
66 66
67 AudioNode::uninitialize(); 67 AudioNode::uninitialize();
68 } 68 }
69 69
70 void AudioBasicProcessorNode::process(size_t framesToProcess) 70 void AudioBasicProcessorNode::process(size_t framesToProcess)
71 { 71 {
72 AudioBus* destinationBus = output(0)->bus(); 72 AudioBus* destinationBus = output(0)->bus();
73 73
74 if (!isInitialized() || !processor() || processor()->numberOfChannels() != n umberOfChannels()) 74 if (!isInitialized() || !processor() || processor()->numberOfChannels() != n umberOfChannels())
75 destinationBus->zero(); 75 destinationBus->zero();
76 else { 76 else {
77 AudioBus* sourceBus = input(0)->bus(); 77 AudioBus* sourceBus = input(0)->bus();
78 78
79 // FIXME: if we take "tail time" into account, then we can avoid calling processor()->process() once the tail dies down. 79 // FIXME: if we take "tail time" into account, then we can avoid calling processor()->process() once the tail dies down.
80 if (!input(0)->isConnected()) 80 if (!input(0)->isConnected())
81 sourceBus->zero(); 81 sourceBus->zero();
82 82
83 processor()->process(sourceBus, destinationBus, framesToProcess); 83 processor()->process(sourceBus, destinationBus, framesToProcess);
84 } 84 }
85 } 85 }
86 86
87 // Nice optimization in the very common case allowing for "in-place" processing 87 // Nice optimization in the very common case allowing for "in-place" processing
88 void AudioBasicProcessorNode::pullInputs(size_t framesToProcess) 88 void AudioBasicProcessorNode::pullInputs(size_t framesToProcess)
89 { 89 {
90 // Render input stream - suggest to the input to render directly into output bus for in-place processing in process() if possible. 90 // Render input stream - suggest to the input to render directly into output bus for in-place processing in process() if possible.
91 input(0)->pull(output(0)->bus(), framesToProcess); 91 input(0)->pull(output(0)->bus(), framesToProcess);
92 } 92 }
93 93
94 void AudioBasicProcessorNode::reset() 94 void AudioBasicProcessorNode::reset()
95 { 95 {
96 if (processor()) 96 if (processor())
97 processor()->reset(); 97 processor()->reset();
98 } 98 }
99 99
100 // As soon as we know the channel count of our input, we can lazily initialize. 100 // As soon as we know the channel count of our input, we can lazily initialize.
101 // Sometimes this may be called more than once with different channel counts, in which case we must safely 101 // Sometimes this may be called more than once with different channel counts, in which case we must safely
102 // uninitialize and then re-initialize with the new channel count. 102 // uninitialize and then re-initialize with the new channel count.
103 void AudioBasicProcessorNode::checkNumberOfChannelsForInput(AudioNodeInput* inpu t) 103 void AudioBasicProcessorNode::checkNumberOfChannelsForInput(AudioNodeInput* inpu t)
104 { 104 {
105 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 105 ASSERT(context()->isAudioThread() && context()->isGraphOwner());
106 106
107 ASSERT(input == this->input(0)); 107 ASSERT(input == this->input(0));
108 if (input != this->input(0)) 108 if (input != this->input(0))
109 return; 109 return;
110 110
111 ASSERT(processor()); 111 ASSERT(processor());
112 if (!processor()) 112 if (!processor())
113 return; 113 return;
114 114
115 unsigned numberOfChannels = input->numberOfChannels(); 115 unsigned numberOfChannels = input->numberOfChannels();
116 116
117 if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) { 117 if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) {
118 // We're already initialized but the channel count has changed. 118 // We're already initialized but the channel count has changed.
119 uninitialize(); 119 uninitialize();
120 } 120 }
121 121
122 if (!isInitialized()) { 122 if (!isInitialized()) {
123 // This will propagate the channel count to any nodes connected further down the chain... 123 // This will propagate the channel count to any nodes connected further down the chain...
124 output(0)->setNumberOfChannels(numberOfChannels); 124 output(0)->setNumberOfChannels(numberOfChannels);
125 125
126 // Re-initialize the processor with the new channel count. 126 // Re-initialize the processor with the new channel count.
127 processor()->setNumberOfChannels(numberOfChannels); 127 processor()->setNumberOfChannels(numberOfChannels);
128 initialize(); 128 initialize();
129 } 129 }
130 130
131 AudioNode::checkNumberOfChannelsForInput(input); 131 AudioNode::checkNumberOfChannelsForInput(input);
(...skipping 10 matching lines...) Expand all
142 } 142 }
143 143
144 double AudioBasicProcessorNode::latencyTime() const 144 double AudioBasicProcessorNode::latencyTime() const
145 { 145 {
146 return m_processor->latencyTime(); 146 return m_processor->latencyTime();
147 } 147 }
148 148
149 } // namespace WebCore 149 } // namespace WebCore
150 150
151 #endif // ENABLE(WEB_AUDIO) 151 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioBasicProcessorNode.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698