Reputation: 41
I work on an embedded Linux board (based on Eukrea iMx25). Application is a game playing notes of music or other songs. I get events from radio equipment and then playing wav files.
Homemade player : First solution for playing is using open/write system function to the output /dev/dsp. The latency is very good, launching song quickly and stopping quickly. However, there are some bugs and sometimes song is replaced by noise or noise appear at the end of the song. (This is probably due to problem of syncing playing with hardware since this program application work well alone as minimalist program test).
Aplay (monophonic) : Second solution is to use "aplay" provided in the linux distribution. Problem is latency, some kernell error appears when a play is stopped just after launching (from the tlv320aic23 device). Waiting 100 or 200 ms before stop playing is not acceptable since my radio sensor have 100 ms latency.
Aplay with dmix (polyphonic) : I think in both solution, limitations are due to tlv320aic23 device. I wonder if using a sound server could be best. I could play a new song just after receiving event and stop songs when I want. I tested aplay -D plug:dmix /home/root/mysong.wav but I get plugging crashed after different tests. Problem is there is no error returned by aplay concerning the crash of the plugging and aplay without dmix still works.
Should I use an other sound server ? For example "Jack" ?
Here is test program :
for(i=50; i>0; i--){
periode = 23 * i;
// Display in log
msg(USER, MSG_CONTROLE, "declenchement dalle %d et attente %f",
choixDalle, periode);
// Send event to audio task
signalerAppuiDalleCtrl(&ctrlInstances, Hw.xmlParams, &Hw, choixDalle+100, 0);
// Waiting with arg in second
attendre(periode/1000.0);
}
Upvotes: 2
Views: 957
Reputation: 41
I do not know more about FIQ feature and today I am still using third solution but with asound.conf file (not -D plug:dmix parameter) and it seems working well. my asound.conf file :
pcm.dmixed {
type dmix
ipc_key 1024
ipc_key_add_uid 0
slave.pcm "hw:0,0"
}
pcm.dsnooped {
type dsnoop
ipc_key 1026
slave.pcm "hw:0,0"
}
pcm.duplex {
type asym
playback.pcm "dmixed"
capture.pcm "dsnooped"
}
# Instruct ALSA to use pcm.duplex as the default device
pcm.!default {
type plug
slave.pcm "duplex"
}
ctl.!default {
type hw
card 0
}
Upvotes: 1