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

Diff for /src/usr.bin/aucat/Attic/sock.c between version 1.24 and 1.25

version 1.24, 2009/08/21 16:48:03 version 1.25, 2009/08/26 06:10:15
Line 301 
Line 301 
         f->round = dev_round;          f->round = dev_round;
         f->delta = 0;          f->delta = 0;
         f->tickpending = 0;          f->tickpending = 0;
         f->vol = ADATA_UNIT;          f->vol = f->lastvol = MIDI_MAXCTL;
         f->slot = -1;          f->slot = -1;
   
         wproc = aproc_new(&wsock_ops, f->pipe.file.name);          wproc = aproc_new(&wsock_ops, f->pipe.file.name);
Line 363 
Line 363 
 }  }
   
 /*  /*
  * Set volume.   * Set volume. Callback invoked when volume is modified externally
  */   */
 void  void
 sock_setvol(struct sock *f, int vol)  sock_setvol(void *arg, unsigned vol)
 {  {
           struct sock *f = (struct sock *)arg;
         struct abuf *rbuf;          struct abuf *rbuf;
   
         f->vol = vol;          f->vol = vol;
           if (f->pstate <= SOCK_START)
                   f->lastvol = f->vol;
         rbuf = LIST_FIRST(&f->pipe.file.rproc->obuflist);          rbuf = LIST_FIRST(&f->pipe.file.rproc->obuflist);
         if (!rbuf) {          if (!rbuf) {
                 DPRINTF("sock_setvol: no read buffer yet\n");                  DPRINTF("sock_setvol: no read buffer yet\n");
                 return;                  return;
         }          }
         dev_setvol(rbuf, vol);          dev_setvol(rbuf, MIDI_TO_ADATA(vol));
 }  }
   
 /*  /*
Line 408 
Line 411 
             (f->mode & AMSG_REC)  ? wbuf : NULL, &f->wpar, f->xrun,              (f->mode & AMSG_REC)  ? wbuf : NULL, &f->wpar, f->xrun,
             f->opt->maxweight);              f->opt->maxweight);
         if (f->mode & AMSG_PLAY)          if (f->mode & AMSG_PLAY)
                 dev_setvol(rbuf, f->vol);                  dev_setvol(rbuf, MIDI_TO_ADATA(f->vol));
   
         /*          /*
          * Send the initial position, if needed.           * Send the initial position, if needed.
Line 778 
Line 781 
                 f->mode |= AMSG_REC;                  f->mode |= AMSG_REC;
         }          }
         if (dev_midi) {          if (dev_midi) {
                 f->slot = ctl_slotnew(dev_midi, p->who, f->pipe.file.rproc);                  f->slot = ctl_slotnew(dev_midi, p->who, sock_setvol, f);
                 if (f->slot < 0) {                  if (f->slot < 0) {
                         DPRINTF("sock_hello: out of mixer slots\n");                          DPRINTF("sock_hello: out of mixer slots\n");
                         return 0;                          return 0;
Line 926 
Line 929 
                         return 0;                          return 0;
                 }                  }
                 DPRINTF("sock_execmsg: SETVOL %u\n", m->u.vol.ctl);                  DPRINTF("sock_execmsg: SETVOL %u\n", m->u.vol.ctl);
                 sock_setvol(f, MIDI_TO_ADATA(m->u.vol.ctl));                  sock_setvol(f, m->u.vol.ctl);
                 if (dev_midi && f->slot >= 0)                  if (dev_midi && f->slot >= 0)
                         ctl_slotvol(dev_midi, f->slot, m->u.vol.ctl);                          ctl_slotvol(dev_midi, f->slot, m->u.vol.ctl);
                 f->rtodo = sizeof(struct amsg);                  f->rtodo = sizeof(struct amsg);
Line 997 
Line 1000 
                 f->wstate = SOCK_WMSG;                  f->wstate = SOCK_WMSG;
                 f->delta = 0;                  f->delta = 0;
                 f->tickpending = 0;                  f->tickpending = 0;
                   return 1;
           }
   
           /*
            * if volume changed build a SETVOL message
            */
           if (f->vol != f->lastvol) {
                   DPRINTFN(4, "sock_buildmsg: %p: SETVOL: %d\n", f, f->vol);
                   AMSG_INIT(&f->wmsg);
                   f->wmsg.cmd = AMSG_SETVOL;
                   f->wmsg.u.vol.ctl = f->vol;
                   f->wtodo = sizeof(struct amsg);
                   f->wstate = SOCK_WMSG;
                   f->lastvol = f->vol;
                 return 1;                  return 1;
         }          }
   

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25