Reverse FFT data into channelData

Hi everyone,
i’m trying to develop a guitar distortion plugin. What i’m currently trying to do is to use the FFT to increase the magnitude of some specific harmonic frequencies.

My question is: how do i put back into the original buffer my processed FFT data after the reverse FFT? I tried using the copy method of the buffer object but it sounds really bad.

Thanks in advance!

Here’s the code snippet, contained in the processBlock method:

for (auto sample = 0; sample < buffer.getNumSamples(); ++sample) {

       if (fifoIndex == fftSize)       
       {
           if (!nextFFTBlockReady)    
           {
               std::fill(fftData.begin(), fftData.end(), 0.0f);
               std::copy(fifo.begin(), fifo.end(), fftData.begin());
               nextFFTBlockReady = true;
           }

           fifoIndex = 0;
       }

       fifo[(size_t)fifoIndex++] = channelDataL[sample];
    
       if (nextFFTBlockReady)
       {
           readyToCopy = false;
           //fai cose

           forwardFFT.performRealOnlyForwardTransform(fftData.data());
           int i;
         
           for (i = 0; i < fftData.size()/2; i++) {
               float re = fftData.data()[2 * i];
               float im = fftData.data()[(2 * i) + 1];
               float mag = std::sqrt((re * re) + (im * im));
               float pha = atan2(im, re);
     
              //do stuff


               re = mag * cos(pha);
               im = mag * sin(pha);
              
               fftData.data()[2 * i] = re;
               fftData.data()[(2 * i) + 1] = im;
           }
          
           inverseFFT.performRealOnlyInverseTransform(fftData.data());

           float* lTDataReal = new float[numSamples];
           
           
           for (int i = 0; i < numSamples; i++)
           {
               lTDataReal[i] = fftData.data()[2 * i] / (float)numSamples; 
           }

           //here's the issue. i don't think this is right because when i copy the processed data it 
            sounds really bad
           buffer.copyFrom(*channelDataL, 0, lTDataReal, numSamples);
          

           nextFFTBlockReady = false;
       }
      channelDataR[sample] = channelDataL[sample];

}