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. QIODevice and QAudioOutput
Forum Updated to NodeBB v4.3 + New Features

QIODevice and QAudioOutput

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.5k 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.
  • D Offline
    D Offline
    declassified
    wrote on last edited by
    #1

    Hi everyone,

    I'm trying to get QAudioOutput working in pull mode, so I can output audio buffers in real time. I have subclassed QIODevice and implemented the method readData(char *data, qint64 len). Then I passed this subclass to QAudioOutput::start(QIODevice* device). So far everything works as it should: My readData copies data from a QByteArray to the memory pointed to be the data argument, and I can hear the sine wave output. But len always has a value of 16384, regardless of how I setBufferSize on the QAudioOutput instance.

    For example, if I do setBufferSize(256) and afterwards do qDebug() << audioOutput->bufferSize(), it says 256. periodSize() returns 2048, which is logical for the size in bytes because it's 8 * 256. But still len has a value of 16384. Why is that?

    And how can I ask my QAudioOutput instance what len value it's going to give me before I start() it? I need to prepare my other program parts (qreal arrays) to the right size.

    [EDIT] After some more tests, it seems like QAudioOutput returns different values for bufferSize() before and after start(). Before start(), it returns 256, but after start() it returns 4096.

    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