Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Multimedia
  4. QAudioDevice and (un)supported QAudioFormat formats
Forum Updated to NodeBB v4.3 + New Features

QAudioDevice and (un)supported QAudioFormat formats

Scheduled Pinned Locked Moved Unsolved Qt Multimedia
1 Posts 1 Posters 176 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.
  • C Offline
    C Offline
    csab6597
    wrote on last edited by
    #1

    The following simple code

    int main(int argc, char** argv) {
    	QApplication app(argc, argv);
    
    	QAudioFormat fmt;
    	fmt.setSampleRate(44100);
    	fmt.setChannelCount(2);
    	fmt.setSampleFormat(QAudioFormat::Float);
    
    	const auto devices = QMediaDevices::audioOutputs();
    	for (const QAudioDevice& dev : devices) {
    		qDebug() << "device" << dev.description();
    		qDebug() << "sampleRate min" << dev.minimumSampleRate() << "max" << dev.maximumSampleRate();
    		qDebug() << "channelCount min" << dev.minimumChannelCount() << "max" << dev.maximumChannelCount();
    		qDebug() << "preferredFormat" << dev.preferredFormat();
    		qDebug() << "format" << fmt << "isFormatSupported" << dev.isFormatSupported(fmt);
    		qDebug();
    	}
    
    	return app.exec();
    }
    

    will give me the following output

    device "DENON-AVRHD (NVIDIA High Definition Audio)"
    sampleRate min 48000 max 48000
    channelCount min 5 max 6
    preferredFormat QAudioFormat( 48000 Hz,  6 Channels,  Float Format )
    format QAudioFormat( 44100 Hz,  2 Channels,  Float Format ) isFormatSupported false
    
    device "DELL U2715H (NVIDIA High Definition Audio)"
    sampleRate min 48000 max 48000
    channelCount min 2 max 2
    preferredFormat QAudioFormat( 48000 Hz,  2 Channels,  Float Format )
    format QAudioFormat( 44100 Hz,  2 Channels,  Float Format ) isFormatSupported false
    
    device "Realtek Digital Output (Realtek High Definition Audio)"
    sampleRate min 48000 max 48000
    channelCount min 2 max 2
    preferredFormat QAudioFormat( 48000 Hz,  2 Channels,  Float Format )
    format QAudioFormat( 44100 Hz,  2 Channels,  Float Format ) isFormatSupported false
    

    which I try to make sense of. As stated I indeed use a Nvidia Graphics Card for audio output. That device very much supports different sample rate and channel counts, but the code tells me that ALL devices can handle a sample rate of 48000 ONLY, as this is the min and max value. Similarly no device would handle mono output according to this text. So with that knowledge the example QAudioFormat of 44100 Stereo is rejected via the isFormatSupported() function. But really?

    My System is Windows 11, Qt 6.8.2, MSVC 2022, Nvidia Geforce RTX 3060

    1 Reply Last reply
    0
    • Nhan NguyenN Nhan Nguyen moved this topic from General and Desktop

    • Login

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