Results 1 to 6 of 6

Thread: QAudioOutput Play Audio Buffer chat voice ?

  1. #1
    Join Date
    Jun 2010
    Posts
    102
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default QAudioOutput Play Audio Buffer chat voice ?

    i dont understand source code Play audio of Qt sample output:
    Qt Code:
    1. qint64 Generator::readData(char *data, qint64 len)
    2. {
    3. qint64 total = 0;
    4. while (len - total) {
    5. const qint64 chunk = qMin((m_buffer.size() - m_pos), len - total);
    6. memcpy(data, m_buffer.constData() + m_pos, chunk);
    7. m_pos = (m_pos + chunk) % m_buffer.size();
    8. total += chunk;
    9. }
    10. return total;
    11. }
    To copy to clipboard, switch view to plain text mode 

    in source code: http://doc.qt.nokia.com/latest/multi...utput-cpp.html

    can you explain for me ?
    Contact: Skype: sonnh89
    Yahoo: nhs_0702@yahoo.com

    Liên hệ SKype: sonnh89

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QAudioOutput Play Audio Buffer chat voice ?

    It would help if you explain what exactly it is you don't understand... one can only guess otherwise.
    The code reads (copies) 'len' bytes from the buffer to user given buffer 'data', and moves the current position on the buffer respectively.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2010
    Posts
    102
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QAudioOutput Play Audio Buffer chat voice ?

    i want play quicky buffer, but qint64 len allway is: 16384 byte, so it allway slower than 1 second , can you help me change qint64 len = 256 byte ?
    Contact: Skype: sonnh89
    Yahoo: nhs_0702@yahoo.com

    Liên hệ SKype: sonnh89

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QAudioOutput Play Audio Buffer chat voice ?

    'len' is an input parameter, the callers sets it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jun 2010
    Posts
    102
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QAudioOutput Play Audio Buffer chat voice ?

    i dont know set it, beacase i is not call qint64 Generator::readData(char *data, qint64 len) , QAudioOutput automatic call it
    Contact: Skype: sonnh89
    Yahoo: nhs_0702@yahoo.com

    Liên hệ SKype: sonnh89

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QAudioOutput Play Audio Buffer chat voice ?

    but 'Generator' is not a phonon class, its your class.
    You are giving too little information to help you, and by revealing one more detail in each post is not helping.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QaudioOutPut Stream Audio In Chat Voice ?
    By Thành Viên Mới in forum Qt Programming
    Replies: 2
    Last Post: 17th June 2011, 03:33
  2. voice chat via network
    By Con Nít in forum Qt Programming
    Replies: 3
    Last Post: 1st February 2011, 19:55
  3. Unable to play audio outside Qt creator
    By somnathbanik in forum Newbie
    Replies: 0
    Last Post: 9th November 2010, 06:47
  4. QAudioOutput buffer underrun
    By BartBlackMagic in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2010, 17:44
  5. play audio url
    By tungvc in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 11:04

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.