Results 1 to 10 of 10

Thread: Qt Audio in Linux and Windows: different behaviour

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2008
    Posts
    51
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Qt Audio in Linux and Windows: different behaviour

    I simplified the code and made it into a small example with the same behaviour,
    The "start" function now only reads
    Qt Code:
    1. const QAudioDevice &defaultDevice =
    2. QMediaDevices::defaultAudioOutput ();
    3. m_audioSink = new QAudioSink (defaultDevice, m_settings);
    4. connect (m_audioSink, &QAudioSink::stateChanged,
    5. this, &Qt_Audio::state_changed);
    6. theIODevice. start ();
    7. m_audioSink -> start (&theIODevice);
    8. QtAudio::Error err = m_audioSink -> error ();
    9. fprintf (stderr, "Errorcode %d\n", (int)(err));
    To copy to clipboard, switch view to plain text mode 
    The behaviour is the same, in the example I just generate a tone of 600 Hz, and add per 100 msec a buffer
    Under Linux the tone is OK, the status report tells the the AudioSink is active
    Under Windows no errors, state is Idle, and the read function is NOT called
    Qt Code:
    1. void Qt_AudioDevice::start () {
    2. bool b = open (QIODevice::ReadOnly);
    3. }
    4.  
    5. // we always return "maxSize" bytes
    6. qint64 Qt_AudioDevice::readData (char* buffer, qint64 maxSize) {
    7. qint64 amount = 0;
    8. static int64_t teller = 0;
    9. amount = Buffer -> getDataFromBuffer (buffer, maxSize);
    10. if (amount < maxSize) {
    11. for (int i = amount; i < maxSize; i ++)
    12. buffer [i] = (char)(0);
    13. }
    14.  
    15. return maxSize;
    16. }
    To copy to clipboard, switch view to plain text mode 

    Fot me the question is, why is the state "Idle" in Windows, when in Linux it is "Active"

    suggestions?

    best
    jan
    Last edited by d_stranz; 27th December 2024 at 23:15. Reason: missing [code] tags

Similar Threads

  1. Left audio channel intermittently drops out (QAudioOutput, Linux)
    By QtDrivesMeCrazy in forum Qt Programming
    Replies: 0
    Last Post: 1st March 2016, 23:09
  2. Replies: 5
    Last Post: 10th June 2014, 11:26
  3. Replies: 0
    Last Post: 8th December 2011, 12:21
  4. executing a audio player code on Embedded linux
    By sureshlohith in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 21st April 2010, 05:17
  5. Replies: 2
    Last Post: 4th June 2009, 16:09

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
  •  
Qt is a trademark of The Qt Company.