Results 1 to 2 of 2

Thread: Do I get the idea of QAudioProbe?

  1. #1
    Join Date
    Sep 2015
    Posts
    36
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Do I get the idea of QAudioProbe?

    I currently have something like this. Player is supposed to be something like pseudo winamp, and everything is staged this way now.

    Qt Code:
    1. player = new QMediaPlayer; //creating QMediaPlayer instance
    2. probe = new QAudioProbe;
    3. probe->setSource(player);
    4.  
    5. connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));
    To copy to clipboard, switch view to plain text mode 

    From what I understand - when probe has it's internal buffer full it emits it as signal which I catch with adequate slot function, which would look like that:

    Qt Code:
    1. void qtplayer::processBuffer(QAudioBuffer buffer)
    2. {
    3.  
    4. // do something with data in buffer
    5. // I want for example copy insides of this buffer to Vector of Ints, how can I do that?
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    Am I right to this point? I assume that when I use QMediaPlayer, then it uses native system audio format (in my case 44100 Hz, 16 bit, 2 channel), so I assume that probe gets exaclty same format of audio. But what about buffer size? I want probe to get for example 44100 samples of audio, which would be 1 second, can I change that? How do I even know how big is it's internal buffer?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Do I get the idea of QAudioProbe?

    QAudioBuffer is a wrapper around an array of integers in the specified format. It provides functions to tell you how many bytes in the buffer as well as the sample/frame count. Keep processing QAudioFrames accumulating samples in your own buffer until you have received your 1 second of audio.

Similar Threads

  1. Problem with QMediaPlayer and QAudioProbe
    By mohabb in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2015, 09:34
  2. Replies: 6
    Last Post: 21st November 2014, 10:25
  3. ???any one have idea about this ???
    By damodharan in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2010, 09:08
  4. No idea about QGraphicsView
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 27th June 2007, 10:02
  5. UI Idea please
    By munna in forum General Discussion
    Replies: 1
    Last Post: 9th May 2006, 11:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.