diff options
author | cg <cg@FreeBSD.org> | 2001-02-13 21:57:34 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2001-02-13 21:57:34 +0000 |
commit | c467270698f0b233e00b4b1da04b5598b2f69116 (patch) | |
tree | 5bab38fbea14b507b40b3635c8add1cf51a312d1 /sys | |
parent | de242acc558ce995c0f2289d9985780714f8860b (diff) | |
download | FreeBSD-src-c467270698f0b233e00b4b1da04b5598b2f69116.zip FreeBSD-src-c467270698f0b233e00b4b1da04b5598b2f69116.tar.gz |
make attempts to set unsupported speeds or formats non-sticky. this should
fix problems with apps that probe for a variety of settings.
Submitted by: Orion Hodson <O.Hodson@cs.ucl.ac.uk>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 9c6c97b..412e17f 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1106,8 +1106,8 @@ chn_setvolume(pcm_channel *c, int left, int right) return 0; } -int -chn_setspeed(pcm_channel *c, int speed) +static int +chn_tryspeed(pcm_channel *c, int speed) { pcm_feeder *f; snd_dbuf *b = &c->buffer; @@ -1171,7 +1171,20 @@ chn_setspeed(pcm_channel *c, int speed) } int -chn_setformat(pcm_channel *c, u_int32_t fmt) +chn_setspeed(pcm_channel *c, int speed) +{ + int r, oldspeed = c->speed; + + r = chn_tryspeed(c, speed); + if (r) { + DEB(printf("Failed to set speed %d falling back to %d\n", speed, oldspeed)); + chn_tryspeed(c, oldspeed); + } + return r; +} + +static int +chn_tryformat(pcm_channel *c, u_int32_t fmt) { snd_dbuf *b = &c->buffer; snd_dbuf *bs = &c->buffer2nd; @@ -1201,6 +1214,20 @@ chn_setformat(pcm_channel *c, u_int32_t fmt) } int +chn_setformat(pcm_channel *c, u_int32_t fmt) +{ + u_int32_t oldfmt = c->format; + int r; + + r = chn_tryformat(c, fmt); + if (r) { + DEB(printf("Format change %d failed, reverting to %d\n", fmt, oldfmt)); + chn_tryformat(c, oldfmt); + } + return r; +} + +int chn_setblocksize(pcm_channel *c, int blkcnt, int blksz) { snd_dbuf *b = &c->buffer; |