Results 1 to 1 of 1

Thread: QAudioInput example strange behavior

  1. #1
    Join Date
    Jan 2010
    Location
    Poland Warsaw
    Posts
    25
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QAudioInput example strange behavior

    Hello.

    I have modified source code of QAudioInput example from QtCreator so the readMore() slot looks like:

    Qt Code:
    1. void MainWindow::readMore()
    2. {
    3. if(!m_audioInput)
    4. return;
    5. qint64 len = m_audioInput->bytesReady();
    6. if(len > 4096)
    7. len = 4096;
    8. qint64 l = m_input->read(m_buffer.data(), len);
    9. ui->plainTextEdit->appendPlainText(QString("Odczytano l = %1").arg(l));
    10. }
    To copy to clipboard, switch view to plain text mode 

    I thought that 'l' variable will never be greater than 4096 but it always has value of m_audioInput->bytesReady() (even if it is > 4096).

    'm_input' is QIODevice and read() method shoud read at most 'len' (4096) bytes of data, so 'l' should not be greater than 4096.

    If I am wrong please correct me.
    Could someone explain me why is it so behaves.
    Last edited by m15ch4; 13th August 2010 at 08:31.

Similar Threads

  1. QAudioInput and QtcpSocket help!!!
    By XavierQT in forum General Programming
    Replies: 1
    Last Post: 13th July 2010, 19:15
  2. !!!A Strange Crash
    By hhf in forum Qt Programming
    Replies: 12
    Last Post: 10th March 2010, 12:45
  3. Strange problem
    By pavel in forum Newbie
    Replies: 4
    Last Post: 18th December 2009, 21:46
  4. Need help: Strange behaviour
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2008, 04:03
  5. strange QT error out of nowhere
    By Penut in forum Qt Programming
    Replies: 5
    Last Post: 14th August 2008, 01:46

Tags for this Thread

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.