Playing a wav file for a tone in an embedded project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am working on an embedded project ( i.MX6 ) and having an issue using a
wav file for a tone in a Qt application. I am upgrading an existing project
from Qt 5.3 with alsa-lib 1.0.8 and a 3.10.17 kernel to Qt 5.11 with
alsa-lib 1.1.6 and a 4.9.123 kernel.

The beep code is pretty simple, it loads a wav file and saves the wav data
in a buffer. Then on each click event in Qt a beep() function is called.
The beep() function calls snd_pcm_prepare() -> snd_pcm_writei() ->
snd_pcm_drain().

With the previous release the entire beep() function takes ~160ms with the
snd_pcm_prepare() close to 0ms. However, with the latest release the beep()
function takes 550ms with 400ms in snd_pcm_prepare().

I tried to trace snd_pcm_prepare() in the kernel and found that the code
path lands in dapm_power_widgets() and this is where a majority of the
prepare call path time is spent.

I don't know why the previous release seems to almost bypass
snd_pcm_prepare() and the newer code base does not.

So, is there a way to load a wav file on startup, save the wav data and
then on each invocation of a beep() function play the data without having
to call prepare each time?

Thanks in advance for any suggestions/help

Cheers,
Jeff
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux