Recording Issue

I i am trying to record this way

void AudioRecorder::startRecording (AudioBuffer<float>* bufferToRecord, const File& file)
{
    stop();
    
    //    file.deleteFile();
    
    //get numChannel based on the track need (Mono or Stereo)
    auto numChannels = bufferToRecord->getNumChannels();
    
    
    //create a new file based on the passed argument
    
    writer.reset (format.createWriterFor (new FileOutputStream (file),
                                          44100.0,
                                          numChannels,
                                          24,
                                          {},
                                          0));
}

//=============================================================================
//Actual Recording

void AudioRecorder::Record(AudioBuffer<float>* bufferToRecord)
{
    const auto numSamples = bufferToRecord->getNumSamples();
    if (writer != 0)
    {
        writer->writeFromAudioSampleBuffer(*bufferToRecord, 0, numSamples);
    }
}

and it actually create and write on a .wav, except for the fact that the .wav output is slowed down and distorted
Anyone encountered this problem ?

Fun fact : I am flying to Berlin and I am on the same plane with Jean-Baptiste Thiebaut