summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-11-18 03:43:04 +0000
committercg <cg@FreeBSD.org>2000-11-18 03:43:04 +0000
commitb7783e49d5e4dd65a2eceaae364cec0dd63ac333 (patch)
treeb4d29acf8e88fbd630df3e806afb2a1c2122196f
parent463fa1112a519653d3fc6a04afc90a7e8790fdce (diff)
downloadFreeBSD-src-b7783e49d5e4dd65a2eceaae364cec0dd63ac333.zip
FreeBSD-src-b7783e49d5e4dd65a2eceaae364cec0dd63ac333.tar.gz
do not blindly assume 8khz is supported on open(). try for 8khz but respect
minspeed/maxspeed specified by the hw driver. Submitted by: Andrew Gordon <arg@arg1.demon.co.uk>
-rw-r--r--sys/dev/sound/pcm/channel.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 98208ca..4e37da4 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -1124,7 +1124,7 @@ fmtvalid(u_int32_t fmt, u_int32_t *fmtlist)
int
chn_reset(pcm_channel *c, u_int32_t fmt)
{
- int r = 0;
+ int hwspd, r = 0;
chn_abort(c);
c->flags &= CHN_F_RESET;
@@ -1134,10 +1134,13 @@ chn_reset(pcm_channel *c, u_int32_t fmt)
if (r)
return r;
if (fmt) {
- c->speed = DSP_DEFAULT_SPEED;
+ hwspd = DSP_DEFAULT_SPEED;
+ RANGE(hwspd, chn_getcaps(c)->minspeed, chn_getcaps(c)->maxspeed);
+ c->speed = hwspd;
+
r = chn_setformat(c, fmt);
if (r == 0)
- r = chn_setspeed(c, DSP_DEFAULT_SPEED);
+ r = chn_setspeed(c, hwspd);
if (r == 0)
r = chn_setvolume(c, 100, 100);
}
OpenPOWER on IntegriCloud