Load impulse response from existing audio buffer for dsp::Convolution

juce::dsp::Convolution::loadImpulseResponse has three overloads:

void loadImpulseResponse (const void* sourceData, size_t sourceDataSize, ...
void loadImpulseResponse (const File& fileImpulseResponse, Stereo isStereo, ...
void loadImpulseResponse (AudioBuffer<float>&& buffer, double bufferSampleRate, ...

The following code is selecting the first overload. However, as explained in the documentation for this overload, the first two arguments are expected to be a data block, and the size of the block in bytes.

If I replace the first two arguments with BinaryData::oneGong_wav, BinaryData::oneGong_wavSize, then the convolution appears to load the file correctly.

#else // Failing API because originalSampleRate is zero:
    convolutionEngine.loadImpulseResponse (&impulseResponse, // std::move (impulseResponse),
                              sampleRate,
                              stereo,
                              dsp::Convolution::Trim::no,
                              0,
                              dsp::Convolution::Normalise::no);
1 Like