Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Audio format issue with Qt 6.8.2, all worked well with 6.6.3
Forum Updated to NodeBB v4.3 + New Features

Audio format issue with Qt 6.8.2, all worked well with 6.6.3

Scheduled Pinned Locked Moved Unsolved Qt 6
1 Posts 1 Posters 113 Views
  • 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.
  • U Offline
    U Offline
    Urbi
    wrote on 22 Mar 2025, 10:36 last edited by Urbi
    #1

    Hi, why does the following code now gives me with Qt 6.8.2 the error message "Requested output audio format is not supported on device."? All was working well up to and including Qt 6.6.3. Was has been changed and why?

    void SoundOutput::setFormat (QAudioDevice const& device, unsigned channels, int frames_buffered)
    {
      Q_ASSERT (0 < channels && channels < 3);
      m_device = device;
      m_channels = channels;
      m_framesBuffered = frames_buffered;
    }
    
    void SoundOutput::restart (QIODevice * source)
    {
      if (!m_device.isNull ())
        {
          QAudioFormat format (m_device.preferredFormat ());
          format.setChannelCount (m_channels);
          format.setSampleRate (48000);
          format.setSampleFormat (QAudioFormat::Int16);
          if (!format.isValid ())
            {
              Q_EMIT error (tr ("Requested output audio format is not valid."));
            }
          else if (!m_device.isFormatSupported (format))
            {
              Q_EMIT error (tr ("Requested output audio format is not supported on device."));
            }
          else
            {
              m_stream.reset (new QAudioSink (m_device, format));
              qDebug () << "SoundOutput::restart Selected audio output format:" << m_stream -> format();
    	  checkStream ();
              m_stream->setVolume (m_volume);
    //          m_stream->setNotifyInterval(1000);
              error_ = false;
    
              connect (m_stream.data(), &QAudioSink::stateChanged, this, &SoundOutput::handleStateChanged);
    //          connect (m_stream.data(), &QAudioSink::notify, [this] () {checkStream ();});
    
              //      qDebug() << "A" << m_volume << m_stream->notifyInterval();
            }
        }
    
    1 Reply Last reply
    1

    1/1

    22 Mar 2025, 10:36

    • Login

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