version 1.70, 2012/03/23 11:59:54 |
version 1.71, 2012/04/11 06:05:43 |
|
|
} |
} |
|
|
int |
int |
rfile_do(struct aproc *p, unsigned todo, unsigned *done) |
rfile_do(struct aproc *p, unsigned int todo, unsigned int *done) |
{ |
{ |
struct abuf *obuf = LIST_FIRST(&p->outs); |
struct abuf *obuf = LIST_FIRST(&p->outs); |
struct file *f = p->u.io.file; |
struct file *f = p->u.io.file; |
unsigned char *data; |
unsigned char *data; |
unsigned n, count, off; |
unsigned int n, count, off; |
|
|
off = p->u.io.partial; |
off = p->u.io.partial; |
data = abuf_wgetblk(obuf, &count, 0); |
data = abuf_wgetblk(obuf, &count, 0); |
|
|
} |
} |
|
|
int |
int |
wfile_do(struct aproc *p, unsigned todo, unsigned *done) |
wfile_do(struct aproc *p, unsigned int todo, unsigned int *done) |
{ |
{ |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
struct file *f = p->u.io.file; |
struct file *f = p->u.io.file; |
unsigned char *data; |
unsigned char *data; |
unsigned n, count, off; |
unsigned int n, count, off; |
|
|
off = p->u.io.partial; |
off = p->u.io.partial; |
data = abuf_rgetblk(ibuf, &count, 0); |
data = abuf_rgetblk(ibuf, &count, 0); |
|
|
void |
void |
mix_drop(struct abuf *buf, int extra) |
mix_drop(struct abuf *buf, int extra) |
{ |
{ |
unsigned count; |
unsigned int count; |
|
|
buf->r.mix.drop += extra; |
buf->r.mix.drop += extra; |
while (buf->r.mix.drop > 0) { |
while (buf->r.mix.drop > 0) { |
|
|
* obuf->w.mix.todo doesn't exceed the given value |
* obuf->w.mix.todo doesn't exceed the given value |
*/ |
*/ |
void |
void |
mix_bzero(struct abuf *obuf, unsigned maxtodo) |
mix_bzero(struct abuf *obuf, unsigned int maxtodo) |
{ |
{ |
adata_t *odata; |
adata_t *odata; |
unsigned ocount, todo; |
unsigned int ocount, todo; |
|
|
if (obuf->w.mix.todo >= maxtodo) |
if (obuf->w.mix.todo >= maxtodo) |
return; |
return; |
|
|
/* |
/* |
* Mix an input block over an output block. |
* Mix an input block over an output block. |
*/ |
*/ |
unsigned |
unsigned int |
mix_badd(struct abuf *ibuf, struct abuf *obuf) |
mix_badd(struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
adata_t *idata, *odata; |
adata_t *idata, *odata; |
unsigned cmin, cmax; |
unsigned int cmin, cmax; |
unsigned i, j, cc, istart, inext, onext, ostart; |
unsigned int i, j, cc, istart, inext, onext, ostart; |
unsigned scount, icount, ocount; |
unsigned int scount, icount, ocount; |
int vol, s; |
int vol, s; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
|
|
mix_xrun(struct aproc *p, struct abuf *i) |
mix_xrun(struct aproc *p, struct abuf *i) |
{ |
{ |
struct abuf *obuf = LIST_FIRST(&p->outs); |
struct abuf *obuf = LIST_FIRST(&p->outs); |
unsigned fdrop, remain; |
unsigned int fdrop, remain; |
|
|
if (i->r.mix.done > 0) |
if (i->r.mix.done > 0) |
return 1; |
return 1; |
|
|
mix_in(struct aproc *p, struct abuf *ibuf) |
mix_in(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->outs); |
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->outs); |
unsigned odone; |
unsigned int odone; |
unsigned maxwrite; |
unsigned int maxwrite; |
unsigned scount; |
unsigned int scount; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 4) { |
if (debug_level >= 4) { |
|
|
mix_out(struct aproc *p, struct abuf *obuf) |
mix_out(struct aproc *p, struct abuf *obuf) |
{ |
{ |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
unsigned odone; |
unsigned int odone; |
unsigned maxwrite; |
unsigned int maxwrite; |
unsigned scount; |
unsigned int scount; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 4) { |
if (debug_level >= 4) { |
|
|
mix_eof(struct aproc *p, struct abuf *ibuf) |
mix_eof(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct abuf *i, *obuf = LIST_FIRST(&p->outs); |
struct abuf *i, *obuf = LIST_FIRST(&p->outs); |
unsigned odone; |
unsigned int odone; |
|
|
mix_setmaster(p); |
mix_setmaster(p); |
|
|
|
|
}; |
}; |
|
|
struct aproc * |
struct aproc * |
mix_new(char *name, int maxlat, unsigned round, |
mix_new(char *name, int maxlat, unsigned int round, |
unsigned autovol, unsigned master) |
unsigned int autovol, unsigned int master) |
{ |
{ |
struct aproc *p; |
struct aproc *p; |
|
|
|
|
void |
void |
mix_setmaster(struct aproc *p) |
mix_setmaster(struct aproc *p) |
{ |
{ |
unsigned n; |
unsigned int n; |
struct abuf *i, *j; |
struct abuf *i, *j; |
int weight; |
int weight; |
|
|
|
|
sub_silence(struct abuf *buf, int extra) |
sub_silence(struct abuf *buf, int extra) |
{ |
{ |
unsigned char *data; |
unsigned char *data; |
unsigned count; |
unsigned int count; |
|
|
buf->w.sub.silence += extra; |
buf->w.sub.silence += extra; |
if (buf->w.sub.silence > 0) { |
if (buf->w.sub.silence > 0) { |
|
|
sub_bcopy(struct abuf *ibuf, struct abuf *obuf) |
sub_bcopy(struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
adata_t *idata, *odata; |
adata_t *idata, *odata; |
unsigned cmin, cmax; |
unsigned int cmin, cmax; |
unsigned i, j, cc, istart, inext, onext, ostart; |
unsigned int i, j, cc, istart, inext, onext, ostart; |
unsigned icount, ocount, scount; |
unsigned int icount, ocount, scount; |
|
|
/* |
/* |
* Drop samples for xrun correction |
* Drop samples for xrun correction |
|
|
sub_xrun(struct aproc *p, struct abuf *i) |
sub_xrun(struct aproc *p, struct abuf *i) |
{ |
{ |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
unsigned fdrop, remain; |
unsigned int fdrop, remain; |
|
|
if (i->w.sub.done > 0) |
if (i->w.sub.done > 0) |
return 1; |
return 1; |
|
|
sub_in(struct aproc *p, struct abuf *ibuf) |
sub_in(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
unsigned idone; |
unsigned int idone; |
|
|
if (!ABUF_ROK(ibuf)) |
if (!ABUF_ROK(ibuf)) |
return 0; |
return 0; |
|
|
{ |
{ |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
struct abuf *ibuf = LIST_FIRST(&p->ins); |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
unsigned idone; |
unsigned int idone; |
|
|
if (!SUB_WOK(obuf)) |
if (!SUB_WOK(obuf)) |
return 0; |
return 0; |
|
|
sub_hup(struct aproc *p, struct abuf *obuf) |
sub_hup(struct aproc *p, struct abuf *obuf) |
{ |
{ |
struct abuf *i, *ibuf = LIST_FIRST(&p->ins); |
struct abuf *i, *ibuf = LIST_FIRST(&p->ins); |
unsigned idone; |
unsigned int idone; |
|
|
if (!aproc_inuse(p)) { |
if (!aproc_inuse(p)) { |
#ifdef DEBUG |
#ifdef DEBUG |
|
|
}; |
}; |
|
|
struct aproc * |
struct aproc * |
sub_new(char *name, int maxlat, unsigned round) |
sub_new(char *name, int maxlat, unsigned int round) |
{ |
{ |
struct aproc *p; |
struct aproc *p; |
|
|
|
|
void |
void |
resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
unsigned inch; |
unsigned int inch; |
adata_t *idata; |
adata_t *idata; |
unsigned oblksz; |
unsigned int oblksz; |
unsigned ifr; |
unsigned int ifr; |
unsigned onch; |
unsigned int onch; |
int s, ds, diff; |
int s, ds, diff; |
adata_t *odata; |
adata_t *odata; |
unsigned iblksz; |
unsigned int iblksz; |
unsigned ofr; |
unsigned int ofr; |
unsigned c; |
unsigned int c; |
adata_t *ctxbuf, *ctx; |
adata_t *ctxbuf, *ctx; |
unsigned ctx_start; |
unsigned int ctx_start; |
unsigned icount, ocount; |
unsigned int icount, ocount; |
|
|
/* |
/* |
* Calculate max frames readable at once from the input buffer. |
* Calculate max frames readable at once from the input buffer. |
|
|
}; |
}; |
|
|
struct aproc * |
struct aproc * |
resamp_new(char *name, unsigned iblksz, unsigned oblksz) |
resamp_new(char *name, unsigned int iblksz, unsigned int oblksz) |
{ |
{ |
struct aproc *p; |
struct aproc *p; |
unsigned i; |
unsigned int i; |
|
|
p = aproc_new(&resamp_ops, name); |
p = aproc_new(&resamp_ops, name); |
p->u.resamp.iblksz = iblksz; |
p->u.resamp.iblksz = iblksz; |
|
|
void |
void |
enc_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
enc_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
unsigned nch, scount, icount, ocount; |
unsigned int nch, scount, icount, ocount; |
unsigned f; |
unsigned int f; |
adata_t *idata; |
adata_t *idata; |
int s; |
int s; |
unsigned oshift; |
unsigned int oshift; |
int osigbit; |
int osigbit; |
unsigned obps; |
unsigned int obps; |
unsigned i; |
unsigned int i; |
unsigned char *odata; |
unsigned char *odata; |
int obnext; |
int obnext; |
int osnext; |
int osnext; |
|
|
void |
void |
dec_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
dec_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
unsigned nch, scount, icount, ocount; |
unsigned int nch, scount, icount, ocount; |
unsigned f; |
unsigned int f; |
unsigned ibps; |
unsigned int ibps; |
unsigned i; |
unsigned int i; |
int s = 0xdeadbeef; |
int s = 0xdeadbeef; |
unsigned char *idata; |
unsigned char *idata; |
int ibnext; |
int ibnext; |
int isnext; |
int isnext; |
int isigbit; |
int isigbit; |
unsigned ishift; |
unsigned int ishift; |
adata_t *odata; |
adata_t *odata; |
|
|
/* |
/* |
|
|
void |
void |
join_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
join_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf) |
{ |
{ |
unsigned h, hops; |
unsigned int h, hops; |
unsigned inch, inext; |
unsigned int inch, inext; |
adata_t *idata; |
adata_t *idata; |
unsigned onch, onext; |
unsigned int onch, onext; |
adata_t *odata; |
adata_t *odata; |
int scale; |
int scale; |
unsigned c, f, scount, icount, ocount; |
unsigned int c, f, scount, icount, ocount; |
|
|
/* |
/* |
* Calculate max frames readable at once from the input buffer. |
* Calculate max frames readable at once from the input buffer. |
|
|
mon_flush(struct aproc *p) |
mon_flush(struct aproc *p) |
{ |
{ |
struct abuf *obuf = LIST_FIRST(&p->outs); |
struct abuf *obuf = LIST_FIRST(&p->outs); |
unsigned count; |
unsigned int count; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 4) { |
if (debug_level >= 4) { |
|
|
* Copy one block. |
* Copy one block. |
*/ |
*/ |
void |
void |
mon_snoop(struct aproc *p, struct abuf *ibuf, unsigned pos, unsigned todo) |
mon_snoop(struct aproc *p, struct abuf *ibuf, |
|
unsigned int pos, unsigned int todo) |
{ |
{ |
struct abuf *obuf = LIST_FIRST(&p->outs); |
struct abuf *obuf = LIST_FIRST(&p->outs); |
unsigned scount, icount, ocount; |
unsigned int scount, icount, ocount; |
adata_t *idata, *odata; |
adata_t *idata, *odata; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
|
|
}; |
}; |
|
|
struct aproc * |
struct aproc * |
mon_new(char *name, unsigned bufsz) |
mon_new(char *name, unsigned int bufsz) |
{ |
{ |
struct aproc *p; |
struct aproc *p; |
|
|