Skip to content
  • 0 Votes
    3 Posts
    244 Views
    C

    @artemious3 said in Creating QIODevice with infinite data:

    I'd like to know if you can see some problems with this implementation,

    On a cursory inspection...
    Let's say your audioData buffer size is 1024 bytes, for example, and the user requests a read of 2048 bytes (because your bytesAvailable says that is available). This line:

    currentDataPtr = std::copy(audioData, audioData + remainingBytes, targetData);

    will try to copy 2048 bytes out of a 1024 byte buffer.

    You should also look at the QIODevice::bytesAvailable() docs regarding what this should return.

  • 0 Votes
    8 Posts
    7k Views
    S

    Thank you, @Diracsbracket. From what you have commented I have achieved my audio playback of raw audio data.

    Although the raw audio format is 32bits, and the supported formats indicated that 32 bits was supported, in actuality for my windows OS, i think only 8 bit Unsigned Int or 16 bit Signed Int work.