diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2010-11-05 15:23:19 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2010-11-05 15:23:19 +0000 |
commit | e739e5f9276dcaa4b2b6f4618d71f093a53f815b (patch) | |
tree | 1cd0323ff4436acb201c17d6983f46b475d0b9ae /usr.bin/aucat/wav.c | |
parent | a4b29f41786044a9124a64678ddf5d0c29e3d96e (diff) |
Convert ulaw/alaw to native format (ie using ADATA_XXX defines) rather
than s16 (using hardcoded constants). Currently s16 is the native format,
so no behavior change.
Diffstat (limited to 'usr.bin/aucat/wav.c')
-rw-r--r-- | usr.bin/aucat/wav.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/aucat/wav.c b/usr.bin/aucat/wav.c index d901ad3f927..4ab6ba9a428 100644 --- a/usr.bin/aucat/wav.c +++ b/usr.bin/aucat/wav.c @@ -203,14 +203,14 @@ wav_conv(unsigned char *data, unsigned count, short *map) { unsigned i; unsigned char *iptr; - short *optr; + adata_t *optr; iptr = data + count; - optr = (short *)data + count; + optr = (adata_t *)data + count; for (i = count; i > 0; i--) { --optr; --iptr; - *optr = map[*iptr]; + *optr = (adata_t)(map[*iptr]) << (ADATA_BITS - 16); } } @@ -224,7 +224,7 @@ wav_read(struct file *file, unsigned char *data, unsigned count) unsigned n; if (f->map) - count /= sizeof(short); + count /= sizeof(adata_t); if (f->rbytes >= 0 && count > f->rbytes) { count = f->rbytes; /* file->rbytes fits in count */ if (count == 0) { @@ -246,7 +246,7 @@ wav_read(struct file *file, unsigned char *data, unsigned count) f->rbytes -= n; if (f->map) { wav_conv(data, n, f->map); - n *= sizeof(short); + n *= sizeof(adata_t); } return n; } |