Important: Please read the Qt Code of Conduct -

Problem with QAudioInput::byteReady() and QIODevice::read()

  • I am having a doubt with the following code snippet...

    @const qint64 bytesReady = m_audioInput->bytesReady();
    const qint64 bytesSpace = m_buffer.size() - m_dataLength;
    const qint64 bytesToRead = qMin(bytesReady, bytesSpace);
    const qint64 bytesRead = m_audioInputIODevice->read( + m_dataLength, bytesToRead);@

    bytesReady() method is giving me a particular number of bytes and am passing these number of bytes to the read() of QIODevice which will return me the number of bytes read.

    The problem is that bytesRead is not equal to bytesToRead.
    And am getting fixed number of bytes from read method i.e 320, 640, 960, 1280, etc. and this depends on byteToRead.

  • please reply...

Log in to reply