title: How to load audio files for impulse responses using Juce
body: <p>I am currently creating a convolution reverb plugin for university, and I have downloaded an already made convolver library for use with in the plugin. I have some code that generates an impulse response however I am not quite sure how to load an actual audio file in to the process.</p>
  
  <p>Here is the convolver class:</p>
  
  <pre><code>class FFTConvolver
  {  
  public:
    FFTConvolver();  
    virtual ~FFTConvolver();
  
    /**
    * @brief Initializes the convolver
    * @param blockSize Block size internally used by the convolver (partition size)
    * @param ir The impulse response
    * @param irLen Length of the impulse response
    * @return true: Success - false: Failed
    */
    bool init(size_t blockSize, const Sample* ir, size_t irLen);
  
    /**
    * @brief Convolves the the given input samples and immediately outputs the result
    * @param input The input samples
    * @param output The convolution result
    * @param len Number of input/output samples
    */
    void process(const Sample* input, Sample* output, size_t len);
  
    /**
    * @brief Resets the convolver and discards the set impulse response
    */
    void reset();
  
  private:
    size_t _blockSize;
    size_t _segSize;
    size_t _segCount;
    size_t _fftComplexSize;
    std::vector&lt;SplitComplex*&gt; _segments;
    std::vector&lt;SplitComplex*&gt; _segmentsIR;
    SampleBuffer _fftBuffer;
    audiofft::AudioFFT _fft;
    SplitComplex _preMultiplied;
    SplitComplex _conv;
    SampleBuffer _overlap;
    size_t _current;
    SampleBuffer _inputBuffer;
    size_t _inputBufferFill;
  
    // Prevent uncontrolled usage
    FFTConvolver(const FFTConvolver&amp;);
    FFTConvolver&amp; operator=(const FFTConvolver&amp;);
  };
  </code></pre>
  
  <p>And here is the code I have used to implement an impulse response (but not an audio file):</p>
  
  <pre><code>//convolver
      ir.ensureStorageAllocated (512);
      zeromem (ir.getRawDataPointer(), 512 * sizeof(float));
      ir.set (0, 1.0f);
  
  
      for (int i = 0; i &lt; 10; ++i)
      {
          ir.set (Random::getSystemRandom().nextInt (512),
                  Random::getSystemRandom().nextFloat() * 2.f - 1.f);
      }
  
      convolver.init (128, ir.getRawDataPointer(), 512);
  </code></pre>
  
  <p>and in the process block...</p>
  
  <pre><code>convolver.process (inputData, channelData, buffer.getNumSamples());
  </code></pre>
  
  <p>Can anyone tell me how I can use an actual audio file of an impulse response?</p>