mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
DSP: Added an assertion to protect against invalid use of ProcessContextNonReplacing
This commit is contained in:
parent
1bc7fdd1ec
commit
9f344aaa5a
2 changed files with 20 additions and 1 deletions
|
|
@ -151,6 +151,20 @@ public:
|
||||||
AudioBlock (const AudioBlock& other) noexcept = default;
|
AudioBlock (const AudioBlock& other) noexcept = default;
|
||||||
AudioBlock& operator= (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 getNumSamples() const noexcept { return numSamples; }
|
||||||
forcedinline size_t getNumChannels() const noexcept { return static_cast<size_t> (numChannels); }
|
forcedinline size_t getNumChannels() const noexcept { return static_cast<size_t> (numChannels); }
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,12 @@ public:
|
||||||
Note that the caller must not delete these blocks while they are still in use by this object!
|
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
|
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 (const ProcessContextNonReplacing&) = default;
|
||||||
ProcessContextNonReplacing (ProcessContextNonReplacing&&) = default;
|
ProcessContextNonReplacing (ProcessContextNonReplacing&&) = default;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue