From ce7891b7bd62ade0843eef924307626a82a2de02 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 16 Sep 2009 20:26:47 -0700 Subject: [PATCH] Fix mixer sends rendering in the backend Fixed: Buffers was cleared too early resulting in some combinations of sends not working. --- src/core/FxMixer.cpp | 2 -- src/core/mixer.cpp | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index b2dd852e2..03aa9b2da 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -215,8 +215,6 @@ void FxMixer::processChannel( fx_ch_t _ch, sampleFrame * _buf ) _buf[f][0] += ch_buf[f][0] * v * amt; _buf[f][1] += ch_buf[f][1] * v * amt; } - engine::getMixer()->clearAudioBuffer( ch_buf, - engine::getMixer()->framesPerPeriod() ); } diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index 819ef0be2..b33e4c49f 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -503,6 +503,8 @@ sampleFrameA * mixer::renderNextBuffer() MicroTimer timer; static song::playPos last_metro_pos = -1; + FxMixer * fxm = engine::fxMixer(); + song::playPos p = engine::getSong()->getPlayPos( song::Mode_PlayPattern ); if( engine::getSong()->playMode() == song::Mode_PlayPattern && @@ -556,7 +558,7 @@ sampleFrameA * mixer::renderNextBuffer() clearAudioBuffer( m_writeBuf, m_framesPerPeriod ); // prepare master mix (clear internal buffers etc.) - engine::fxMixer()->prepareMasterMix(); + fxm->prepareMasterMix(); // create play-handles for new notes, samples etc. engine::getSong()->processNextBuffer(); @@ -606,10 +608,17 @@ sampleFrameA * mixer::renderNextBuffer() // STAGE 4: do master mix in FX mixer - engine::fxMixer()->masterMix( m_writeBuf ); + fxm->masterMix( m_writeBuf ); WAIT_FOR_JOBS(); + // clear all channel buffers + for( int i = 0; i < fxm->numChannels(); ++i) + { + engine::getMixer()->clearAudioBuffer( fxm->effectChannel(i)->m_buffer, + engine::getMixer()->framesPerPeriod() ); + } + unlock();