diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-12-31 04:14:01 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-12-31 04:14:01 +0000 |
commit | 660d9841f0873b643c3ae890cebfe866c7d3394d (patch) | |
tree | c18bfe68055866c02ff67b7ea655922074fb60e0 /sys/dev/auconv.c | |
parent | 2f92435af077b751dd6006b8a9c8cb40c89de5ad (diff) |
add a mono-to-stereo versions; from Kazuhiko Fukuhara <zaa83571@oak.zero.ad.jp>
Diffstat (limited to 'sys/dev/auconv.c')
-rw-r--r-- | sys/dev/auconv.c | 220 |
1 files changed, 219 insertions, 1 deletions
diff --git a/sys/dev/auconv.c b/sys/dev/auconv.c index 796ef5a7a79..78b913844a0 100644 --- a/sys/dev/auconv.c +++ b/sys/dev/auconv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auconv.c,v 1.3 2001/05/01 01:49:48 aaron Exp $ */ +/* $OpenBSD: auconv.c,v 1.4 2001/12/31 04:14:00 mickey Exp $ */ /* $NetBSD: auconv.c,v 1.3 1999/11/01 18:12:19 augustss Exp $ */ /* @@ -202,3 +202,221 @@ linear16_to_linear8_be(v, p, cc) p += 2; } } + +void +ulinear8_to_linear16_le(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while (--cc >= 0) { + q -= 2; + q[1] = (*--p) ^ 0x80; + q[0] = 0; + } +} + +/* + * just expand mono to stereo, no other conversions + */ +void +noswap_bytes_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while ((cc -= 2) >= 0) { + q -= 4; + q[1] = q[3] = *--p; + q[0] = q[2] = *--p; + } +} + +/* + * same as swap_bytes(), just expand mono to stereo + */ +void +swap_bytes_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while ((cc -= 2) >= 0) { + q -= 4; + q[0] = q[2] = *--p; + q[1] = q[3] = *--p; + } +} + +/* + * same as linear8_to_linear16_le(), plus expand mono to stereo + */ +void +linear8_to_linear16_le_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 4; + while (--cc >= 0) { + q -= 4; + q[1] = q[3] = *--p; + q[0] = q[2] = 0; + } +} + +/* + * same as linear8_to_linear16_be(), plus expand mono to stereo + */ +void +linear8_to_linear16_be_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 4; + while (--cc >= 0) { + q -= 4; + q[0] = q[2] = *--p; + q[1] = q[3] = 0; + } +} + +void +ulinear8_to_linear16_be(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while (--cc >= 0) { + q -= 2; + q[0] = (*--p) ^ 0x80; + q[1] = 0; + } +} + +/* + * same as ulinear8_to_linear16_le(), plus expand mono to stereo + */ +void +ulinear8_to_linear16_le_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 4; + while (--cc >= 0) { + q -= 4; + q[1] = q[3] = (*--p) ^ 0x80; + q[0] = q[2] = 0; + } +} + +/* + * same as ulinear8_to_linear16_be(), plus expand mono to stereo + */ +void +ulinear8_to_linear16_be_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 4; + while (--cc >= 0) { + q -= 4; + q[0] = q[2] = (*--p) ^ 0x80; + q[1] = q[3] = 0; + } +} + +/* + * same as change_sign16_le(), plus expand mono to stereo + */ +void +change_sign16_le_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while ((cc -= 2) >= 0) { + q -= 4; + q[1] = q[3] = (*--p) ^ 0x80; + q[0] = q[2] = *--p; + } +} + +/* + * same as change_sign16_be(), plus expand mono to stereo + */ +void +change_sign16_be_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + u_char *q = p; + + p += cc; + q += cc * 2; + while ((cc -= 2) >= 0) { + q -= 4; + q[0] = q[2] = (*--p) ^ 0x80; + q[1] = q[3] = *--p; + } +} + +/* + * same as change_sign16_swap_bytes_le(), plus expand mono to stereo + */ +void +change_sign16_swap_bytes_le_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + change_sign16_be_mts(v, p, cc); +} + +/* + * same as change_sign16_swap_bytes_be(), plus expand mono to stereo + */ +void +change_sign16_swap_bytes_be_mts(v, p, cc) + void *v; + u_char *p; + int cc; +{ + change_sign16_le_mts(v, p, cc); +} |