JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_DryWetMixer.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce::dsp
27{
28
29enum class DryWetMixingRule
30{
31 linear, // dry volume is equal to 1 - wet volume
32 balanced, // both dry and wet are 1 when mix is 0.5, with dry decreasing to 0
33 // above this value and wet decreasing to 0 below it
34 sin3dB, // alternate dry/wet mixing rule using the 3 dB sine panning rule
35 sin4p5dB, // alternate dry/wet mixing rule using the 4.5 dB sine panning rule
36 sin6dB, // alternate dry/wet mixing rule using the 6 dB sine panning rule
37 squareRoot3dB, // alternate dry/wet mixing rule using the regular 3 dB panning rule
38 squareRoot4p5dB // alternate dry/wet mixing rule using the regular 4.5 dB panning rule
39};
40
50template <typename SampleType>
52{
53public:
54 //==============================================================================
55 using MixingRule = DryWetMixingRule;
56
57 //==============================================================================
60
62 explicit DryWetMixer (int maximumWetLatencyInSamples);
63
64 //==============================================================================
66 void setMixingRule (MixingRule newRule);
67
72
77 void setWetLatency (SampleType wetLatencyInSamples);
78
79 //==============================================================================
81 void prepare (const ProcessSpec& spec);
82
84 void reset();
85
86 //==============================================================================
89
100
101private:
102 //==============================================================================
103 void update();
104
105 //==============================================================================
108 AudioBuffer<SampleType> bufferDry;
109
111 SampleType mix = 1.0;
112 MixingRule currentMixingRule = MixingRule::linear;
113 double sampleRate = 44100.0;
114 int maximumWetLatencyInSamples = 0;
115};
116
117} // namespace juce::dsp
A multi-channel buffer containing floating point audio samples.
Encapsulates the logic for a single-threaded FIFO.
A utility class for values that need smoothing to avoid audio glitches.
Minimal and lightweight data-structure which contains a list of pointers to channels containing some ...
A delay line processor featuring several algorithms for the fractional delay calculation,...
A processor to handle dry/wet mixing of two audio signals, where the wet signal may have additional l...
void pushDrySamples(const AudioBlock< const SampleType > drySamples)
Copies the dry path samples into an internal delay line.
void setWetMixProportion(SampleType newWetMixProportion)
Sets the current dry/wet mix proportion, with 0.0 being full dry and 1.0 being fully wet.
void reset()
Resets the internal state variables of the processor.
void setMixingRule(MixingRule newRule)
Sets the mix rule.
void setWetLatency(SampleType wetLatencyInSamples)
Sets the relative latency of the wet signal path compared to the dry signal path, and thus the amount...
void prepare(const ProcessSpec &spec)
Initialises the processor.
void mixWetSamples(AudioBlock< SampleType > wetSamples)
Mixes the supplied wet samples with the latency-compensated dry samples from pushDrySamples.
DryWetMixer()
Default constructor.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...