48template <
typename SampleType>
53 using Rule = PannerRule;
75 template <
typename ProcessContext>
78 const auto& inputBlock = context.getInputBlock();
79 auto& outputBlock = context.getOutputBlock();
81 const auto numInputChannels = inputBlock.getNumChannels();
82 const auto numOutputChannels = outputBlock.getNumChannels();
83 [[
maybe_unused]]
const auto numSamples = outputBlock.getNumSamples();
85 jassert (inputBlock.getNumSamples() == numSamples);
87 if (numOutputChannels != 2 || numInputChannels == 0 || numInputChannels > 2)
90 if (numInputChannels == 2)
92 outputBlock.copyFrom (inputBlock);
96 outputBlock.getSingleChannelBlock (0).copyFrom (inputBlock);
97 outputBlock.getSingleChannelBlock (1).copyFrom (inputBlock);
100 if (context.isBypassed)
103 outputBlock.getSingleChannelBlock (0).multiplyBy (leftVolume);
104 outputBlock.getSingleChannelBlock (1).multiplyBy (rightVolume);
112 Rule currentRule = Rule::balanced;
113 SampleType pan = 0.0;
115 double sampleRate = 44100.0;
A utility class for values that need smoothing to avoid audio glitches.
A processor to perform panning operations on stereo buffers.
void process(const ProcessContext &context) noexcept
Processes the input and output samples supplied in the processing context.
void prepare(const ProcessSpec &spec)
Initialises the processor.
void setPan(SampleType newPan)
Sets the current panning value, between -1 (full left) and 1 (full right).
void reset()
Resets the internal state variables of the processor.
void setRule(Rule newRule)
Sets the panning rule.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...