summaryrefslogtreecommitdiff
path: root/sys/dev/pci/azalia.c
diff options
context:
space:
mode:
authorDeanna Phillips <deanna@cvs.openbsd.org>2007-09-10 05:39:08 +0000
committerDeanna Phillips <deanna@cvs.openbsd.org>2007-09-10 05:39:08 +0000
commit339fe31e05634267bf4e6a17393efb68a2bd899a (patch)
tree1cd394a501a9c0b7b4f4e39b30a89ff71cf36a23 /sys/dev/pci/azalia.c
parentcb4a359a3eab9e8e2ebc8d15c64bee23427cfc70 (diff)
If 44.1kHz sample rate isn't supported, use 48kHz instead.
Diffstat (limited to 'sys/dev/pci/azalia.c')
-rw-r--r--sys/dev/pci/azalia.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 779847ab653..fbdf3d683dc 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.31 2007/09/10 05:30:14 deanna Exp $ */
+/* $OpenBSD: azalia.c,v 1.32 2007/09/10 05:39:07 deanna Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -1268,6 +1268,15 @@ azalia_codec_construct_format(codec_t *this, int newdac, int newadc)
}
rvariation = group->nconv * nbits;
+ if (bits_rates & COP_PCM_R441)
+ this->rate = 44100;
+ else if (bits_rates & COP_PCM_R480)
+ this->rate = 48000;
+ else {
+ printf("%s: %s/%d invalid PCM format: 0x%8.8x\n",
+ XNAME(this->az), __FILE__, __LINE__, bits_rates);
+ return -1;
+ }
if (this->formats != NULL)
free(this->formats, M_DEVBUF);
this->nformats = 0;
@@ -2010,7 +2019,7 @@ azalia_set_params(void *v, int smode, int umode, audio_params_t *p,
r->encoding = AUDIO_ENCODING_SLINEAR_LE;
r->precision = 16;
r->channels = 2;
- r->sample_rate = 44100;
+ r->sample_rate = codec->rate;
}
for (i = 0; i < codec->nformats; i++) {
if (r->encoding != codec->formats[i].encoding)
@@ -2043,7 +2052,7 @@ azalia_set_params(void *v, int smode, int umode, audio_params_t *p,
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
p->precision = 16;
p->channels = 2;
- p->sample_rate = 44100;
+ p->sample_rate = codec->rate;
}
for (i = 0; i < codec->nformats; i++) {
if (p->encoding != codec->formats[i].encoding)