30template <
typename SampleType>
38template <
typename SampleType>
41 currentRule = newRule;
45template <
typename SampleType>
48 jassert (newPan >= -1.0 && newPan <= 1.0);
50 pan = jlimit (
static_cast<SampleType
> (-1.0),
static_cast<SampleType
> (1.0), newPan);
55template <
typename SampleType>
66template <
typename SampleType>
69 leftVolume .reset (sampleRate, 0.05);
70 rightVolume.reset (sampleRate, 0.05);
74template <
typename SampleType>
77 SampleType leftValue, rightValue, boostValue;
79 auto normalisedPan =
static_cast<SampleType
> (0.5) * (pan +
static_cast<SampleType
> (1.0));
84 leftValue = jmin (
static_cast<SampleType
> (0.5),
static_cast<SampleType
> (1.0) - normalisedPan);
85 rightValue = jmin (
static_cast<SampleType
> (0.5), normalisedPan);
86 boostValue =
static_cast<SampleType
> (2.0);
90 leftValue =
static_cast<SampleType
> (1.0) - normalisedPan;
91 rightValue = normalisedPan;
92 boostValue =
static_cast<SampleType
> (2.0);
98 boostValue = std::sqrt (
static_cast<SampleType
> (2.0));
102 leftValue =
static_cast<SampleType
> (std::pow (std::sin (0.5 *
MathConstants<double>::pi * (1.0 - normalisedPan)), 1.5));
104 boostValue =
static_cast<SampleType
> (std::pow (2.0, 3.0 / 4.0));
108 leftValue =
static_cast<SampleType
> (std::pow (std::sin (0.5 *
MathConstants<double>::pi * (1.0 - normalisedPan)), 2.0));
110 boostValue =
static_cast<SampleType
> (2.0);
113 case Rule::squareRoot3dB:
114 leftValue = std::sqrt (
static_cast<SampleType
> (1.0) - normalisedPan);
115 rightValue = std::sqrt (normalisedPan);
116 boostValue = std::sqrt (
static_cast<SampleType
> (2.0));
119 case Rule::squareRoot4p5dB:
120 leftValue =
static_cast<SampleType
> (std::pow (std::sqrt (1.0 - normalisedPan), 1.5));
121 rightValue =
static_cast<SampleType
> (std::pow (std::sqrt (normalisedPan), 1.5));
122 boostValue =
static_cast<SampleType
> (std::pow (2.0, 3.0 / 4.0));
126 leftValue = jmin (
static_cast<SampleType
> (0.5),
static_cast<SampleType
> (1.0) - normalisedPan);
127 rightValue = jmin (
static_cast<SampleType
> (0.5), normalisedPan);
128 boostValue =
static_cast<SampleType
> (2.0);
132 leftVolume .setTargetValue (leftValue * boostValue);
133 rightVolume.setTargetValue (rightValue * boostValue);
137template class Panner<float>;
138template class Panner<double>;
void prepare(const ProcessSpec &spec)
void setPan(SampleType newPan)
void setRule(Rule newRule)