This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux ALSA Audio driver usage for Centaurus



Hi,

We are using Linux ALSA driver on Centaurus EVM from the SDK release 2.1.0.59. We are seeing an issue of last few samples of Audio data not being played out during end of audio stream playback. However if we put a work around of allowing a sleep of about couple of seconds before "snd_pcm_close", we dont see this issue. Following is the Audio driver usage pseudo code:

  • Audio Driver Configuration for first frame only:

/* Playback stream */
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
static char *device = "default"; /* playback device */

err = snd_pcm_open (&playback_handle, device, stream, 0);

err = snd_pcm_hw_params_malloc (&hw_params);

err = snd_pcm_hw_params_any (playback_handle, hw_params);

err = snd_pcm_hw_params_set_access (playback_handle, hw_params,SND_PCM_ACCESS_RW_INTERLEAVED);

err = snd_pcm_hw_params_set_format (playback_handle, hw_params,SND_PCM_FORMAT_S16_LE);
 
err = snd_pcm_hw_params_set_rate_near (playback_handle,  hw_params, &rate, 0);
  
err = snd_pcm_hw_params_set_channels (playback_handle,hw_params, 2);

err = snd_pcm_hw_params (playback_handle, hw_params);

err = snd_pcm_prepare (playback_handle);

  • Audio playback for all frames till end of stream:

err = snd_pcm_writei (playback_handle, pAudioBufferPtr, playoutSizeinBytes);

  • Audio driver close for last frame:

snd_pcm_close (playback_handle);

Please help us in resolving this issue...

Thanks & Regards,

Joshi