[BACK]Return to aproc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Diff for /src/usr.bin/aucat/Attic/aproc.c between version 1.5 and 1.6

version 1.5, 2008/06/02 17:06:36 version 1.6, 2008/08/14 09:39:16
Line 37 
Line 37 
  *      convers anything to 16bit signed) and one for the output (that   *      convers anything to 16bit signed) and one for the output (that
  *      converts 16bit signed to anything)   *      converts 16bit signed to anything)
  *   *
  *      (hard) handle underruns in rpipe and mix  
  *  
  *      (hard) handle overruns in wpipe and sub  
  *  
  *      (hard) add a lowpass filter for the resampler. Quality is   *      (hard) add a lowpass filter for the resampler. Quality is
  *      not acceptable as is.   *      not acceptable as is.
  */   */
Line 104 
Line 100 
         unsigned char *data;          unsigned char *data;
         unsigned count;          unsigned count;
   
           DPRINTFN(3, "rpipe_in: %s\n", p->name);
   
         if (ABUF_FULL(obuf))          if (ABUF_FULL(obuf))
                 return 0;                  return 0;
         data = abuf_wgetblk(obuf, &count, 0);          data = abuf_wgetblk(obuf, &count, 0);
         obuf->used += file_read(f, data, count);          count = file_read(f, data, count);
           abuf_wcommit(obuf, count);
         abuf_flush(obuf);          abuf_flush(obuf);
         return !ABUF_FULL(obuf);          return !ABUF_FULL(obuf);
 }  }
Line 119 
Line 118 
         unsigned char *data;          unsigned char *data;
         unsigned count;          unsigned count;
   
           DPRINTFN(3, "rpipe_out: %s\n", p->name);
   
         if (!(f->state & FILE_ROK))          if (!(f->state & FILE_ROK))
                 return 0;                  return 0;
         data = abuf_wgetblk(obuf, &count, 0);          data = abuf_wgetblk(obuf, &count, 0);
         obuf->used += file_read(f, data, count);          count = file_read(f, data, count);
           abuf_wcommit(obuf, count);
         return f->state & FILE_ROK;          return f->state & FILE_ROK;
 }  }
   
Line 184 
Line 186 
         unsigned char *data;          unsigned char *data;
         unsigned count;          unsigned count;
   
           DPRINTFN(3, "wpipe_in: %s\n", p->name);
   
         if (!(f->state & FILE_WOK))          if (!(f->state & FILE_WOK))
                 return 0;                  return 0;
   
         data = abuf_rgetblk(ibuf, &count, 0);          data = abuf_rgetblk(ibuf, &count, 0);
         count = file_write(f, data, count);          count = file_write(f, data, count);
         ibuf->used -= count;          abuf_rdiscard(ibuf, count);
         ibuf->start += count;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
         return f->state & FILE_WOK;          return f->state & FILE_WOK;
 }  }
   
Line 204 
Line 205 
         unsigned char *data;          unsigned char *data;
         unsigned count;          unsigned count;
   
           DPRINTFN(3, "wpipe_out: %s\n", p->name);
   
         if (ABUF_EMPTY(ibuf))          if (ABUF_EMPTY(ibuf))
                 return 0;                  return 0;
         data = abuf_rgetblk(ibuf, &count, 0);          data = abuf_rgetblk(ibuf, &count, 0);
         count = file_write(f, data, count);          count = file_write(f, data, count);
         ibuf->used -= count;          abuf_rdiscard(ibuf, count);
         ibuf->start += count;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
         if (ABUF_EOF(ibuf)) {          if (ABUF_EOF(ibuf)) {
                 abuf_hup(ibuf);                  abuf_hup(ibuf);
                 wpipe_del(p);                  wpipe_del(p);
Line 262 
Line 262 
         short *odata;          short *odata;
         unsigned ocount;          unsigned ocount;
   
         DPRINTFN(4, "mix_bzero: used = %u, zero = %u\n",          DPRINTFN(4, "mix_bzero: used = %u, todo = %u\n",
             obuf->used, obuf->mixtodo);              obuf->used, obuf->mixtodo);
         odata = (short *)abuf_wgetblk(obuf, &ocount, obuf->mixtodo);          odata = (short *)abuf_wgetblk(obuf, &ocount, obuf->mixtodo);
         if (ocount == 0)          if (ocount == 0)
Line 282 
Line 282 
         unsigned i, scount, icount, ocount;          unsigned i, scount, icount, ocount;
         int vol = ibuf->mixvol;          int vol = ibuf->mixvol;
   
         DPRINTFN(4, "mix_badd: zero = %u, done = %u\n",          DPRINTFN(4, "mix_badd: todo = %u, done = %u\n",
             obuf->mixtodo, ibuf->mixdone);              obuf->mixtodo, ibuf->mixdone);
   
         idata = (short *)abuf_rgetblk(ibuf, &icount, 0);          idata = (short *)abuf_rgetblk(ibuf, &icount, 0);
Line 298 
Line 298 
                 *odata += (*idata * vol) >> ADATA_SHIFT;                  *odata += (*idata * vol) >> ADATA_SHIFT;
                 idata++;                  idata++;
                 odata++;                  odata++;
         }          }
           abuf_rdiscard(ibuf, scount);
         ibuf->used -= scount;  
         ibuf->mixdone += scount;          ibuf->mixdone += scount;
         ibuf->start += scount;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
   
         DPRINTFN(4, "mix_badd: added %u, done = %u, zero = %u\n",          DPRINTFN(4, "mix_badd: added %u, done = %u, todo = %u\n",
             scount, ibuf->mixdone, obuf->mixtodo);              scount, ibuf->mixdone, obuf->mixtodo);
 }  }
   
