In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been

renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics.  A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
This commit is contained in:
augustss 1997-07-15 07:46:04 +00:00
parent ec40091111
commit 8727da130b
9 changed files with 81 additions and 68 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aucc.c,v 1.10 1997/07/10 22:18:42 is Exp $ */
/* $NetBSD: aucc.c,v 1.11 1997/07/15 07:46:04 augustss Exp $ */
#undef AUDIO_DEBUG
/*
* Copyright (c) 1997 Stephan Thesing
@ -385,7 +385,7 @@ aucc_query_encoding(addr, fp)
switch (fp->index) {
case 0:
strcpy(fp->name, AudioElinear);
fp->encoding = AUDIO_ENCODING_LINEAR;
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = 0;
break;
@ -430,9 +430,9 @@ aucc_set_params(addr, mode, p, q)
switch (p->encoding) {
case AUDIO_ENCODING_ULAW:
case AUDIO_ENCODING_LINEAR:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR:
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_ULINEAR_BE:
case AUDIO_ENCODING_ULINEAR_LE:
break;
@ -977,9 +977,9 @@ aucc_encode(enc, channels, i, p, dmap)
case AUDIO_ENCODING_ULINEAR_LE:
off=-128;
break;
case AUDIO_ENCODING_LINEAR:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR:
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
break;
default:
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.7 1997/05/09 22:16:27 augustss Exp $ */
/* $NetBSD: lmcaudio.c,v 1.8 1997/07/15 07:46:07 augustss Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -362,7 +362,7 @@ lmcaudio_set_params(addr, mode, p, q)
int mode;
struct audio_params *p, *q;
{
if (p->encoding != AUDIO_ENCODING_LINEAR_LE ||
if (p->encoding != AUDIO_ENCODING_SLINEAR_LE ||
p->precision != 16 ||
p->channels != 2)
return EINVAL;
@ -383,7 +383,7 @@ lmcaudio_query_encoding(addr, fp)
switch (fp->index) {
case 0:
strcpy (fp->name, AudioElinear_le);
fp->encoding = AUDIO_ENCODING_LINEAR_LE;
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lmcaudio.c,v 1.7 1997/05/09 22:16:27 augustss Exp $ */
/* $NetBSD: lmcaudio.c,v 1.8 1997/07/15 07:46:07 augustss Exp $ */
/*
* Copyright (c) 1996, Danny C Tsen.
@ -362,7 +362,7 @@ lmcaudio_set_params(addr, mode, p, q)
int mode;
struct audio_params *p, *q;
{
if (p->encoding != AUDIO_ENCODING_LINEAR_LE ||
if (p->encoding != AUDIO_ENCODING_SLINEAR_LE ||
p->precision != 16 ||
p->channels != 2)
return EINVAL;
@ -383,7 +383,7 @@ lmcaudio_query_encoding(addr, fp)
switch (fp->index) {
case 0:
strcpy (fp->name, AudioElinear_le);
fp->encoding = AUDIO_ENCODING_LINEAR_LE;
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ossaudio.c,v 1.11 1997/05/19 23:05:14 augustss Exp $ */
/* $NetBSD: ossaudio.c,v 1.12 1997/07/15 07:46:09 augustss Exp $ */
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
@ -130,19 +130,19 @@ oss_ioctl_audio(p, uap, retval)
tmpinfo.play.precision =
tmpinfo.record.precision = 8;
tmpinfo.play.encoding =
tmpinfo.record.encoding = AUDIO_ENCODING_LINEAR;
tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR;
break;
case OSS_AFMT_S16_LE:
tmpinfo.play.precision =
tmpinfo.record.precision = 16;
tmpinfo.play.encoding =
tmpinfo.record.encoding = AUDIO_ENCODING_LINEAR_LE;
tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_LE;
break;
case OSS_AFMT_S16_BE:
tmpinfo.play.precision =
tmpinfo.record.precision = 16;
tmpinfo.play.encoding =
tmpinfo.record.encoding = AUDIO_ENCODING_LINEAR_BE;
tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_BE;
break;
case OSS_AFMT_U16_LE:
tmpinfo.play.precision =
@ -172,13 +172,13 @@ oss_ioctl_audio(p, uap, retval)
case AUDIO_ENCODING_ALAW:
idat = OSS_AFMT_A_LAW;
break;
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
if (tmpinfo.play.precision == 16)
idat = OSS_AFMT_S16_LE;
else
idat = OSS_AFMT_S8;
break;
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
if (tmpinfo.play.precision == 16)
idat = OSS_AFMT_S16_BE;
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.50 1997/05/27 23:24:56 augustss Exp $ */
/* $NetBSD: audio.c,v 1.51 1997/07/15 07:46:11 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -875,8 +875,8 @@ audio_fill_silence(params, p, n)
auzero[0] = 0x55;
break;
case AUDIO_ENCODING_ADPCM: /* is this right XXX */
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_SLINEAR_BE:
auzero[0] = 0; /* fortunately this works for both 8 and 16 bits */
break;
case AUDIO_ENCODING_ULINEAR_LE:
@ -1503,11 +1503,25 @@ int
audio_check_params(p)
struct audio_params *p;
{
if (p->encoding == AUDIO_ENCODING_LINEAR)
#if defined(COMPAT_12)
if (p->encoding == AUDIO_ENCODING_PCM16) {
if (p->precision == 8)
p->encoding = AUDIO_ENCODING_ULINEAR;
else
p->encoding = AUDIO_ENCODING_SLINEAR;
} else if (p->encoding == AUDIO_ENCODING_PCM8) {
if (p->precision == 8)
p->encoding = AUDIO_ENCODING_ULINEAR;
else
return EINVAL;
}
#endif
if (p->encoding == AUDIO_ENCODING_SLINEAR)
#if BYTE_ORDER == LITTLE_ENDIAN
p->encoding = AUDIO_ENCODING_LINEAR_LE;
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
#else
p->encoding = AUDIO_ENCODING_LINEAR_BE;
p->encoding = AUDIO_ENCODING_SLINEAR_BE;
#endif
if (p->encoding == AUDIO_ENCODING_ULINEAR)
#if BYTE_ORDER == LITTLE_ENDIAN
@ -1523,8 +1537,8 @@ audio_check_params(p)
if (p->precision != 8)
return (EINVAL);
break;
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_ULINEAR_LE:
case AUDIO_ENCODING_ULINEAR_BE:
if (p->precision != 8 && p->precision != 16)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ad1848.c,v 1.31 1997/06/06 23:43:45 thorpej Exp $ */
/* $NetBSD: ad1848.c,v 1.32 1997/07/15 07:46:14 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@ -953,7 +953,7 @@ ad1848_query_encoding(addr, fp)
break;
case 2:
strcpy(fp->name, AudioElinear_le);
fp->encoding = AUDIO_ENCODING_LINEAR_LE;
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
@ -966,7 +966,7 @@ ad1848_query_encoding(addr, fp)
case 4: /* only on CS4231 */
strcpy(fp->name, AudioElinear_be);
fp->encoding = AUDIO_ENCODING_LINEAR_BE;
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = sc->mode == 1;
break;
@ -974,7 +974,7 @@ ad1848_query_encoding(addr, fp)
/* emulate some modes */
case 5:
strcpy(fp->name, AudioElinear);
fp->encoding = AUDIO_ENCODING_LINEAR;
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = 1;
break;
@ -1016,27 +1016,27 @@ ad1848_set_params(addr, mode, p, q)
enc = p->encoding;
swcode = 0;
switch (enc) {
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
if (p->precision == 8) {
enc = AUDIO_ENCODING_ULINEAR_LE;
swcode = change_sign8;
}
break;
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
if (p->precision == 16 && sc->mode == 1) {
enc = AUDIO_ENCODING_LINEAR_LE;
enc = AUDIO_ENCODING_SLINEAR_LE;
swcode = swap_bytes;
}
break;
case AUDIO_ENCODING_ULINEAR_LE:
if (p->precision == 16) {
enc = AUDIO_ENCODING_LINEAR_LE;
enc = AUDIO_ENCODING_SLINEAR_LE;
swcode = change_sign16;
}
break;
case AUDIO_ENCODING_ULINEAR_BE:
if (p->precision == 16) {
enc = AUDIO_ENCODING_LINEAR_LE;
enc = AUDIO_ENCODING_SLINEAR_LE;
swcode = mode == AUMODE_PLAY ?
swap_bytes_change_sign16 : change_sign16_swap_bytes;
}
@ -1052,13 +1052,13 @@ ad1848_set_params(addr, mode, p, q)
case AUDIO_ENCODING_ADPCM:
bits = FMT_ADPCM >> 5;
break;
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
if (p->precision == 16)
bits = FMT_TWOS_COMP >> 5;
else
return EINVAL;
break;
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
if (p->precision == 16)
bits = FMT_TWOS_COMP_BE >> 5;
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: gus.c,v 1.31 1997/07/09 03:03:21 jtk Exp $ */
/* $NetBSD: gus.c,v 1.32 1997/07/15 07:46:16 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -911,7 +911,7 @@ gusattach(parent, self, aux)
*/
sc->sc_irate = sc->sc_orate = 44100;
sc->sc_encoding = AUDIO_ENCODING_LINEAR_LE;
sc->sc_encoding = AUDIO_ENCODING_SLINEAR_LE;
sc->sc_precision = 16;
sc->sc_voc[GUS_VOICE_LEFT].voccntl |= GUSMASK_DATA_SIZE16;
sc->sc_voc[GUS_VOICE_RIGHT].voccntl |= GUSMASK_DATA_SIZE16;
@ -1378,8 +1378,8 @@ gus_dmaout_dointr(sc)
if (sc->sc_dmabuf == sc->sc_nbufs - 1) {
register int i;
switch (sc->sc_encoding) {
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_SLINEAR_BE:
if (sc->sc_precision == 8)
goto byte;
/* we have the native format */
@ -2106,9 +2106,9 @@ gus_set_params(addr, mode, p, q)
switch (p->encoding) {
case AUDIO_ENCODING_ULAW:
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_ULINEAR_LE:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_ULINEAR_BE:
break;
default:
@ -2144,7 +2144,7 @@ gus_set_params(addr, mode, p, q)
mulaw_to_ulinear8 : ulinear8_to_mulaw;
break;
case AUDIO_ENCODING_ULINEAR_BE:
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
p->sw_code = swap_bytes;
break;
default:
@ -4193,13 +4193,13 @@ gus_query_encoding(addr, fp)
break;
case 1:
strcpy(fp->name, AudioElinear);
fp->encoding = AUDIO_ENCODING_LINEAR;
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = 0;
break;
case 2:
strcpy(fp->name, AudioElinear_le);
fp->encoding = AUDIO_ENCODING_LINEAR_LE;
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
@ -4217,7 +4217,7 @@ gus_query_encoding(addr, fp)
break;
case 5:
strcpy(fp->name, AudioElinear_be);
fp->encoding = AUDIO_ENCODING_LINEAR_BE;
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdsp.c,v 1.58 1997/06/13 19:21:59 augustss Exp $ */
/* $NetBSD: sbdsp.c,v 1.59 1997/07/15 07:46:19 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -444,7 +444,7 @@ sbdsp_query_encoding(addr, fp)
return 0;
case 3:
strcpy(fp->name, AudioElinear);
fp->encoding = AUDIO_ENCODING_LINEAR;
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = emul;
return 0;
@ -455,7 +455,7 @@ sbdsp_query_encoding(addr, fp)
switch(fp->index) {
case 4:
strcpy(fp->name, AudioElinear_le);
fp->encoding = AUDIO_ENCODING_LINEAR_LE;
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
return 0;
@ -467,7 +467,7 @@ sbdsp_query_encoding(addr, fp)
return 0;
case 6:
strcpy(fp->name, AudioElinear_be);
fp->encoding = AUDIO_ENCODING_LINEAR_BE;
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
return 0;
@ -509,11 +509,11 @@ sbdsp_set_params(addr, mode, p, q)
swcode = 0;
if (m->model == SB_16) {
switch (p->encoding) {
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
if (p->precision == 16)
swcode = swap_bytes;
/* fall into */
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
bmode = 0x10;
break;
case AUDIO_ENCODING_ULINEAR_BE:
@ -540,12 +540,12 @@ sbdsp_set_params(addr, mode, p, q)
bmode |= 0x20;
} else if (m->model == SB_JAZZ && m->precision == 16) {
switch (p->encoding) {
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_LE:
break;
case AUDIO_ENCODING_ULINEAR_LE:
swcode = change_sign16;
break;
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_SLINEAR_BE:
swcode = swap_bytes;
break;
case AUDIO_ENCODING_ULINEAR_BE:
@ -567,8 +567,8 @@ sbdsp_set_params(addr, mode, p, q)
p->sample_rate = SB_TC_TO_RATE(tc) / p->channels;
} else {
switch (p->encoding) {
case AUDIO_ENCODING_LINEAR_BE:
case AUDIO_ENCODING_LINEAR_LE:
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_SLINEAR_LE:
swcode = change_sign8;
break;
case AUDIO_ENCODING_ULINEAR_BE:

View File

@ -1,4 +1,4 @@
/* $NetBSD: audioio.h,v 1.10 1997/05/24 23:23:17 augustss Exp $ */
/* $NetBSD: audioio.h,v 1.11 1997/07/15 07:46:22 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -106,17 +106,16 @@ typedef struct audio_device {
#define AUDIO_ENCODING_NONE 0 /* no encoding assigned */
#define AUDIO_ENCODING_ULAW 1
#define AUDIO_ENCODING_ALAW 2
#define AUDIO_ENCODING_LINEAR 3
#define AUDIO_ENCODING_ULINEAR 4
#define AUDIO_ENCODING_PCM16 3 /* obsolete */
#define AUDIO_ENCODING_LINEAR AUDIO_ENCODING_PCM16 /* obsolete */
#define AUDIO_ENCODING_PCM8 4 /* obsolete */
#define AUDIO_ENCODING_ADPCM 5
#define AUDIO_ENCODING_LINEAR_LE 6
#define AUDIO_ENCODING_LINEAR_BE 7
#define AUDIO_ENCODING_SLINEAR_LE 6
#define AUDIO_ENCODING_SLINEAR_BE 7
#define AUDIO_ENCODING_ULINEAR_LE 8
#define AUDIO_ENCODING_ULINEAR_BE 9
/* Backwards compatibility defines */
#define AUDIO_ENCODING_PCM16 AUDIO_ENCODING_LINEAR
#define AUDIO_ENCODING_PCM8 AUDIO_ENCODING_ULINEAR
#define AUDIO_ENCODING_SLINEAR 10
#define AUDIO_ENCODING_ULINEAR 11
typedef struct audio_encoding {
int index;