[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.74 and 1.75

version 1.74, 2020/06/28 05:17:25 version 1.75, 2020/06/28 05:21:39
Line 67 
Line 67 
 void dev_done(struct dev *);  void dev_done(struct dev *);
 struct dev *dev_bynum(int);  struct dev *dev_bynum(int);
 void dev_del(struct dev *);  void dev_del(struct dev *);
   void dev_setalt(struct dev *, unsigned int);
 unsigned int dev_roundof(struct dev *, unsigned int);  unsigned int dev_roundof(struct dev *, unsigned int);
 void dev_wakeup(struct dev *);  void dev_wakeup(struct dev *);
 void dev_sync_attach(struct dev *);  void dev_sync_attach(struct dev *);
Line 1088 
Line 1089 
 }  }
   
 /*  /*
    * set prefered alt device name
    */
   void
   dev_setalt(struct dev *d, unsigned int idx)
   {
           struct dev_alt **pa, *a;
   
           /* find alt with given index */
           for (pa = &d->alt_list; (a = *pa)->idx != idx; pa = &a->next)
                   ;
   
           /* detach from list */
           *pa = a->next;
   
           /* attach at head */
           a->next = d->alt_list;
           d->alt_list = a;
   
           /* reopen device with the new alt */
           if (idx != d->alt_num)
                   dev_reopen(d);
   }
   
   /*
  * adjust device parameters and mode   * adjust device parameters and mode
  */   */
 void  void
Line 1176 
Line 1201 
 {  {
         int i;          int i;
         char name[CTL_NAMEMAX];          char name[CTL_NAMEMAX];
           struct dev_alt *a;
   
         d->master_enabled = 0;          d->master_enabled = 0;
         d->mode = d->reqmode;          d->mode = d->reqmode;
Line 1209 
Line 1235 
                     NULL, -1, 127, d->slot[i].vol);                      NULL, -1, 127, d->slot[i].vol);
         }          }
   
           for (a = d->alt_list; a != NULL; a = a->next) {
                   snprintf(name, sizeof(name), "%d", a->idx);
                   dev_addctl(d, "", CTL_SEL,
                       CTLADDR_ALT_SEL + a->idx,
                       "server", -1, "device",
                       name, -1, 1, a->idx == d->alt_num);
           }
   
         d->pstate = DEV_INIT;          d->pstate = DEV_INIT;
         return 1;          return 1;
 }  }
Line 2472 
Line 2506 
                 c->dirty = 1;                  c->dirty = 1;
                 dev_ref(d);                  dev_ref(d);
         } else {          } else {
                 if (addr == CTLADDR_MASTER) {                  if (addr >= CTLADDR_ALT_SEL) {
                           if (val) {
                                   num = addr - CTLADDR_ALT_SEL;
                                   dev_setalt(d, num);
                           }
                           return 1;
                   } else if (addr == CTLADDR_MASTER) {
                         if (d->master_enabled) {                          if (d->master_enabled) {
                                 dev_master(d, val);                                  dev_master(d, val);
                                 dev_midi_master(d);                                  dev_midi_master(d);

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75