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. Render/Play Audio buffer data
Forum Updated to NodeBB v4.3 + New Features

Render/Play Audio buffer data

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.9k Views
  • 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
    sankar-110
    wrote on last edited by
    #1

    Hi all,
    I have an Audio buffer (PCM samples) and I need to render/play the buffer using the system speaker. How can I achieve this?
    Any help would be appreciated.

    jsulmJ 1 Reply Last reply
    0
    • S sankar-110

      Hi all,
      I have an Audio buffer (PCM samples) and I need to render/play the buffer using the system speaker. How can I achieve this?
      Any help would be appreciated.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sankar-110 What about http://doc.qt.io/qt-5/qaudiooutput.html ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sankar-110
        wrote on last edited by
        #3

        @jsulm ,
        I have checked Qaudiooutput.
        In the example mentioned they have given the source file as a "filepath".
        But my buffer is not a file, rather it is continuous data given by the PCI device.
        how do I render/play this?

        jsulmJ 1 Reply Last reply
        0
        • S sankar-110

          @jsulm ,
          I have checked Qaudiooutput.
          In the example mentioned they have given the source file as a "filepath".
          But my buffer is not a file, rather it is continuous data given by the PCI device.
          how do I render/play this?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @sankar-110 How exactly do you get your audio data? In which format? It does not have to be a file - it is QIODevice: http://doc.qt.io/qt-5/qaudiooutput.html#start

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • KillerSmathK Offline
            KillerSmathK Offline
            KillerSmath
            wrote on last edited by KillerSmath
            #5

            @sankar-110
            You can create a object of type buffer and set the data given by the PCI device (probably a char array)

            Simple example:

               char *bufferArray;
            
               QBuffer buffer;
            
               buffer.setData(bufferArray, <replace by size of bufferarray>);
            
               // format has been declared before this line
               QAudioOutput* audio = new QAudioOutput(format);
               audio.start(&buffer);
            

            References:

            http://doc.qt.io/qt-5/qbuffer.html#setData-1
            http://doc.qt.io/qt-5/qbuffer.html#QBuffer-1

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            1 Reply Last reply
            2

            • Login

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