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>
This commit is contained in:
Cameron Grant 2000-11-18 03:43:04 +00:00
parent 0469c254fb
commit 612276f48c

View File

@ -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);
}