Home cannot find QAudioDeviceInfo availableDevices, in all environments
Reply: 0

cannot find QAudioDeviceInfo availableDevices, in all environments

JavaBeast
1#
JavaBeast Published in 2018-02-13 23:15:10Z

I am running my qt4.8 gui (which uses QAudioOutput to play a .wav) on two types of workstations.

1.  A windows computer via Oracle VM VirtualBox Redhat- linux
2.  A Linux computer via VMware workstation- linux

When I run gui on windows VB the gui plays audio just fine and prints no errors. When I (try to) play on VMWare the app hangs in limbo and I get the following error:

Raw audio format not supported by backend, cannot play audio.
Using null output device, none available

I throw the Raw audio format error when defaultOutputDevice is not supported. The null output device error is generated from qt code.

When I add the following code:

 foreach (const QAudioDeviceInfo &deviceInfo, 
    QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
    {
        qDebug() << "Device name: " << deviceInfo.deviceName();
    }

On VirtualBox I get:

Device name: “default:CARD=I82801AAICH”
Device name: “sysdefault:CARD=I82801AAICH”
Device name: “default”

On VMWare it doesn’t print any available devices.

when I run command lspci|grep -i audio on VirtualBox i get:

multimedia audio controller:Intel corporation 82801AA AC'97 (rev 01)

on VMWare i get:

VMWare HD Audio Controller (rev 09)

Also I can use the play command on both workstations from command line and the wav file plays. Aditionally I do not currently have aplay rpms installed for troubleshooting. I also checked .vmx file for audio setup and it matches VMWare recomendations. I would also mention I am using pulseaudio version 6 on virtualBox and 10 on VMWare, but I wouldnt think this is the problem.

Any idea what could be causing this error to hit on VMWare redhat workstation, and anything else I can look into to troubleshoot? Is this a library or compatability issue?


Updated:

code that I use to set up device:

    //set bytes to buffer
    qbuff=new QBuffer();
    qbuff->setData(qbyte);
    qbuff->open(QIODevice::ReadOnly); 

    //set expected wav format
    format.setFrequency(48000);
        format.setChannels(1);
        format.setSampleSize(16);
        format.setSampleRate(48000);
        format.setCodec("audio/pcm");
        format.setByteOrder(QAudioFormat::LittleEndian);
        format.setSampleType(QAudioFormat::SignedInt);
    foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
    {
        qDebug() << " Device name: " << deviceInfo.deviceName();
    }
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
    if (!info.isFormatSupported(format))
    {
            qWarning()<<"raw audio format not supported by backend, cannot play audio.";
    }
    audioOutput  = new QAudioOutput(format,this);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.43881 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO