Skip to content

Commit

Permalink
IPlug: Fixed scratch buffers for disconnected I/O.
Browse files Browse the repository at this point in the history
Scratch buffers might not be valid after resize, oops! Fixes crash in
Adobe Audition CS6 5.0 when output is mono.
  • Loading branch information
TaleTN committed Jan 14, 2020
1 parent 7645b5c commit 0f87c17
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions WDL/IPlug/IPlugBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,19 @@ void IPlugBase::SetBlockSize(int blockSize)
int i, nIn = NInChannels(), nOut = NOutChannels();
for (i = 0; i < nIn; ++i) {
InChannel* pInChannel = mInChannels.Get(i);
pInChannel->mScratchBuf.Resize(blockSize);
memset(pInChannel->mScratchBuf.Get(), 0, blockSize * sizeof(double));
double* pScratch = pInChannel->mScratchBuf.Resize(blockSize);
memset(pScratch, 0, blockSize * sizeof(double));
if (!pInChannel->mConnected) {
*(pInChannel->mSrc) = pScratch;
}
}
for (i = 0; i < nOut; ++i) {
OutChannel* pOutChannel = mOutChannels.Get(i);
pOutChannel->mScratchBuf.Resize(blockSize);
memset(pOutChannel->mScratchBuf.Get(), 0, blockSize * sizeof(double));
double* pScratch = pOutChannel->mScratchBuf.Resize(blockSize);
memset(pScratch, 0, blockSize * sizeof(double));
if (!pOutChannel->mConnected) {
*(pOutChannel->mDest) = pScratch;
}
}
mBlockSize = blockSize;
}
Expand Down

0 comments on commit 0f87c17

Please sign in to comment.