Line 355 
Line 351 
         if (ocount == 0)          if (ocount == 0)
                 return 0;                  return 0;
   
         obuf->used += ocount;          abuf_wcommit(obuf, ocount);
         obuf->mixtodo -= ocount;          obuf->mixtodo -= ocount;
         abuf_flush(obuf);          abuf_flush(obuf);
         mix_bzero(p);          mix_bzero(p);
Line 381 
Line 377 
         struct abuf *i, *inext;          struct abuf *i, *inext;
         unsigned ocount, drop;          unsigned ocount, drop;
   
         DPRINTFN(4, "mix_out: used = %u, zero = %u\n",          DPRINTFN(4, "mix_out: used = %u, todo = %u\n",
             obuf->used, obuf->mixtodo);              obuf->used, obuf->mixtodo);
   
         mix_bzero(p);          mix_bzero(p);
Line 421 
Line 417 
                 aproc_del(p);                  aproc_del(p);
                 return 0;                  return 0;
         }          }
         obuf->used += ocount;          abuf_wcommit(obuf, ocount);
         obuf->mixtodo -= ocount;          obuf->mixtodo -= ocount;
         LIST_FOREACH(i, &p->ibuflist, ient) {          LIST_FOREACH(i, &p->ibuflist, ient) {
                 i->mixdone -= ocount;                  i->mixdone -= ocount;
Line 505 
Line 501 
                 return;                  return;
         scount = (icount < ocount) ? icount : ocount;          scount = (icount < ocount) ? icount : ocount;
         memcpy(odata, idata, scount);          memcpy(odata, idata, scount);
           abuf_wcommit(obuf, scount);
         obuf->subdone += scount;          obuf->subdone += scount;
         obuf->used += scount;  
         DPRINTFN(4, "sub_bcopy: %u bytes\n", scount);          DPRINTFN(4, "sub_bcopy: %u bytes\n", scount);
 }  }
   
Line 560 
Line 556 
         LIST_FOREACH(i, &p->obuflist, oent) {          LIST_FOREACH(i, &p->obuflist, oent) {
                 i->subdone -= done;                  i->subdone -= done;
         }          }
         ibuf->used -= done;          abuf_rdiscard(ibuf, done);
         ibuf->start += done;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
         return again;          return again;
 }  }
   
Line 610 
Line 603 
         LIST_FOREACH(i, &p->obuflist, oent) {          LIST_FOREACH(i, &p->obuflist, oent) {
                 i->subdone -= done;                  i->subdone -= done;
         }          }
         ibuf->used -= done;          abuf_rdiscard(ibuf, done);
         ibuf->start += done;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
         if (ABUF_EOF(ibuf)) {          if (ABUF_EOF(ibuf)) {
                 abuf_hup(ibuf);                  abuf_hup(ibuf);
                 for (i = LIST_FIRST(&p->obuflist);                  for (i = LIST_FIRST(&p->obuflist);
Line 799 
Line 789 
          * Update FIFO pointers.           * Update FIFO pointers.
          */           */
         icount -= ifr * ist->bpf;          icount -= ifr * ist->bpf;
         ibuf->used -= icount;  
         ibuf->start += icount;  
         if (ibuf->start >= ibuf->len)  
                 ibuf->start -= ibuf->len;  
   
         ocount -= ofr * ost->bpf;          ocount -= ofr * ost->bpf;
         obuf->used += ocount;          abuf_rdiscard(ibuf, icount);
           abuf_wcommit(obuf, ocount);
 }  }
   
 void  void

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6