diff options
author | Be <be@mixxx.org> | 2018-05-20 14:53:24 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2018-05-29 10:27:59 -0500 |
commit | 2b72491ee2a0bd761e0d68600b62ebbb3b89dc6c (patch) | |
tree | 0b36e6a327d35622b2a81dff48871bbf79cf3a9f | |
parent | 4a073e979eff5b7b2753cf6f2645072f0930d271 (diff) |
pass EffectChainInsertionType to effects
so Echo and Reverb do not add the dry signal to their output in "Send"
mode
47 files changed, 127 insertions, 59 deletions
diff --git a/lib/reverb/Reverb.cc b/lib/reverb/Reverb.cc index e9d5ddbba6..e2c0714246 100644 --- a/lib/reverb/Reverb.cc +++ b/lib/reverb/Reverb.cc @@ -434,7 +434,7 @@ Descriptor<PlateX2>::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) { + const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, bool addDry) { // set bandwidth input.bandwidth.set(exp(-M_PI * (1. - (.005 + .994*bandwidthParam)))); // set decay @@ -454,7 +454,7 @@ 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 + in[i]; - out[i + 1] = xr + in[i + 1]; + out[i] = xl + (addDry ? in[i] : 0); + out[i + 1] = xr + (addDry ? in[i + 1] : 0); } } diff --git a/lib/reverb/Reverb.h b/lib/reverb/Reverb.h index ae9591905f..8f50ea0c09 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); + const sample_t decayParam, const sample_t dampingParam, const sample_t blendParam, bool addDry); void init(float sampleRate) { fs = sampleRate; diff --git a/src/effects/builtin/autopaneffect.cpp b/src/effects/builtin/autopaneffect.cpp index b1b76df88c..f8f520131c 100644 --- a/src/effects/builtin/autopaneffect.cpp +++ b/src/effects/builtin/autopaneffect.cpp @@ -91,8 +91,10 @@ void AutoPanEffect::processChannel( const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); + Q_UNUSED(insertionType); if (enableState == EffectEnableState::Disabled) { return; diff --git a/src/effects/builtin/autopaneffect.h b/src/effects/builtin/autopaneffect.h index c10f265d21..c59f98b9cd 100644 --- a/src/effects/builtin/autopaneffect.h +++ b/src/effects/builtin/autopaneffect.h @@ -90,7 +90,8 @@ class AutoPanEffect : public EffectProcessorImpl<AutoPanGroupState> { const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures); + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType); double computeLawCoefficient(double position); diff --git a/src/effects/builtin/balanceeffect.cpp b/src/effects/builtin/balanceeffect.cpp index b4ca00aeda..b6bcd42be2 100644 --- a/src/effects/builtin/balanceeffect.cpp +++ b/src/effects/builtin/balanceeffect.cpp @@ -110,9 +110,11 @@ void BalanceEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); CSAMPLE_GAIN balance = 0; CSAMPLE_GAIN midSide = 0; diff --git a/src/effects/builtin/balanceeffect.h b/src/effects/builtin/balanceeffect.h index 7276e51423..97969df164 100644 --- a/src/effects/builtin/balanceeffect.h +++ b/src/effects/builtin/balanceeffect.h @@ -40,7 +40,8 @@ class BalanceEffect : public EffectProcessorImpl<BalanceGroupState> { const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures); + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType); private: diff --git a/src/effects/builtin/bessel4lvmixeqeffect.cpp b/src/effects/builtin/bessel4lvmixeqeffect.cpp index d04873ca60..5cde80694d 100644 --- a/src/effects/builtin/bessel4lvmixeqeffect.cpp +++ b/src/effects/builtin/bessel4lvmixeqeffect.cpp @@ -46,9 +46,11 @@ void Bessel4LVMixEQEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); if (enableState == EffectEnableState::Disabling) { // Ramp to dry, when disabling, this will ramp from dry when enabling as well diff --git a/src/effects/builtin/bessel4lvmixeqeffect.h b/src/effects/builtin/bessel4lvmixeqeffect.h index 87ac83bd9b..216bd4fa74 100644 --- a/src/effects/builtin/bessel4lvmixeqeffect.h +++ b/src/effects/builtin/bessel4lvmixeqeffect.h @@ -37,7 +37,8 @@ class Bessel4LVMixEQEffect : public EffectProcessorImpl<Bessel4LVMixEQEffectGrou const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/bessel8lvmixeqeffect.cpp b/src/effects/builtin/bessel8lvmixeqeffect.cpp index f119f65521..398ca72eca 100644 --- a/src/effects/builtin/bessel8lvmixeqeffect.cpp +++ b/src/effects/builtin/bessel8lvmixeqeffect.cpp @@ -46,9 +46,11 @@ void Bessel8LVMixEQEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); if (enableState == EffectEnableState::Disabling) { diff --git a/src/effects/builtin/bessel8lvmixeqeffect.h b/src/effects/builtin/bessel8lvmixeqeffect.h index a65a21dad8..ed9435aa59 100644 --- a/src/effects/builtin/bessel8lvmixeqeffect.h +++ b/src/effects/builtin/bessel8lvmixeqeffect.h @@ -40,7 +40,8 @@ class Bessel8LVMixEQEffect : public EffectProcessorImpl<Bessel8LVMixEQEffectGrou const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/biquadfullkilleqeffect.cpp b/src/effects/builtin/biquadfullkilleqeffect.cpp index 6adba364a1..f24e4312db 100644 --- a/src/effects/builtin/biquadfullkilleqeffect.cpp +++ b/src/effects/builtin/biquadfullkilleqeffect.cpp @@ -156,9 +156,11 @@ void BiquadFullKillEQEffect::processChannel( CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); if (pState->m_oldSampleRate != bufferParameters.sampleRate() || (pState->m_loFreqCorner != m_pLoFreqCorner->get()) || diff --git a/src/effects/builtin/biquadfullkilleqeffect.h b/src/effects/builtin/biquadfullkilleqeffect.h index 4b016058a7..5b4f5f9f07 100644 --- a/src/effects/builtin/biquadfullkilleqeffect.h +++ b/src/effects/builtin/biquadfullkilleqeffect.h @@ -72,7 +72,8 @@ class BiquadFullKillEQEffect : public EffectProcessorImpl<BiquadFullKillEQEffect const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: BiquadFullKillEQEffect(const BiquadFullKillEQEffect&) = delete; diff --git a/src/effects/builtin/bitcrushereffect.cpp b/src/effects/builtin/bitcrushereffect.cpp index 04dc81884f..96ad71c2c7 100644 --- a/src/effects/builtin/bitcrushereffect.cpp +++ b/src/effects/builtin/bitcrushereffect.cpp @@ -71,9 +71,11 @@ void BitCrusherEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); Q_UNUSED(enableState); // no need to ramp, it is just a bitcrusher ;-) const CSAMPLE downsample = m_pDownsampleParameter ? diff --git a/src/effects/builtin/bitcrushereffect.h b/src/effects/builtin/bitcrushereffect.h index 88d102719c..f9966da8a3 100644 --- a/src/effects/builtin/bitcrushereffect.h +++ b/src/effects/builtin/bitcrushereffect.h @@ -37,7 +37,8 @@ class BitCrusherEffect : public EffectProcessorImpl<BitCrusherGroupState> { const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/echoeffect.cpp b/src/effects/builtin/echoeffect.cpp index 1d0451d75d..4766dac4e2 100644 --- a/src/effects/builtin/echoeffect.cpp +++ b/src/effects/builtin/echoeffect.cpp @@ -134,7 +134,8 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); EchoGroupState& gs = *pGroupState; @@ -184,6 +185,8 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr bufferParameters.framesPerBuffer(); const CSAMPLE_GAIN feedback_start = gs.prev_feedback + feedback_delta; + const bool addDry = insertionType == EffectChainInsertionType::Insert; + //TODO: rewrite to remove assumption of stereo buffer for (unsigned int i = 0; i < bufferParameters.samplesPerBuffer(); @@ -221,19 +224,19 @@ void EchoEffect::processChannel(const ChannelHandle& handle, EchoGroupState* pGr if (gs.ping_pong < delay_samples / 2) { // Left sample plus a fraction of the right sample, normalized // by 1 + fraction. - pOutput[i] = pInput[i] + + pOutput[i] = (addDry ? pInput[i] : 0) + ((bufferedSampleLeft + bufferedSampleRight * pingpong_frac) / (1 + pingpong_frac)); // Right sample reduced by (1 - fraction) - pOutput[i + 1] = pInput[i + 1] + + pOutput[i + 1] = (addDry ? pInput[i + 1] : 0) + (bufferedSampleRight * (1 - pingpong_frac)); } else { // Left sample reduced by (1 - fraction) - pOutput[i] = pInput[i] + + pOutput[i] = (addDry ? pInput[i] : 0) + (bufferedSampleLeft * (1 - pingpong_frac)); // Right sample plus fraction of left sample, normalized by // 1 + fraction - pOutput[i + 1] = pInput[i + 1] + + pOutput[i + 1] = (addDry ? pInput[i + 1] : 0) + ((bufferedSampleRight + bufferedSampleLeft * pingpong_frac) / (1 + pingpong_frac)); } diff --git a/src/effects/builtin/echoeffect.h b/src/effects/builtin/echoeffect.h index e49227b0dd..5fea1c0c4f 100644 --- a/src/effects/builtin/echoeffect.h +++ b/src/effects/builtin/echoeffect.h @@ -58,7 +58,8 @@ class EchoEffect : public EffectProcessorImpl<EchoGroupState> { const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) override; + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) override; private: QString debugString() const { diff --git a/src/effects/builtin/filtereffect.cpp b/src/effects/builtin/filtereffect.cpp index aece10b9a0..91f4bed766 100644 --- a/src/effects/builtin/filtereffect.cpp +++ b/src/effects/builtin/filtereffect.cpp @@ -100,9 +100,11 @@ void FilterEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); double hpf; double lpf; diff --git a/src/effects/builtin/filtereffect.h b/src/effects/builtin/filtereffect.h index 2d96226c8d..78831ad803 100644 --- a/src/effects/builtin/filtereffect.h +++ b/src/effects/builtin/filtereffect.h @@ -41,7 +41,8 @@ class FilterEffect : public EffectProcessorImpl<FilterGroupState> { const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures); + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/flangereffect.cpp b/src/effects/builtin/flangereffect.cpp index a4e39d709d..29c570e4b9 100644 --- a/src/effects/builtin/flangereffect.cpp +++ b/src/effects/builtin/flangereffect.cpp @@ -134,8 +134,10 @@ void FlangerEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); + Q_UNUSED(insertionType); double lfoPeriodParameter = m_pSpeedParameter->value(); double lfoPeriodFrames; diff --git a/src/effects/builtin/flangereffect.h b/src/effects/builtin/flangereffect.h index f87b2b30ef..da190ffd15 100644 --- a/src/effects/builtin/flangereffect.h +++ b/src/effects/builtin/flangereffect.h @@ -61,7 +61,8 @@ class FlangerEffect : public EffectProcessorImpl<FlangerGroupState> { const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures); + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/graphiceqeffect.cpp b/src/effects/builtin/graphiceqeffect.cpp index d73ea07c71..85a57093ed 100644 --- a/src/effects/builtin/graphiceqeffect.cpp +++ b/src/effects/builtin/graphiceqeffect.cpp @@ -150,9 +150,11 @@ void GraphicEQEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); // If the sample rate has changed, initialize the filters using the new // sample rate diff --git a/src/effects/builtin/graphiceqeffect.h b/src/effects/builtin/graphiceqeffect.h index 673f6efe88..6c049028ce 100644 --- a/src/effects/builtin/graphiceqeffect.h +++ b/src/effects/builtin/graphiceqeffect.h @@ -44,7 +44,8 @@ class GraphicEQEffect : public EffectProcessorImpl<GraphicEQEffectGroupState> { const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/linkwitzriley8eqeffect.cpp b/src/effects/builtin/linkwitzriley8eqeffect.cpp index 61ee64b401..7faf145712 100644 --- a/src/effects/builtin/linkwitzriley8eqeffect.cpp +++ b/src/effects/builtin/linkwitzriley8eqeffect.cpp @@ -87,9 +87,11 @@ void LinkwitzRiley8EQEffect::processChannel(const ChannelHandle& handle, const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); float fLow = 0.f, fMid = 0.f, fHigh = 0.f; if (!m_pKillLow->toBool()) { diff --git a/src/effects/builtin/linkwitzriley8eqeffect.h b/src/effects/builtin/linkwitzriley8eqeffect.h index 5cbd729660..e21df2ebad 100644 --- a/src/effects/builtin/linkwitzriley8eqeffect.h +++ b/src/effects/builtin/linkwitzriley8eqeffect.h @@ -53,7 +53,8 @@ class LinkwitzRiley8EQEffect : public EffectProcessorImpl<LinkwitzRiley8EQEffect const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: QString debugString() const { diff --git a/src/effects/builtin/loudnesscontoureffect.cpp b/src/effects/builtin/loudnesscontoureffect.cpp index fd1781f73b..df83b3a9ed 100644 --- a/src/effects/builtin/loudnesscontoureffect.cpp +++ b/src/effects/builtin/loudnesscontoureffect.cpp @@ -110,9 +110,11 @@ void LoudnessContourEffect::processChannel( CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); Q_UNUSED(groupFeatures); + Q_UNUSED(insertionType); double filterGainDb = pState->m_oldFilterGainDb; double gain = pState->m_oldGain; diff --git a/src/effects/builtin/loudnesscontoureffect.h b/src/effects/builtin/loudnesscontoureffect.h index ccff153543..d70f08c779 100644 --- a/src/effects/builtin/loudnesscontoureffect.h +++ b/src/effects/builtin/loudnesscontoureffect.h @@ -47,7 +47,8 @@ class LoudnessContourEffect const CSAMPLE* pInput, CSAMPLE *pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatureState); + const GroupFeatureState& groupFeatureState, + const EffectChainInsertionType insertionType); private: LoudnessContourEffect(const LoudnessContourEffect&) = delete; diff --git a/src/effects/builtin/metronomeeffect.cpp b/src/effects/builtin/metronomeeffect.cpp index 9bcc956b8c..29cfb6fa09 100644 --- a/src/effects/builtin/metronomeeffect.cpp +++ b/src/effects/builtin/metronomeeffect.cpp @@ -66,8 +66,10 @@ void MetronomeEffect::processChannel( const CSAMPLE* pInput, CSAMPLE* pOutput, const mixxx::EngineParameters& bufferParameters, const EffectEnableState enableState, - const GroupFeatureState& groupFeatures) { + const GroupFeatureState& groupFeatures, + const EffectChainInsertionType insertionType) { Q_UNUSED(handle); + Q_UNUSED(insertionType); Q_UNUSED(pInput); |