version 1.6, 2008/08/14 09:39:16 |
version 1.7, 2008/08/14 09:44:15 |
|
|
mix_in(struct aproc *p, struct abuf *ibuf) |
mix_in(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->obuflist); |
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->obuflist); |
unsigned icount, ocount; |
unsigned ocount; |
|
|
DPRINTFN(4, "mix_in: used = %u, done = %u, zero = %u\n", |
DPRINTFN(4, "mix_in: used = %u, done = %u, todo = %u\n", |
ibuf->used, ibuf->mixdone, obuf->mixtodo); |
ibuf->used, ibuf->mixdone, obuf->mixtodo); |
|
|
/* |
|
* discard data already sent as silence |
|
*/ |
|
if (ibuf->mixdrop > 0) { |
|
icount = ibuf->mixdrop; |
|
if (icount > ibuf->used) |
|
icount = ibuf->used; |
|
ibuf->used -= icount; |
|
ibuf->start += icount; |
|
if (ibuf->start >= ibuf->len) |
|
ibuf->start -= ibuf->len; |
|
ibuf->mixdrop -= icount; |
|
DPRINTF("mix_in: catched xruns, drop = %u\n", ibuf->mixdrop); |
|
} |
|
|
|
if (ibuf->mixdone >= obuf->mixtodo) |
if (ibuf->mixdone >= obuf->mixtodo) |
return 0; |
return 0; |
|
|
drop = obuf->mixtodo; |
drop = obuf->mixtodo; |
i->mixdone += drop; |
i->mixdone += drop; |
if (i->xrun == XRUN_SYNC) |
if (i->xrun == XRUN_SYNC) |
i->mixdrop += drop; |
i->drop += drop; |
DPRINTF("mix_out: xrun, drop = %u\n", |
DPRINTF("mix_out: drop = %u\n", i->drop); |
i->mixdrop); |
|
} |
} |
} else |
} else |
mix_badd(i, obuf); |
mix_badd(i, obuf); |
|
|
mix_newin(struct aproc *p, struct abuf *ibuf) |
mix_newin(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
ibuf->mixdone = 0; |
ibuf->mixdone = 0; |
ibuf->mixdrop = 0; |
|
ibuf->mixvol = ADATA_UNIT; |
ibuf->mixvol = ADATA_UNIT; |
ibuf->xrun = XRUN_IGNORE; |
ibuf->xrun = XRUN_IGNORE; |
} |
} |
|
|
} |
} |
drop = ibuf->used; |
drop = ibuf->used; |
if (i->xrun == XRUN_SYNC) |
if (i->xrun == XRUN_SYNC) |
i->subdrop += drop; |
i->silence += drop; |
i->subdone += drop; |
i->subdone += drop; |
DPRINTF("sub_in: xrun, drop = %u\n", |
DPRINTF("sub_in: silence = %u\n", i->silence); |
i->subdrop); |
|
} |
} |
} else { |
} else { |
sub_bcopy(ibuf, i); |
sub_bcopy(ibuf, i); |
|
|
{ |
{ |
struct abuf *ibuf = LIST_FIRST(&p->ibuflist); |
struct abuf *ibuf = LIST_FIRST(&p->ibuflist); |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
unsigned char *odata; |
|
unsigned ocount; |
|
unsigned done; |
unsigned done; |
|
|
/* |
|
* generate silence for dropped samples |
|
*/ |
|
while (obuf->subdrop > 0) { |
|
odata = abuf_wgetblk(obuf, &ocount, 0); |
|
if (ocount >= obuf->subdrop) |
|
ocount = obuf->subdrop; |
|
if (ocount == 0) |
|
break; |
|
memset(odata, 0, ocount); |
|
obuf->used += ocount; |
|
obuf->subdrop -= ocount; |
|
DPRINTF("sub_out: catch, drop = %u\n", obuf->subdrop); |
|
} |
|
|
|
if (obuf->subdone >= ibuf->used) |
if (obuf->subdone >= ibuf->used) |
return 0; |
return 0; |
|
|
|
|
sub_newout(struct aproc *p, struct abuf *obuf) |
sub_newout(struct aproc *p, struct abuf *obuf) |
{ |
{ |
obuf->subdone = 0; |
obuf->subdone = 0; |
obuf->subdrop = 0; |
|
obuf->xrun = XRUN_IGNORE; |
obuf->xrun = XRUN_IGNORE; |
} |
} |
|
|