Skip to content

Commit

Permalink
Fixed echo using left buffered samples for right channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
SB committed Jul 24, 2021
1 parent 3dff55a commit 3a25d39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/effects/builtin/echoeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr
bufferedSampleLeft * feedback_ramped);
pGroupState->delay_buf[pGroupState->write_position + 1] = SampleUtil::clampSample(
pInput[i + 1] * send_ramped +
bufferedSampleLeft * feedback_ramped);
bufferedSampleRight * feedback_ramped);

// Pingpong the output. If the pingpong value is zero, all of the
// math below should result in a simple copy of delay buf to pOutput.
Expand Down
20 changes: 10 additions & 10 deletions src/effects/builtin/echoeffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <QMap>

#include "effects/effectprocessor.h"
#include "engine/engine.h"
#include "engine/effects/engineeffect.h"
#include "engine/effects/engineeffectparameter.h"
#include "engine/engine.h"
#include "util/class.h"
#include "util/defs.h"
#include "util/sample.h"
Expand All @@ -20,18 +20,17 @@ class EchoGroupState : public EffectState {
EchoGroupState(const mixxx::EngineParameters& bufferParameters)
: EffectState(bufferParameters) {
audioParametersChanged(bufferParameters);
clear();
clear();
}

void audioParametersChanged(const mixxx::EngineParameters& bufferParameters) {
delay_buf = mixxx::SampleBuffer(kMaxDelaySeconds
* bufferParameters.sampleRate() * bufferParameters.channelCount());
delay_buf = mixxx::SampleBuffer(kMaxDelaySeconds * bufferParameters.sampleRate() * bufferParameters.channelCount());
};

void clear() {
delay_buf.clear();
prev_send = 0.0f;
prev_feedback= 0.0f;
prev_feedback = 0.0f;
prev_delay_samples = 0;
write_position = 0;
ping_pong = 0;
Expand All @@ -53,11 +52,12 @@ class EchoEffect : public EffectProcessorImpl<EchoGroupState> {
static EffectManifestPointer getManifest();

void processChannel(const ChannelHandle& handle,
EchoGroupState* pState,
const CSAMPLE* pInput, CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatures);
EchoGroupState* pState,
const CSAMPLE* pInput,
CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatures);

private:
QString debugString() const {
Expand Down

0 comments on commit 3a25d39

Please sign in to comment.