/* We have to digest the frame in 160-byte portions */
if(datalen>sizeof(sizbuf)-sizpos){
ERRORA("Frame too large\n",GSMOPEN_P_LOG);
res=-1;
}else{
memcpy(sizbuf+sizpos,data,datalen);
memset(data,255,datalen);
len+=datalen;
pos=0;
#ifdef ALSA_MONITOR
alsa_monitor_write(sizbuf,len);
#endif
state=snd_pcm_state(tech_pvt->alsap);
if(state==SND_PCM_STATE_XRUN){
inti;
DEBUGA_GSMOPEN
("You've got an ALSA write XRUN in the past (gsmopen can't fill the soundcard buffer fast enough). If this happens often (not after silence or after a pause in the speech, that's OK), and appear to damage the sound quality, first check if you have some IRQ problem, maybe sharing the soundcard IRQ with a broken or heavy loaded ethernet or graphic card. Then consider to increase the alsa_periods_in_buffer (now is set to %d) for this interface in the config file\n",
GSMOPEN_P_LOG,tech_pvt->alsa_periods_in_buffer);
res=snd_pcm_prepare(tech_pvt->alsap);
if(res){
ERRORA("audio play prepare failed: %s\n",GSMOPEN_P_LOG,snd_strerror(res));
DEBUGA_GSMOPEN("Write returned a different quantity: %d\n",GSMOPEN_P_LOG,res);
res=-1;
}
}
DEBUGA_GSMOPEN
("PREVENTING an ALSA write XRUN (gsmopen can't fill the soundcard buffer fast enough). If this happens often (not after silence or after a pause in the speech, that's OK), and appear to damage the sound quality, first check if you have some IRQ problem, maybe sharing the soundcard IRQ with a broken or heavy loaded ethernet or graphic card. Then consider to increase the alsa_periods_in_buffer (now is set to %d) for this interface in the config file. delayp1=%d, delayp2=%d\n",
sizbuf2[a]=sizbuf[i];// comment out this line to use only left
a++;
i++;
sizbuf2[a]=sizbuf[i];// comment out this line to use only left
a++;
i++;
}
res=snd_pcm_writei(tech_pvt->alsap,sizbuf2,len);
}
if(res==-EPIPE){
DEBUGA_GSMOPEN
("ALSA write EPIPE (XRUN) (gsmopen can't fill the soundcard buffer fast enough). If this happens often (not after silence or after a pause in the speech, that's OK), and appear to damage the sound quality, first check if you have some IRQ problem, maybe sharing the soundcard IRQ with a broken or heavy loaded ethernet or graphic card. Then consider to increase the alsa_periods_in_buffer (now is set to %d) for this interface in the config file. delayp1=%d, delayp2=%d\n",