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

Diff for /src/usr.bin/sndiod/dev.c between version 1.59 and 1.60

version 1.59, 2019/09/19 05:02:27 version 1.60, 2019/09/19 05:04:34
Line 82 
Line 82 
 void slot_ready(struct slot *);  void slot_ready(struct slot *);
 void slot_allocbufs(struct slot *);  void slot_allocbufs(struct slot *);
 void slot_freebufs(struct slot *);  void slot_freebufs(struct slot *);
   void slot_initconv(struct slot *);
 void slot_start(struct slot *);  void slot_start(struct slot *);
 void slot_detach(struct slot *);  void slot_detach(struct slot *);
 void slot_stop(struct slot *);  void slot_stop(struct slot *);
Line 1425 
Line 1426 
                 dev_mmcstart(d);                  dev_mmcstart(d);
 }  }
   
   
 /*  /*
  * allocate buffers & conversion chain   * allocate buffers & conversion chain
  */   */
 void  void
 slot_allocbufs(struct slot *s)  slot_initconv(struct slot *s)
 {  {
         unsigned int dev_nch;          unsigned int dev_nch;
         struct dev *d = s->dev;          struct dev *d = s->dev;
   
         if (s->mode & MODE_PLAY) {          if (s->mode & MODE_PLAY) {
                 s->mix.bpf = s->par.bps * s->mix.nch;  
                 abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf);  
   
                 dev_nch = s->opt->pmax - s->opt->pmin + 1;                  dev_nch = s->opt->pmax - s->opt->pmin + 1;
                 s->mix.decbuf = NULL;  
                 s->mix.resampbuf = NULL;  
                 s->mix.join = 1;                  s->mix.join = 1;
                 s->mix.expand = 1;                  s->mix.expand = 1;
                 if (s->opt->dup) {                  if (s->opt->dup) {
Line 1457 
Line 1452 
                     s->opt->pmin, s->opt->pmax);                      s->opt->pmin, s->opt->pmax);
                 if (!aparams_native(&s->par)) {                  if (!aparams_native(&s->par)) {
                         dec_init(&s->mix.dec, &s->par, s->mix.nch);                          dec_init(&s->mix.dec, &s->par, s->mix.nch);
                         s->mix.decbuf =  
                             xmalloc(s->round * s->mix.nch * sizeof(adata_t));  
                 }                  }
                 if (s->rate != d->rate) {                  if (s->rate != d->rate) {
                         resamp_init(&s->mix.resamp, s->round, d->round,                          resamp_init(&s->mix.resamp, s->round, d->round,
                             s->mix.nch);                              s->mix.nch);
                         s->mix.resampbuf =  
                             xmalloc(d->round * s->mix.nch * sizeof(adata_t));  
                 }                  }
         }          }
   
         if (s->mode & MODE_RECMASK) {          if (s->mode & MODE_RECMASK) {
                 s->sub.bpf = s->par.bps * s->sub.nch;  
                 abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf);  
   
                 dev_nch = s->opt->rmax - s->opt->rmin + 1;                  dev_nch = s->opt->rmax - s->opt->rmin + 1;
                 s->sub.encbuf = NULL;  
                 s->sub.resampbuf = NULL;  
                 s->sub.join = 1;                  s->sub.join = 1;
                 s->sub.expand = 1;                  s->sub.expand = 1;
                 if (s->opt->dup) {                  if (s->opt->dup) {
Line 1491 
Line 1477 
                 if (s->rate != d->rate) {                  if (s->rate != d->rate) {
                         resamp_init(&s->sub.resamp, d->round, s->round,                          resamp_init(&s->sub.resamp, d->round, s->round,
                             s->sub.nch);                              s->sub.nch);
                         s->sub.resampbuf =  
                             xmalloc(d->round * s->sub.nch * sizeof(adata_t));  
                 }                  }
                 if (!aparams_native(&s->par)) {                  if (!aparams_native(&s->par)) {
                         enc_init(&s->sub.enc, &s->par, s->sub.nch);                          enc_init(&s->sub.enc, &s->par, s->sub.nch);
                         s->sub.encbuf =  
                             xmalloc(s->round * s->sub.nch * sizeof(adata_t));  
                 }                  }
   
                 /*                  /*
Line 1517 
Line 1499 
                             s->appbufsz * s->sub.nch * sizeof(adata_t));                              s->appbufsz * s->sub.nch * sizeof(adata_t));
                 }                  }
         }          }
   }
   
   /*
    * allocate buffers & conversion chain
    */
   void
   slot_allocbufs(struct slot *s)
   {
           struct dev *d = s->dev;
   
           if (s->mode & MODE_PLAY) {
                   s->mix.bpf = s->par.bps * s->mix.nch;
                   abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf);
   
                   s->mix.decbuf = NULL;
                   s->mix.resampbuf = NULL;
                   if (!aparams_native(&s->par)) {
                           s->mix.decbuf =
                               xmalloc(s->round * s->mix.nch * sizeof(adata_t));
                   }
                   if (s->rate != d->rate) {
                           s->mix.resampbuf =
                               xmalloc(d->round * s->mix.nch * sizeof(adata_t));
                   }
           }
   
           if (s->mode & MODE_RECMASK) {
                   s->sub.bpf = s->par.bps * s->sub.nch;
                   abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf);
   
                   s->sub.encbuf = NULL;
                   s->sub.resampbuf = NULL;
                   if (s->rate != d->rate) {
                           s->sub.resampbuf =
                               xmalloc(d->round * s->sub.nch * sizeof(adata_t));
                   }
                   if (!aparams_native(&s->par)) {
                           s->sub.encbuf =
                               xmalloc(s->round * s->sub.nch * sizeof(adata_t));
                   }
           }
   
           slot_initconv(s);
   
 #ifdef DEBUG  #ifdef DEBUG
         if (log_level >= 3) {          if (log_level >= 3) {

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60