MCPcopy Create free account
hub / github.com/LabSound/LabSound / pull

Method pull

src/core/AudioNodeInput.cpp:139–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139AudioBus * AudioNodeInput::pull(ContextRenderLock & r, AudioBus * inPlaceBus, int bufferSize)
140{
141 updateRenderingState(r);
142 m_destinationNode->checkNumberOfChannelsForInput(r, this);
143
144 size_t num_connections = numberOfRenderingConnections(r);
145
146 // Handle single connection case.
147 if (num_connections == 1)
148 {
149 // If this input is simply passing data through, then immediately delegate the pull request to it.
150 auto output = renderingOutput(r, 0);
151 if (output)
152 {
153 return output->pull(r, inPlaceBus, bufferSize);
154 }
155
156 num_connections = 0; // if there's a single input, but it has no output; treat this input as silent.
157 }
158
159 if (num_connections == 0)
160 {
161 // Generate silence if we're not connected to anything, and return the silent bus
162 /// @TODO a possible optimization is to flag silence and propagate it to consumers of this input.
163 m_internalSummingBus->zero();
164 return m_internalSummingBus.get();
165 }
166
167 // multiple connections
168 m_internalSummingBus->zero();
169
170 for (int i = 0; i < num_connections; ++i)
171 {
172 auto output = renderingOutput(r, i);
173 if (output)
174 {
175 // Render audio from this output.
176 AudioBus * connectionBus = output->pull(r, 0, bufferSize);
177
178 // Sum, with unity-gain.
179 m_internalSummingBus->sumFrom(*connectionBus);
180 }
181 }
182 return m_internalSummingBus.get();
183}
184
185} // namespace lab

Callers 4

processMethod · 0.45
pullInputsMethod · 0.45
calculateFinalValuesMethod · 0.45
pull_graphMethod · 0.45

Calls 4

getMethod · 0.80
zeroMethod · 0.45
sumFromMethod · 0.45

Tested by

no test coverage detected