diff options
author | cg <cg@FreeBSD.org> | 2000-11-18 03:43:04 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-11-18 03:43:04 +0000 |
commit | b7783e49d5e4dd65a2eceaae364cec0dd63ac333 (patch) | |
tree | b4d29acf8e88fbd630df3e806afb2a1c2122196f /sys/dev/sound/pcm/channel.c | |
parent | 463fa1112a519653d3fc6a04afc90a7e8790fdce (diff) | |
download | FreeBSD-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>
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 9 |
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); } |