* Sample loss in full duplex program
@ 2003-10-20 15:04 Eugeni Doljenko
0 siblings, 0 replies; only message in thread
From: Eugeni Doljenko @ 2003-10-20 15:04 UTC (permalink / raw)
To: alsa-devel
I have add code below to example program latency.c:
It just wrote first 100000 samples to the file "rawout" in plain text
format.
I have simple program which helps me to analyse such files.
With that program I've found that some samples are lost (~ one per 4000)
(My settings: latency_min = 8192; /* in frames / 2 */
latency_max = 8192; /* in frames / 2 */
block = 1; /* block mode */ // When set to 0 I got
awfull sample lost
tick_time = 1; /* disabled, otherwise in us */
tick_time_ok = 0;
use_poll = 1;
)
What can I do to not loss that samples in full duplex mode?
Sorry for my English.
Eugeni.
latency.c:
/*around string N649*/
ok = 1; // was here
in_max = 0; // was here
//prepare big buffer
double* filebuf = malloc(500000*sizeof(double)); //I've added
int filebufp = 0; //I've added
FILE* file; //I've added
short* shortbuf; //I've added
int i; //I've added
while (ok && frames_in < loop_limit) { // was here
if (use_poll) { //
was here
/* use poll to wait for next event */ // was here
snd_pcm_wait(chandle, 1000); // was here
} // was here
if ((r = readbuf(chandle, buffer, latency, &frames_in,
&in_max)) < 0) // was here
ok = 0;
// was here
else {
// was here
if (effect) //I've added // was here
applyeffect(buffer,r); //
was here
shortbuf = (short*)buffer; //I've
added
//write to big buffer
for(i=0; i<r; i++)
//I've added
{
//I've added
filebuf[filebufp] = shortbuf[i]; //I've
added
filebufp++;
//I've added
}
//I've added
//write big buffer to file
if(filebufp>100000) //I've
added
{
//I've added
file = fopen("rawout", "w"); //I've added
for(i=0; i<100000; i++)
//I've added
fprintf(file, "%f\n", filebuf[i]/32000); //I've added
fclose(file);
//I've added
exit(1);
//I've added
}
-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise
Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-10-20 15:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-20 15:04 Sample loss in full duplex program Eugeni Doljenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox