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

Method process

src/core/ChannelMergerNode.cpp:41–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void ChannelMergerNode::process(ContextRenderLock & r, int bufferSize)
42{
43 auto output = this->output(0);
44 ASSERT_UNUSED(bufferSize, bufferSize == output->bus(r)->length());
45
46 if (m_desiredNumberOfOutputChannels != output->numberOfChannels())
47 {
48 output->setNumberOfChannels(r, m_desiredNumberOfOutputChannels);
49 }
50
51 // Merge all the the zero-etch channels from all the inputs into one output.
52 /* Per the spec, a channel merge node takes a bunch of mono inputs.
53 The processing should be as follows
54
55 let a = number of input channels
56 let b = number of output channels
57
58 if a == b copy 1:1
59 if a < b copy 1:1 up to a, then zero the other channels
60 if b < a copy 1:1 up to b, then ignore the other channels
61 */
62
63 for (int i = 0; i < m_desiredNumberOfOutputChannels; ++i)
64 {
65 // initialize sum
66 output->bus(r)->channel(i)->zero();
67 }
68
69 int in = numberOfInputs();
70 for (int c = 0; c < m_desiredNumberOfOutputChannels; ++c)
71 {
72 AudioChannel * outputChannel = output->bus(r)->channel(c);
73 if (c < in)
74 {
75 auto input = this->input(c);
76 if (input->isConnected())
77 {
78 AudioChannel * inputChannel = input->bus(r)->channel(0);
79 outputChannel->sumFrom(inputChannel);
80 }
81 }
82 }
83}
84
85
86} // namespace lab

Callers

nothing calls this directly

Calls 10

outputMethod · 0.80
channelMethod · 0.80
inputMethod · 0.80
lengthMethod · 0.45
busMethod · 0.45
numberOfChannelsMethod · 0.45
setNumberOfChannelsMethod · 0.45
zeroMethod · 0.45
isConnectedMethod · 0.45
sumFromMethod · 0.45

Tested by

no test coverage detected