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

Diff for /src/usr.bin/audioctl/audioctl.c between version 1.29 and 1.30

version 1.29, 2015/07/28 20:51:10 version 1.30, 2016/01/29 10:23:56
Line 63 
Line 63 
   
 struct audio_pos getpos;  struct audio_pos getpos;
   
   unsigned int block_size;
   
 struct field {  struct field {
         const char *name;          const char *name;
         void *valp;          void *valp;
Line 85 
Line 87 
         { "encodings",          encbuf,                 STRING, READONLY },          { "encodings",          encbuf,                 STRING, READONLY },
         { "properties",         &properties,            PROPS,  READONLY },          { "properties",         &properties,            PROPS,  READONLY },
         { "hiwat",              &info.hiwat,            UINT,   0 },          { "hiwat",              &info.hiwat,            UINT,   0 },
         { "lowat",              &info.lowat,            UINT,   0 },  
         { "mode",               &info.mode,             P_R,    READONLY },          { "mode",               &info.mode,             P_R,    READONLY },
         { "play.rate",          &info.play.sample_rate, UINT,   0 },          { "rate",               &info.play.sample_rate, UINT,   0 },
         { "play.sample_rate",   &info.play.sample_rate, UINT,   ALIAS },          { "precision",          &info.play.precision,   UINT,   0 },
           { "bps",                &info.play.bps,         UINT,   0 },
           { "msb",                &info.play.msb,         UINT,   0 },
           { "encoding",           &info.play.encoding,    ENC,    0 },
           { "pause",              &info.play.pause,       UCHAR,  0 },
           { "active",             &info.play.active,      UCHAR,  READONLY },
           { "block_size",         &block_size,            UINT,   0 },
         { "play.channels",      &info.play.channels,    UINT,   0 },          { "play.channels",      &info.play.channels,    UINT,   0 },
         { "play.precision",     &info.play.precision,   UINT,   0 },  
         { "play.bps",           &info.play.bps,         UINT,   0 },  
         { "play.msb",           &info.play.msb,         UINT,   0 },  
         { "play.encoding",      &info.play.encoding,    ENC,    0 },  
         { "play.pause",         &info.play.pause,       UCHAR,  0 },  
         { "play.active",        &info.play.active,      UCHAR,  READONLY },  
         { "play.block_size",    &info.play.block_size,  UINT,   0 },  
         { "play.bytes",         &getpos.play_pos,       UINT,   READONLY },          { "play.bytes",         &getpos.play_pos,       UINT,   READONLY },
         { "play.errors",        &getpos.play_xrun,      UINT,   READONLY },          { "play.errors",        &getpos.play_xrun,      UINT,   READONLY },
         { "record.rate",        &info.record.sample_rate,UINT,  0 },  
         { "record.sample_rate", &info.record.sample_rate,UINT,  ALIAS },  
         { "record.channels",    &info.record.channels,  UINT,   0 },          { "record.channels",    &info.record.channels,  UINT,   0 },
         { "record.precision",   &info.record.precision, UINT,   0 },  
         { "record.bps",         &info.record.bps,       UINT,   0 },  
         { "record.msb",         &info.record.msb,       UINT,   0 },  
         { "record.encoding",    &info.record.encoding,  ENC,    0 },  
         { "record.pause",       &info.record.pause,     UCHAR,  0 },  
         { "record.active",      &info.record.active,    UCHAR,  READONLY },  
         { "record.block_size",  &info.record.block_size,UINT,   0 },  
         { "record.bytes",       &getpos.rec_pos,        UINT,   READONLY },          { "record.bytes",       &getpos.rec_pos,        UINT,   READONLY },
         { "record.errors",      &getpos.rec_xrun,       UINT,   READONLY },          { "record.errors",      &getpos.rec_xrun,       UINT,   READONLY },
         { 0 }          { 0 }
Line 303 
Line 294 
                 err(1, "AUDIO_GETINFO");                  err(1, "AUDIO_GETINFO");
         if (ioctl(fd, AUDIO_GETPOS, &getpos) < 0)          if (ioctl(fd, AUDIO_GETPOS, &getpos) < 0)
                 err(1, "AUDIO_GETPOS");                  err(1, "AUDIO_GETPOS");
           block_size = info.play.block_size /
               (info.play.channels * info.play.bps);
 }  }
   
 void  void
Line 419 
Line 412 
                         }                          }
                         argv++;                          argv++;
                 }                  }
                 if (writeinfo && ioctl(fd, AUDIO_SETINFO, &info) < 0)                  if (writeinfo) {
                         err(1, "set failed");                          info.record.sample_rate = info.play.sample_rate;
                           info.record.encoding = info.play.encoding;
                           info.record.precision = info.play.precision;
                           info.record.bps = info.play.bps;
                           info.record.msb = info.play.msb;
                           info.record.block_size = block_size *
                                   info.record.bps * info.record.channels;
                           info.play.block_size = block_size *
                                   info.play.bps * info.play.channels;
                           if (ioctl(fd, AUDIO_SETINFO, &info) < 0)
                                   err(1, "set failed");
                   }
                 getinfo(fd);                  getinfo(fd);
                 for (i = 0; fields[i].name; i++) {                  for (i = 0; fields[i].name; i++) {
                         if (fields[i].flags & SET) {                          if (fields[i].flags & SET) {

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30