SoundpipeAudioKit icon indicating copy to clipboard operation
SoundpipeAudioKit copied to clipboard

canProcessInPlace crash when false

Open NickCulbertson opened this issue 7 months ago • 0 comments

macOS Version(s) Used to Build

macOS 13 Ventura

Xcode Version(s)

Xcode 14

Description

When DSPBase is passed canProcessInPlace=false from SoundpipeDSPBase, it crashes when some effects are bypassed (like PhaseLockedVocoder).

The crash occurs on auto input = (const float *)inputBufferLists[0]->mBuffers[channel].mData + bufferOffset; here:


    if (isStarted) {
        process(FrameRange{bufferOffset, frameCount});
    } else {

        // Advance all ramps.
        stepRampsBy(frameCount);

        // Copy input to output.
        if (inputBufferLists.size() and !bCanProcessInPlace) {
            for (int channel=0; channel< channelCount; ++channel) {
                auto input = (const float *)inputBufferLists[0]->mBuffers[channel].mData + bufferOffset;
                auto output = (float *)outputBufferList->mBuffers[channel].mData + bufferOffset;
                std::copy(input, input+frameCount, output);
            }
        }

        // Generators should be silent.
        if (inputBufferLists.empty()) {
            zeroOutput(frameCount, bufferOffset);
        }
    }

}

This is only an issue when canProcessInPlace is false. Otherwise that block is never called.

Example: https://github.com/maweibezahn/PhaseLockedVocoderCrash

NickCulbertson avatar Jun 09 '25 16:06 NickCulbertson