Skip to content

Commit 26a3648

Browse files
authored
Merge pull request #185 from kmichaelfox/fix/audionode_efficiency
Improve the efficiency of AudioNode's audio monitoring
2 parents 8c1b871 + 82e2086 commit 26a3648

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Source/Processors/AudioNode/AudioNode.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ void AudioNode::recreateBuffers()
197197

198198
}
199199

200-
tempBuffer->setSize(getNumInputs(), 4096);
200+
// tempBuffer->setSize(getNumInputs(), 4096);
201+
tempBuffer->setSize(1, 4096);
201202
}
202203

203204
bool AudioNode::enable()
@@ -244,14 +245,14 @@ void AudioNode::process(AudioSampleBuffer& buffer)
244245
if (dataChannelArray.size() > 0) // we have some channels
245246
{
246247

247-
tempBuffer->clear();
248+
// tempBuffer->clear();
248249

249250
for (int i = 0; i < buffer.getNumChannels()-2; i++) // cycle through them all
250251
{
251-
252+
252253
if (dataChannelArray[i]->isMonitored())
253254
{
254-
255+
tempBuffer->clear();
255256
//std::cout << "Processing channel " << i << std::endl;
256257

257258
if (!bufferSwap[i])
@@ -335,7 +336,8 @@ void AudioNode::process(AudioSampleBuffer& buffer)
335336
if (samplesToCopyFromIncomingBuffer > 0)
336337
{
337338

338-
tempBuffer->addFrom(i, // destination channel
339+
//tempBuffer->addFrom(i, // destination channel
340+
tempBuffer->addFrom(0, // destination channel
339341
samplesToCopyFromOverflowBuffer, // destination start sample
340342
buffer, // source
341343
i+2, // source channel (add 2 to account for output channels)
@@ -403,15 +405,17 @@ void AudioNode::process(AudioSampleBuffer& buffer)
403405
buffer.addFrom(0, // destChannel
404406
destBufferPos, // destSampleOffset
405407
*tempBuffer, // source
406-
i, // sourceChannel
408+
//i, // sourceChannel
409+
0, // sourceChannel
407410
sourceBufferPos,// sourceSampleOffset
408411
1, // number of samples
409412
invAlpha*gain); // gain to apply to source
410413

411414
buffer.addFrom(0, // destChannel
412415
destBufferPos, // destSampleOffset
413416
*tempBuffer, // source
414-
i, // sourceChannel
417+
//i, // sourceChannel
418+
0, // sourceChannel
415419
nextPos, // sourceSampleOffset
416420
1, // number of samples
417421
alpha*gain); // gain to apply to source

0 commit comments

Comments
 (0)