Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with QAudioInput::byteReady() and QIODevice::read()
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shoyeb
    wrote on last edited by
    #1

    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_buffer.data() + 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.

    There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shoyeb
      wrote on last edited by
      #2

      please reply...

      There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved