-/* $OpenBSD: autri.c,v 1.38 2015/06/10 20:02:42 ratchov Exp $ */
+/* $OpenBSD: autri.c,v 1.39 2015/06/10 20:14:02 ratchov Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
fp->flags = 0;
break;
case 1:
- strlcpy(fp->name, AudioEslinear, sizeof fp->name);
- fp->encoding = AUDIO_ENCODING_SLINEAR;
- fp->precision = 8;
- fp->flags = 0;
- break;
- case 2:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
- case 3:
- strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
- fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
- fp->precision = 16;
- fp->flags = 0;
- break;
default:
return (EINVAL);
}
mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) {
if ((setmode & mode) == 0)
continue;
-
p = mode == AUMODE_PLAY ? play : rec;
- if (p->sample_rate < 4000)
- p->sample_rate = 4000;
- if (p->sample_rate > 48000)
- p->sample_rate = 48000;
- if (p->precision > 16)
+ p->sample_rate = 48000;
+ if (p->precision != 8)
p->precision = 16;
- if (p->channels > 2)
+ if (p->channels != 1)
p->channels = 2;
- switch (p->encoding) {
- case AUDIO_ENCODING_SLINEAR_BE:
- case AUDIO_ENCODING_ULINEAR_BE:
- if (p->precision != 16)
- return EINVAL;
- break;
- case AUDIO_ENCODING_SLINEAR_LE:
- case AUDIO_ENCODING_ULINEAR_LE:
- break;
- default:
- return (EINVAL);
- }
+ p->encoding = p->precision == 16 ?
+ AUDIO_ENCODING_SLINEAR_LE : AUDIO_ENCODING_ULINEAR_LE;
p->bps = AUDIO_BPS(p->precision);
p->msb = 1;
}