diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-05-26 07:26:37 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-05-26 07:26:37 +0000 |
commit | e1d269e66e0083ee5d166c48ffbdf88a1d9ae408 (patch) | |
tree | 4944407a38cdf2d4d48cf1dead6fba8869b68c7f /usr.bin | |
parent | a76b2bb9ddd43569d8335eebb3456d6c60b492b1 (diff) |
make clipping less ugly, from Sviatoslav Chagaev
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/aucat/aproc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c index d4e13bf1bc1..4d8b32fd642 100644 --- a/usr.bin/aucat/aproc.c +++ b/usr.bin/aucat/aproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aproc.c,v 1.65 2011/05/26 07:18:40 ratchov Exp $ */ +/* $OpenBSD: aproc.c,v 1.66 2011/05/26 07:26:36 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -616,7 +616,7 @@ mix_badd(struct abuf *ibuf, struct abuf *obuf) unsigned cmin, cmax; unsigned i, j, cc, istart, inext, onext, ostart; unsigned scount, icount, ocount; - int vol; + int vol, s; #ifdef DEBUG if (debug_level >= 4) { @@ -673,7 +673,12 @@ mix_badd(struct abuf *ibuf, struct abuf *obuf) idata += istart; for (i = scount; i > 0; i--) { for (j = cc; j > 0; j--) { - *odata += ADATA_MUL(*idata, vol); + s = *odata + ADATA_MUL(*idata, vol); + if (s >= ADATA_UNIT) + s = ADATA_UNIT - 1; + else if (s < -ADATA_UNIT) + s = -ADATA_UNIT; + *odata = s; idata++; odata++; } |