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. QAudioOutput

QAudioOutput

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.4k Views 1 Watching
  • 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
    satyanarayana143
    wrote on last edited by
    #1

    i am using Qt 5.13 QAudioOutput and QIODevice write is crashing in Qt 5.11 it is working fine in Q5.13 it is crashing .what is issue can anybody tell

    QAudioOutput *speaker;
    QIODevice *device;

    QAudioFormat format;
    format.setChannelCount(1);
    format.setSampleRate(SAMPLE_RATE);
    format.setSampleSize(SAMPLE_SIZE);
    format.setCodec("audio/pcm");
    format.setByteOrder(QAudioFormat::LittleEndian);
    format.setSampleType(QAudioFormat::SignedInt);

    eQueryAudioState = AudioPlayingNotStarted;
    bDecoderInit = false;
    speaker = new QAudioOutput(QAudioDeviceInfo::defaultOutputDevice(),format);
    speaker->setBufferSize(32000);//(32000);//(32768);
    //  speaker->setNotifyInterval(20);
    device = speaker->start();
    audioTimer = new QTimer();
    audioTimer->setTimerType(Qt::TimerType::PreciseTimer);
    audioTimer->setSingleShot(false);
    audioTimer->setInterval(5);//5
    
    
    connect(audioTimer,SIGNAL(timeout()),this,SLOT(playAudio()));
    audioTimer->start();
    opusDecoderInit(format);
    

    int nSamplesDecoded = opus_decode(opusDecoder,(unsigned char *)buffer.data(), ENCODED_BUFFER_SIZE, dec_out, AUDIO_BUFFER_SIZE, 0);
    if (nSamplesDecoded < 0)
    {
    qDebug() << "decoder failed: " << opus_strerror(nSamplesDecoded);
    return;
    }
    else
    {
    qDebug() << "Samples Decoded " << nSamplesDecoded ;
    }

    if(device->isOpen() && device->isWritable())
    {
        int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2);
    }
    
    jsulmJ 1 Reply Last reply
    0
    • S satyanarayana143

      i am using Qt 5.13 QAudioOutput and QIODevice write is crashing in Qt 5.11 it is working fine in Q5.13 it is crashing .what is issue can anybody tell

      QAudioOutput *speaker;
      QIODevice *device;

      QAudioFormat format;
      format.setChannelCount(1);
      format.setSampleRate(SAMPLE_RATE);
      format.setSampleSize(SAMPLE_SIZE);
      format.setCodec("audio/pcm");
      format.setByteOrder(QAudioFormat::LittleEndian);
      format.setSampleType(QAudioFormat::SignedInt);

      eQueryAudioState = AudioPlayingNotStarted;
      bDecoderInit = false;
      speaker = new QAudioOutput(QAudioDeviceInfo::defaultOutputDevice(),format);
      speaker->setBufferSize(32000);//(32000);//(32768);
      //  speaker->setNotifyInterval(20);
      device = speaker->start();
      audioTimer = new QTimer();
      audioTimer->setTimerType(Qt::TimerType::PreciseTimer);
      audioTimer->setSingleShot(false);
      audioTimer->setInterval(5);//5
      
      
      connect(audioTimer,SIGNAL(timeout()),this,SLOT(playAudio()));
      audioTimer->start();
      opusDecoderInit(format);
      

      int nSamplesDecoded = opus_decode(opusDecoder,(unsigned char *)buffer.data(), ENCODED_BUFFER_SIZE, dec_out, AUDIO_BUFFER_SIZE, 0);
      if (nSamplesDecoded < 0)
      {
      qDebug() << "decoder failed: " << opus_strerror(nSamplesDecoded);
      return;
      }
      else
      {
      qDebug() << "Samples Decoded " << nSamplesDecoded ;
      }

      if(device->isOpen() && device->isWritable())
      {
          int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2);
      }
      
      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @satyanarayana143 said in QAudioOutput:

      i am using Qt 5.13 QAudioOutput and QIODevice write is crashing in Qt 5.11 it is working fine in Q5.13 it is crashing

      Please fix this sentence - in which version does it crash?
      Did you use debugger to see where it crashes?
      Do you have a stack trace after crash?

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        satyanarayana143
        wrote on last edited by
        #3

        Qt 5.13 version

        device is QIODevice

        static short dec_out[AUDIO_BUFFER_SIZE]={0};

        int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2);
        
        jsulmJ 1 Reply Last reply
        0
        • S satyanarayana143

          Qt 5.13 version

          device is QIODevice

          static short dec_out[AUDIO_BUFFER_SIZE]={0};

          int BytesWritten = device->write((char *)dec_out,nSamplesDecoded*2);
          
          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @satyanarayana143 said in QAudioOutput:

          device is QIODevice
          static short dec_out[AUDIO_BUFFER_SIZE]={0};
          int BytesWritten = device->write((char )dec_out,nSamplesDecoded2);

          This does not answer my other questions. If your app is crashing then please use debugger...

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

          1 Reply Last reply
          0
          • S Offline
            S Offline
            satyanarayana143
            wrote on last edited by
            #5

            @jsulm said in QAudioOutput:

            This does not answer my other questions. If your app is crashing then please use debugger...

            using debugger at this line it is crashing

            jsulmJ 1 Reply Last reply
            0
            • S satyanarayana143

              @jsulm said in QAudioOutput:

              This does not answer my other questions. If your app is crashing then please use debugger...

              using debugger at this line it is crashing

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @satyanarayana143 What kind of crash is it? SIGSEGV? Is device a valid pointer in that line?

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

              1 Reply Last reply
              0
              • S Offline
                S Offline
                satyanarayana143
                wrote on last edited by
                #7

                QT installed system it is running in non qt installed system it is crashing i copied multimedia dlls .

                any dll is missing for that crash

                jsulmJ 1 Reply Last reply
                0
                • S satyanarayana143

                  QT installed system it is running in non qt installed system it is crashing i copied multimedia dlls .

                  any dll is missing for that crash

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @satyanarayana143 You need to deploy your app properly with all needed libs and plug-ins: https://doc.qt.io/qt-5/deployment.html

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

                  1 Reply Last reply
                  1

                  • Login

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