From 0f37bd13eed37ee2ce9b0f860d3feae39dee4a54 Mon Sep 17 00:00:00 2001 From: Vesa Date: Sat, 26 Apr 2014 07:30:23 +0300 Subject: [PATCH] FxMixer - Further optimization: skip copying buffers if we know the sender has no meaningful input to copy --- src/core/FxMixer.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index 52781099e..d2c79a972 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -101,17 +101,20 @@ void FxChannel::doProcessing( sampleFrame * _buf ) sender->process(); } - // get the send level... - const float amt = - fxm->channelSendModel( senderIndex, m_channelIndex )->value(); - - // mix it's output with this one's output - sampleFrame * ch_buf = sender->m_buffer; - const float v = sender->m_volumeModel.value() * amt; - for( f_cnt_t f = 0; f < fpp; ++f ) + if( sender->m_hasInput || sender->m_stillRunning ) { - _buf[f][0] += ch_buf[f][0] * v; - _buf[f][1] += ch_buf[f][1] * v; + // get the send level... + const float amt = + fxm->channelSendModel( senderIndex, m_channelIndex )->value(); + + // mix it's output with this one's output + sampleFrame * ch_buf = sender->m_buffer; + const float v = sender->m_volumeModel.value() * amt; + for( f_cnt_t f = 0; f < fpp; ++f ) + { + _buf[f][0] += ch_buf[f][0] * v; + _buf[f][1] += ch_buf[f][1] * v; + } } // if sender channel hasInput, then we hasInput too