Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5300

QAudioInput and QAudioOutput

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • 4.6.0
    • 4.6.0
    • Multimedia
    • None
    • Fixed runtime error in QAudioInput::bytesReady() function

      QAudioInput:

      On Windows Vista 32Bit SP2:

      • qt/doc/html/qaudioinput.html
        Example code:
        QFile outputFile;
        QAudioInput *audio
        .....
        outputFile.setFileName("test.raw");
        outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );

      QAudioFormat format;
      // set up the format you want, eg.
      format.setFrequency(8000);
      format.setChannels(1);
      format.setSampleSize(8);
      format.setCodec("audio/pcm");
      format.setByteOrder(QAudioFormat::LittleEndian);
      format.setSampleType(QAudioFormat::UnSignedInt);

      audio = new QAudioInput(format, this);
      QTimer::singleShot(3000, this, SLOT(stopRecording()));
      audio->start(&outputFile);
      ...
      And then:
      void MyClass::stopRecording()

      { audio->stop(); outputFile->close(); }

      Issue on Windows:

      • On void MyClass::stopRecording(), it seems to give error and then when application is closed, it does crash because heap allocation is not cleaned correctly.

      Would work:
      audio->start();
      But then it doesn't give any output, of course.
      (It doesn't crash on MAC OSX, but on MAC OSX it does save only 89 bytes to output).
      *******
      ALSO:
      if you call:
      audio->bytesReady();
      Before
      audio->start(&outputFile);

      On windows Vista 32Bit SP2: It does crash into function of QT: (probably because period_size == 0, it tries divide by zero)
      int QAudioInputPrivate::bytesReady() const
      {
      int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size;
      if(buf < 0)
      buf = 0;
      return buf;
      }
      *************
      On MAC OSX (MacBook, Snow Leopard)
      Example of Multimedia/audio/audioinput

      • It can find devices
      • But microphone is dull all a time.
        On windows (Vista SP2 32Bit), it shows some activity ok.
        *************
        As so far, I never got working audiooutput example. But I am not sure if it's bug or not.
        I have (probably) first got pcm audio data with audioinput example into file.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            korbatit Kurt Korbatits (closed Nokia identity) (Inactive)
            timoha Timo Hannukkala
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes