ALSA PCM play one small problem
- From: Ignacy <fikufik@xxxxxxxxx>
- Date: Mon, 18 Feb 2008 09:32:21 -0800 (PST)
Hello
I wonder why this code below makes a Seg. Fault, after playing one
period of PCM samples, when I comment infinite while loop ?
while (1) {
make_sine(areas, 0, period_size, &phase);
ptr = samples;
cptr = period_size;
while (cptr > 0) {
err = snd_pcm_writei(handle, ptr, cptr);
if (err == -EAGAIN)
continue;
if (err < 0) {
if (xrun_recovery(handle, err) < 0) {
printf("Write error: %s\n",
snd_strerror(err));
exit(EXIT_FAILURE);
}
break; /* skip one period */
}
ptr += err;
cptr -= err;
}
}
This is a part of example from: http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html
(functions make_sine and xrun_recovery was taken from there).
All I want to do is to play only one period of sine sound, than change
sine frequency and play again the sound (in real time). I need it for
AFSK (http://en.wikipedia.org/wiki/AFSK) modulation, so if anyone can
explain to me why this code make seg. fault I will be grateful.
Ign.
.
- Prev by Date: Re: reading /proc values thorugh C code
- Next by Date: Re: reading /proc values thorugh C code
- Previous by thread: reading /proc values thorugh C code
- Next by thread: download peak control
- Index(es):
Relevant Pages
|