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

Diff for /src/usr.bin/aucat/aucat.c between version 1.158 and 1.159

version 1.158, 2016/05/28 07:28:50 version 1.159, 2016/05/31 07:31:45
Line 102 
Line 102 
 int dev_rate;                           /* device sample rate (Hz) */  int dev_rate;                           /* device sample rate (Hz) */
 unsigned int dev_pchan, dev_rchan;      /* play & rec channels count */  unsigned int dev_pchan, dev_rchan;      /* play & rec channels count */
 adata_t *dev_pbuf, *dev_rbuf;           /* play & rec buffers */  adata_t *dev_pbuf, *dev_rbuf;           /* play & rec buffers */
 unsigned int dev_mmcpos;                /* last MMC position */  long long dev_pos;                      /* last MMC position in frames */
 #define DEV_STOP        0               /* stopped */  #define DEV_STOP        0               /* stopped */
 #define DEV_START       1               /* started */  #define DEV_START       1               /* started */
 unsigned int dev_pstate;                /* one of above */  unsigned int dev_pstate;                /* one of above */
Line 350 
Line 350 
 }  }
   
 static void  static void
 slot_start(struct slot *s, unsigned int mmc)  slot_start(struct slot *s, long long pos)
 {  {
         off_t mmcpos;  
   
 #ifdef DEBUG  #ifdef DEBUG
         if (s->pstate != SLOT_INIT) {          if (s->pstate != SLOT_INIT) {
                 slot_log(s);                  slot_log(s);
Line 361 
Line 359 
                 panic();                  panic();
         }          }
 #endif  #endif
         mmcpos = ((off_t)mmc * s->afile.rate / MTC_SEC) * s->bpf;          /*
         if (!afile_seek(&s->afile, mmcpos)) {           * convert pos to slot sample rate
            *
            * At this stage, we could adjust s->resamp.diff to get
            * sub-frame accuracy.
            */
           pos = pos * s->afile.rate / dev_rate;
   
           if (!afile_seek(&s->afile, pos * s->bpf)) {
                 s->pstate = SLOT_INIT;                  s->pstate = SLOT_INIT;
                 return;                  return;
         }          }
Line 659 
Line 664 
                 dev_rchan = par.rchan;                  dev_rchan = par.rchan;
                 dev_rbuf = xmalloc(sizeof(adata_t) * dev_rchan * dev_round);                  dev_rbuf = xmalloc(sizeof(adata_t) * dev_rchan * dev_round);
         }          }
         dev_mmcpos = 0;          dev_pos = 0;
         dev_pstate = DEV_STOP;          dev_pstate = DEV_STOP;
         if (log_level >= 2) {          if (log_level >= 2) {
                 log_puts(dev_name);                  log_puts(dev_name);
Line 750 
Line 755 
         if (dev_pstate == DEV_STOP) {          if (dev_pstate == DEV_STOP) {
                 dev_pstate = DEV_START;                  dev_pstate = DEV_START;
                 for (s = slot_list; s != NULL; s = s->next)                  for (s = slot_list; s != NULL; s = s->next)
                         slot_start(s, dev_mmcpos);                          slot_start(s, dev_pos);
                 dev_prime = (dev_mode & SIO_PLAY) ? dev_bufsz / dev_round : 0;                  dev_prime = (dev_mode & SIO_PLAY) ? dev_bufsz / dev_round : 0;
                 sio_start(dev_sh);                  sio_start(dev_sh);
                 if (log_level >= 2)                  if (log_level >= 2)
Line 792 
Line 797 
 static void  static void
 dev_mmcloc(unsigned int mmc)  dev_mmcloc(unsigned int mmc)
 {  {
         if (dev_mmcpos == mmc)          long long pos;
   
           pos = mmc * dev_rate / MTC_SEC;
           if (dev_pos == pos)
                 return;                  return;
         dev_mmcpos = mmc;          dev_pos = pos;
         if (log_level >= 2) {          if (log_level >= 2) {
                 log_puts("relocated to ");                  log_puts("relocated to ");
                 log_putu((dev_mmcpos / (MTC_SEC * 3600)) % 24);                  log_putu((mmc / (MTC_SEC * 3600)) % 24);
                 log_puts(":");                  log_puts(":");
                 log_putu((dev_mmcpos / (MTC_SEC * 60)) % 60);                  log_putu((mmc / (MTC_SEC * 60)) % 60);
                 log_puts(":");                  log_puts(":");
                 log_putu((dev_mmcpos / (MTC_SEC)) % 60);                  log_putu((mmc / (MTC_SEC)) % 60);
                 log_puts(".");                  log_puts(".");
                 log_putu((dev_mmcpos / (MTC_SEC / 100)) % 100);                  log_putu((mmc / (MTC_SEC / 100)) % 100);
                   log_puts(".");
                   log_putu((mmc / (MTC_SEC / 100)) % 100);
                 log_puts("\n");                  log_puts("\n");
         }          }
         if (dev_pstate == DEV_START) {          if (dev_pstate == DEV_START) {
Line 1007 
Line 1017 
         dev_pchan = dev_rchan = cmax + 1;          dev_pchan = dev_rchan = cmax + 1;
         dev_pbuf = dev_rbuf = xmalloc(sizeof(adata_t) * dev_pchan * dev_round);          dev_pbuf = dev_rbuf = xmalloc(sizeof(adata_t) * dev_pchan * dev_round);
         dev_pstate = DEV_STOP;          dev_pstate = DEV_STOP;
         dev_mmcpos = 0;          dev_pos = 0;
         for (s = slot_list; s != NULL; s = s->next)          for (s = slot_list; s != NULL; s = s->next)
                 slot_init(s);                  slot_init(s);
         for (s = slot_list; s != NULL; s = s->next)          for (s = slot_list; s != NULL; s = s->next)

Legend:
Removed from v.1.158  
changed lines
  Added in v.1.159