Fix ADPCM playback/recording.

This commit is contained in:
itohy 2002-03-06 07:12:02 +00:00
parent 06c97a1e94
commit 1990961dc9
2 changed files with 18 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ad1848.c,v 1.12 2001/11/13 13:14:31 lukem Exp $ */
/* $NetBSD: ad1848.c,v 1.13 2002/03/06 07:12:02 itohy Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ad1848.c,v 1.12 2001/11/13 13:14:31 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: ad1848.c,v 1.13 2002/03/06 07:12:02 itohy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -893,7 +893,7 @@ ad1848_query_encoding(addr, fp)
return EINVAL;
strcpy(fp->name, AudioEadpcm);
fp->encoding = AUDIO_ENCODING_ADPCM;
fp->precision = 8;
fp->precision = 4;
fp->flags = 0;
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ad1848_isa.c,v 1.20 2001/11/13 08:01:09 lukem Exp $ */
/* $NetBSD: ad1848_isa.c,v 1.21 2002/03/06 07:12:04 itohy Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ad1848_isa.c,v 1.20 2001/11/13 08:01:09 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: ad1848_isa.c,v 1.21 2002/03/06 07:12:04 itohy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -583,7 +583,13 @@ ad1848_isa_trigger_input(addr, start, end, blksize, intr, arg, param)
isc->sc_parg = arg;
}
blksize = (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
/*
* Calculate number of transfers.
* Note that ADPCM is always transferred 4 bytes at at a time.
*/
blksize = (param->encoding == AUDIO_ENCODING_ADPCM) ? blksize / 4 - 1 :
(blksize * 8) / (param->precision * param->factor * param->channels) - 1;
if (sc->mode >= 2) {
ad_write(sc, CS_LOWER_REC_CNT, blksize & 0xff);
@ -620,7 +626,12 @@ ad1848_isa_trigger_output(addr, start, end, blksize, intr, arg, param)
isc->sc_pintr = intr;
isc->sc_parg = arg;
blksize = (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
/*
* Calculate number of transfers.
* Note that ADPCM is always transferred 4 bytes at at a time.
*/
blksize = (param->encoding == AUDIO_ENCODING_ADPCM) ? blksize / 4 - 1 :
(blksize * 8) / (param->precision * param->factor * param->channels) - 1;
ad_write(sc, SP_LOWER_BASE_COUNT, blksize & 0xff);
ad_write(sc, SP_UPPER_BASE_COUNT, blksize >> 8);