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

Method pull

src/core/AudioNodeOutput.cpp:97–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97AudioBus * AudioNodeOutput::pull(ContextRenderLock & r, AudioBus * inPlaceBus, int bufferSize)
98{
99 ASSERT(r.context());
100 ASSERT(m_renderingFanOutCount > 0 || m_renderingParamFanOutCount > 0);
101
102 m_internalBus->setSampleRate(r.context()->sampleRate());
103 bus(r)->setSampleRate(r.context()->sampleRate());
104
105 // Causes our AudioNode to process if it hasn't already for this render quantum.
106 // We try to do in-place processing (using inPlaceBus) if at all possible,
107 // but we can't process in-place if we're connected to more than one input (fan-out > 1).
108 // In this case pull() is called multiple times per rendering quantum, and the processIfNecessary() call below will
109 // cause our node to process() only the first time, caching the output in m_internalOutputBus for subsequent calls.
110
111 updateRenderingState(r);
112
113 bool useInPlaceBus = inPlaceBus && inPlaceBus->numberOfChannels() == numberOfChannels() && (m_renderingFanOutCount + m_renderingParamFanOutCount) == 1;
114
115 // Setup the actual destination bus for processing when our node's process() method gets called in processIfNecessary() below.
116 m_inPlaceBus = useInPlaceBus ? inPlaceBus : 0;
117
118 auto n = sourceNode();
119 if (!n)
120 return bus(r);
121
122 n->processIfNecessary(r, bufferSize);
123 return bus(r);
124}
125
126AudioBus * AudioNodeOutput::bus(ContextRenderLock & r) const
127{

Callers

nothing calls this directly

Calls 5

processIfNecessaryMethod · 0.80
contextMethod · 0.45
setSampleRateMethod · 0.45
sampleRateMethod · 0.45
numberOfChannelsMethod · 0.45

Tested by

no test coverage detected