问题
I'm trying to play a WAV audio file with Qt (QSound, QSoundeffect) on an ARM based Atmel board (sama5d31ek).
I've build the rootfs (and Qt SDK for cross-compiling) with Yocto/poky.
When playing with QSound I get the following log message: using null output device, none available.
I'm getting nothing when running:
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
qDebug() << "Device name: " << deviceInfo.deviceName();
I can play the file via command-line, with aplay (alsa).
pulseaudio util is missing.
Anything?
Cleiton:
> aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: SAMA5D3 [tlv320aic3x @ SAMA5D3], device 0: TLV320AIC3X PCM tlv320aic3x-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
> cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: TLV320AIC3X PCM tlv320aic3x-hifi-0
name:
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
No audio with the following command:
> aplay -D hw:0,0 35_800.wav
Playing WAVE '35_800.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
aplay: set_params:1241: Sample format non available
Available formats:
- S16_LE
- S24_LE
- S32_LE
Audio playing with the following command:
> aplay -D plughw:0,0 35_800.wav
Playing WAVE '35_800.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Looping over QAudioDeviceInfo: no devices are found.
thanks
回答1:
had the same issue and after installing the qt multimedia plugin access to audio devices worked.
sudo apt install libqt5multimedia5-plugins
回答2:
Add packages alsa-utils and execute:
$ aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog >[ALC269VB Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Then, depending on the output run:
aplay -D plughw:0,0 music.wav
Or:
$ cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: HDMI 0
name: HDMI 0
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
Using:
aplay -D hw:0,0 music.wav
Then with Qt, you can list the devices with:
QList <QAudioDeviceInfo> devices = QAudioDeviceInfo :: availableDevices (QAudio :: AudioOutput);
foreach (i QAudioDeviceInfo, devices)
// Print the devices here!
Try and post the results here!
来源:https://stackoverflow.com/questions/36660694/qt-no-audio-output-device-yocto-poky