diff --git a/lib/reverb/Reverb.cc b/lib/reverb/Reverb.cc index e2c071424679..67f4b0ec1c3a 100644 --- a/lib/reverb/Reverb.cc +++ b/lib/reverb/Reverb.cc @@ -434,7 +434,7 @@ Descriptor::setup() // (timrae) we have our left / right samples interleaved in the same array, so use slightly modified version of PlateX2::cycle void MixxxPlateX2::processBuffer(const sample_t* in, sample_t* out, const uint frames, const sample_t bandwidthParam, - const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, bool addDry) { + const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, double wet) { // set bandwidth input.bandwidth.set(exp(-M_PI * (1. - (.005 + .994*bandwidthParam)))); // set decay @@ -454,7 +454,8 @@ void MixxxPlateX2::processBuffer(const sample_t* in, sample_t* out, const uint f sample_t mono_sample = blend * (in[i] + in[i + 1]) / 2; sample_t xl, xr; PlateStub::process(mono_sample, decay, &xl, &xr); - out[i] = xl + (addDry ? in[i] : 0); - out[i + 1] = xr + (addDry ? in[i + 1] : 0); + out[i] = (xl * wet) + (in[i] * (1 - wet)); + out[i + 1] = (xr * wet) + (in[i + 1] * (1 - wet)); } } + diff --git a/lib/reverb/Reverb.h b/lib/reverb/Reverb.h index 8f50ea0c09bd..c40a108b46d3 100644 --- a/lib/reverb/Reverb.h +++ b/lib/reverb/Reverb.h @@ -224,7 +224,7 @@ class PlateX2 class MixxxPlateX2 : public PlateStub { public: void processBuffer(const sample_t* in, sample_t* out, const uint frames, const sample_t bandwidthParam, - const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, bool addDry); + const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, double wet); void init(float sampleRate) { fs = sampleRate; diff --git a/src/effects/native/reverbeffect.cpp b/src/effects/native/reverbeffect.cpp index 319bd52b1309..a34fbfa08461 100644 --- a/src/effects/native/reverbeffect.cpp +++ b/src/effects/native/reverbeffect.cpp @@ -64,7 +64,9 @@ EffectManifestPointer ReverbEffect::getManifest() { send->setName(QObject::tr("Send")); send->setShortName(QObject::tr("Send")); send->setDescription(QObject::tr( - "How much of the signal to send to the effect")); + "How much of the signal to send in to the effect\n" + "Lowering this fades out the effect smoothly\n" + "Use this to adjust the amount of the effect when the effect unit is in D/W mode\n")); send->setControlHint(EffectManifestParameter::ControlHint::KNOB_LINEAR); send->setSemanticHint(EffectManifestParameter::SemanticHint::UNKNOWN); send->setUnitsHint(EffectManifestParameter::UnitsHint::UNKNOWN); @@ -73,6 +75,22 @@ EffectManifestPointer ReverbEffect::getManifest() { send->setMinimum(0); send->setDefault(0); send->setMaximum(1); + + EffectManifestParameterPointer dryWet = pManifest->addParameter(); + dryWet->setId("dry_wet"); + dryWet->setName(QObject::tr("Dry/Wet")); + dryWet->setShortName(QObject::tr("Dry/Wet")); + dryWet->setDescription(QObject::tr( + "Mix between the input (dry) and output (wet) of the effect\n" + "Lowering this fades out the effect abruptly\n" + "Use this to adjust the amount of the effect when the effect unit is in D+W mode")); + dryWet->setControlHint(EffectManifestParameter::ControlHint::KNOB_LINEAR); + dryWet->setSemanticHint(EffectManifestParameter::SemanticHint::UNKNOWN); + dryWet->setUnitsHint(EffectManifestParameter::UnitsHint::UNKNOWN); + dryWet->setMinimum(0); + dryWet->setDefault(1); + dryWet->setMaximum(1); + return pManifest; } @@ -80,7 +98,8 @@ ReverbEffect::ReverbEffect(EngineEffect* pEffect) : m_pDecayParameter(pEffect->getParameterById("decay")), m_pBandWidthParameter(pEffect->getParameterById("bandwidth")), m_pDampingParameter(pEffect->getParameterById("damping")), - m_pSendParameter(pEffect->getParameterById("send_amount")) { + m_pSendParameter(pEffect->getParameterById("send_amount")), + m_pDryWetParameter(pEffect->getParameterById("dry_wet")) { } ReverbEffect::~ReverbEffect() { @@ -96,6 +115,7 @@ void ReverbEffect::processChannel(const ChannelHandle& handle, const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); if (!pState || !m_pDecayParameter || !m_pBandWidthParameter || !m_pDampingParameter || !m_pSendParameter) { qWarning() << "Could not retrieve all effect parameters"; @@ -106,7 +126,7 @@ void ReverbEffect::processChannel(const ChannelHandle& handle, const auto bandwidth = m_pBandWidthParameter->value(); const auto damping = m_pDampingParameter->value(); const auto send = m_pSendParameter->value(); - bool addDry = insertionType == EffectChainInsertionType::Insert; + const double wet = m_pDryWetParameter->value(); // Reinitialize the effect when turning it on to prevent replaying the old buffer // from the last time the effect was enabled. @@ -118,5 +138,5 @@ void ReverbEffect::processChannel(const ChannelHandle& handle, } pState->reverb.processBuffer(pInput, pOutput, bufferParameters.samplesPerBuffer(), - bandwidth, decay, damping, send, addDry); + bandwidth, decay, damping, send, wet); } diff --git a/src/effects/native/reverbeffect.h b/src/effects/native/reverbeffect.h index 1dbb48bd806d..9c6680148e92 100644 --- a/src/effects/native/reverbeffect.h +++ b/src/effects/native/reverbeffect.h @@ -56,6 +56,7 @@ class ReverbEffect : public EffectProcessorImpl { EngineEffectParameter* m_pBandWidthParameter; EngineEffectParameter* m_pDampingParameter; EngineEffectParameter* m_pSendParameter; + EngineEffectParameter* m_pDryWetParameter; DISALLOW_COPY_AND_ASSIGN(ReverbEffect); };