summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/aproc.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-11-10 23:25:38 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-11-10 23:25:38 +0000
commit122ebd30c24a1bbcc01712945fe70a9507035d0e (patch)
tree9e208a9d9db736070d535889a5ccfa6cd1475221 /usr.bin/aucat/aproc.c
parent826857ad8597b5c1726eb93815778835b5322a00 (diff)
add a per-stream ``soft volume'' knob and the corresponding -v option.
The code will be useful later for the volume knob in the sndio API.
Diffstat (limited to 'usr.bin/aucat/aproc.c')
-rw-r--r--usr.bin/aucat/aproc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c
index 890d51089ce..8f842d1fbed 100644
--- a/usr.bin/aucat/aproc.c
+++ b/usr.bin/aucat/aproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.c,v 1.22 2008/11/09 16:26:07 ratchov Exp $ */
+/* $OpenBSD: aproc.c,v 1.23 2008/11/10 23:25:37 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -350,9 +350,9 @@ void
mix_badd(struct abuf *ibuf, struct abuf *obuf)
{
short *idata, *odata;
- int vol = ibuf->mixivol;
unsigned i, j, icnt, onext, ostart;
unsigned scount, icount, ocount;
+ int vol;
DPRINTFN(4, "mix_badd: todo = %u, done = %u\n",
obuf->mixitodo, ibuf->mixodone);
@@ -367,6 +367,7 @@ mix_badd(struct abuf *ibuf, struct abuf *obuf)
if (ocount == 0)
return;
+ vol = (ibuf->mixweight * ibuf->mixvol) >> ADATA_SHIFT;
ostart = ibuf->cmin - obuf->cmin;
onext = obuf->cmax - ibuf->cmax + ostart;
icnt = ibuf->cmax - ibuf->cmin + 1;
@@ -531,7 +532,8 @@ mix_newin(struct aproc *p, struct abuf *ibuf)
}
p->u.mix.idle = 0;
ibuf->mixodone = 0;
- ibuf->mixivol = ADATA_UNIT;
+ ibuf->mixvol = ADATA_UNIT;
+ ibuf->mixweight = ADATA_UNIT;
ibuf->xrun = XRUN_IGNORE;
mix_setmaster(p);
}
@@ -603,7 +605,7 @@ mix_setmaster(struct aproc *p)
LIST_FOREACH(buf, &p->ibuflist, ient)
n++;
LIST_FOREACH(buf, &p->ibuflist, ient)
- buf->mixivol = ADATA_UNIT / n;
+ buf->mixweight = ADATA_UNIT / n;
}
void