Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eugeni Doljenko <dolzenko@rsu.ru>
To: alsa-devel@lists.sourceforge.net
Subject: Sample loss in full duplex program
Date: Mon, 20 Oct 2003 19:04:20 +0400	[thread overview]
Message-ID: <3F93F974.5030506@rsu.ru> (raw)

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

                 reply	other threads:[~2003-10-20 15:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F93F974.5030506@rsu.ru \
    --to=dolzenko@rsu.ru \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox