Using QAudioInput recording gets erratic "internal error"s

33 Views Asked by At

From start, I click "start" to start recording, but the freeBlocks function causes an internal error.

This error sometimes happens but sometimes does not.

How to solve it?

void QWindowsAudioInput::freeBlocks(WAVEHDR* blockArray)
{
    WAVEHDR* blocks = blockArray;

    int count = buffer_size/period_size;

    for(int i = 0; i < count; i++) {
        waveInUnprepareHeader(hWaveIn,blocks, sizeof(WAVEHDR));
        blocks++;//The error stuck in the line
    }
    HeapFree(GetProcessHeap(), 0, blockArray);
}

Recording code in program:

QIODevice* m_audioInputIODevice=NULL;
int readNum = m_audioInputIODevice->read(sAudio,BUFSIZE);
0

There are 0 best solutions below