Skip to content

Commit

Permalink
added control to disable doppler
Browse files Browse the repository at this point in the history
  • Loading branch information
themaxw committed Jun 19, 2024
1 parent bce99d8 commit 13816fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions source/PluginParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ juce::AudioProcessorValueTreeState::ParameterLayout PluginParameters::createPara
zRange,
defaultZParam));

params.push_back(std::make_unique<juce::AudioParameterBool>(DOPPLER_ID,
DOPPLER_NAME,
defaultDopplerParam));

params.push_back(std::make_unique<juce::AudioParameterBool>(LFO_START_ID,
LFO_START_NAME,
defaultLFOStartParam));
Expand Down
7 changes: 5 additions & 2 deletions source/PluginParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class PluginParameters {
ZLFO_DEPTH_ID = {"param_zlfo_depth", 1},
ZLFO_PHASE_ID = {"param_zlfo_phase", 1},
ZLFO_OFFSET_ID = {"param_zlfo_offset", 1},
PRESETS_ID = {"param_presets", 1};
PRESETS_ID = {"param_presets", 1},
DOPPLER_ID = {"param_doppler", 1};



Expand All @@ -51,7 +52,8 @@ class PluginParameters {
ZLFO_DEPTH_NAME = "Z LFO Depth",
ZLFO_PHASE_NAME = "Z LFO Phase",
ZLFO_OFFSET_NAME = "Z LFO Offset",
PRESETS_NAME = "Presets";
PRESETS_NAME = "Presets",
DOPPLER_NAME = "Doppler Effect Enabled";



Expand All @@ -66,6 +68,7 @@ class PluginParameters {
const inline static float defaultYParam { 0.f };
const inline static float defaultZParam { 0.f };
const inline static bool defaultLFOStartParam { false };
const inline static bool defaultDopplerParam { false };
const inline static float defaultXLFORateParam { 0.f };
const inline static float defaultXLFODepthParam { 0.f };
const inline static float defaultXLFOPhaseParam { 0.f };
Expand Down
4 changes: 3 additions & 1 deletion source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer,
lastDistanceGain = distanceGain;

// APPLY DELAY
if (true) { // dopplereffect enabled
if (paramDoppler.load()) { // dopplereffect enabled
float doppler_delay = distance / 343 * getSampleRate();
smoothDelayLeft.setTargetValue( delayTimeLeft + doppler_delay);
smoothDelayRight.setTargetValue( delayTimeRight + doppler_delay );
Expand Down Expand Up @@ -303,6 +303,8 @@ void AudioPluginAudioProcessor::parameterChanged(const String &parameterID, floa
requestNewHRIR();
} else if (parameterID == PluginParameters::DIST_ID.getParamID()) {
paramDistance.store(newValue);
} else if (parameterID == PluginParameters::DOPPLER_ID.getParamID()) {
paramDoppler.store(static_cast<bool>(newValue));
}
if (parameterID == PluginParameters::PRESETS_ID.getParamID()) {
int selectedOption = static_cast<int>(newValue);
Expand Down
1 change: 1 addition & 0 deletions source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor, private juc
std::atomic<float> paramElevation { 0.0f };
std::atomic<float> paramDistance { 0.0f };

std::atomic<bool> paramDoppler {false};

custom_juce::Convolution convolution;

Expand Down

0 comments on commit 13816fc

Please sign in to comment.