version 1.36, 2009/11/03 21:31:37 |
version 1.37, 2009/11/08 00:08:41 |
|
|
{ |
{ |
struct abuf *ibuf, *obuf; |
struct abuf *ibuf, *obuf; |
|
|
if (sibuf) { |
if (sibuf && *sibuf) { |
ibuf = *sibuf; |
ibuf = *sibuf; |
for (;;) { |
for (;;) { |
if (!ibuf || !ibuf->rproc) { |
if (!ibuf || !ibuf->rproc) { |
|
|
} |
} |
*sibuf = ibuf; |
*sibuf = ibuf; |
} |
} |
if (sobuf) { |
if (sobuf && *sobuf) { |
obuf = *sobuf; |
obuf = *sobuf; |
for (;;) { |
for (;;) { |
if (!obuf || !obuf->wproc) { |
if (!obuf || !obuf->wproc) { |
|
|
delta /= pbuf->bpf * rbuf->bpf; |
delta /= pbuf->bpf * rbuf->bpf; |
if (delta > 0) { |
if (delta > 0) { |
/* |
/* |
* If the play chain is ahead (most cases) drop some of |
* The play chain is ahead (most cases) drop some of |
* the recorded input, to get both in sync. |
* the recorded input, to get both in sync. |
*/ |
*/ |
obuf->drop += delta * obuf->bpf; |
if (obuf) { |
abuf_ipos(obuf, -delta); |
obuf->drop += delta * obuf->bpf; |
|
abuf_ipos(obuf, -delta); |
|
} |
} else if (delta < 0) { |
} else if (delta < 0) { |
/* |
/* |
* If record chain is ahead (should never happen, |
* The record chain is ahead (should never happen, |
* right?) then insert silence to play. |
* right?) then insert silence to play. |
*/ |
*/ |
ibuf->silence += -delta * ibuf->bpf; |
if (ibuf) { |
abuf_opos(ibuf, delta); |
ibuf->silence += -delta * ibuf->bpf; |
|
abuf_opos(ibuf, delta); |
|
} |
} |
} |
} |
} |
|
|
|
|
if (ibuf && obuf) { |
if (ibuf && obuf) { |
ibuf->duplex = obuf; |
ibuf->duplex = obuf; |
obuf->duplex = ibuf; |
obuf->duplex = ibuf; |
dev_sync(ibuf, obuf); |
|
} |
} |
|
dev_sync(ibuf, obuf); |
} |
} |
|
|
/* |
/* |