Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALSA snd_pcm_drop() is not clearing complete buffer

Tags:

c

linux

alsa

I am using ALSA API snd_pcm_drop() to clear the buffers. But when I continue audio later with snd_pcm_prepare(), I can hear part of previous audio which was supposed to be cleared. This happens when I have a high value of snd_pcm_sw_params_set_stop_threshold(). If I am using a lower value, the partial audio from previous audio session wont be played.

What is happening here ? How to clear off the buffer completely ?

(I am new to ALSA)

Thanks

like image 476
Lunar Mushrooms Avatar asked Apr 05 '13 04:04

Lunar Mushrooms


1 Answers

I solved the same issue in this way:

snd_pcm_prepare(pcm_handle);
snd_pcm_drop(pcm_handle);
like image 109
Angelo Dureghello Avatar answered Sep 22 '22 02:09

Angelo Dureghello