diff --git a/modules/juce_dsp/containers/juce_AudioBlock.h b/modules/juce_dsp/containers/juce_AudioBlock.h index a98e60370a..6936604142 100644 --- a/modules/juce_dsp/containers/juce_AudioBlock.h +++ b/modules/juce_dsp/containers/juce_AudioBlock.h @@ -151,6 +151,20 @@ public: AudioBlock (const AudioBlock& other) noexcept = default; AudioBlock& operator= (const AudioBlock& other) noexcept = default; + //============================================================================== + bool operator== (const AudioBlock& other) const noexcept + { + return std::equal (channels, channels + numChannels, + other.channels, other.channels + other.numChannels) + && startSample == other.startSample + && numSamples == other.numSamples; + } + + bool operator!= (const AudioBlock& other) const noexcept + { + return ! (*this == other); + } + //============================================================================== forcedinline size_t getNumSamples() const noexcept { return numSamples; } forcedinline size_t getNumChannels() const noexcept { return static_cast (numChannels); } diff --git a/modules/juce_dsp/processors/juce_ProcessContext.h b/modules/juce_dsp/processors/juce_ProcessContext.h index c2ff8de484..0a69d5369c 100644 --- a/modules/juce_dsp/processors/juce_ProcessContext.h +++ b/modules/juce_dsp/processors/juce_ProcessContext.h @@ -139,7 +139,12 @@ public: Note that the caller must not delete these blocks while they are still in use by this object! */ ProcessContextNonReplacing (const AudioBlockType& input, AudioBlockType& output) noexcept - : inputBlock (input), outputBlock (output) {} + : inputBlock (input), outputBlock (output) + { + // If the input and output blocks are the same then you should use + // ProcessContextReplacing instead. + jassert (input != output); + } ProcessContextNonReplacing (const ProcessContextNonReplacing&) = default; ProcessContextNonReplacing (ProcessContextNonReplacing&&) = default;