diff options
author | cg <cg@FreeBSD.org> | 2002-01-23 05:10:56 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2002-01-23 05:10:56 +0000 |
commit | 3b2958fa78f7a813524c7610f56e82b698c8b2a1 (patch) | |
tree | f21778dd0d0ab7022262f33cab4f42bea09c5e9d /sys/dev/sound/pcm/channel.c | |
parent | 29512efb54d698fea8add4100063a66dceb1633d (diff) | |
download | FreeBSD-src-3b2958fa78f7a813524c7610f56e82b698c8b2a1.zip FreeBSD-src-3b2958fa78f7a813524c7610f56e82b698c8b2a1.tar.gz |
make the feederchain builder work for recording. this has not been tested
extensively as none of my testboxes have speakers or an audio source at
present, but the chains built look correct and reading /dev/audio (ulaw,
translated from signed 16 bit little-endian) gives values within the
expected range for silence.
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 4fc5f07..0c73dd0 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -997,7 +997,7 @@ chn_buildfeeder(struct pcm_channel *c) { struct feeder_class *fc; struct pcm_feederdesc desc; - u_int32_t tmp[2], type, flags; + u_int32_t tmp[2], type, flags, hwfmt; CHN_LOCKASSERT(c); while (chn_removefeeder(c) == 0); @@ -1072,14 +1072,22 @@ chn_buildfeeder(struct pcm_channel *c) } } - if (!fmtvalid(c->feeder->desc->out, chn_getcaps(c)->fmtlist)) { - if (chn_fmtchain(c, chn_getcaps(c)->fmtlist) == 0) { - DEB(printf("can't build fmtchain from %x\n", c->feeder->desc->out)); - return EINVAL; + if (fmtvalid(c->feeder->desc->out, chn_getcaps(c)->fmtlist)) { + hwfmt = c->feeder->desc->out; + } else { + if (c->direction == PCMDIR_REC) { + tmp[0] = c->format; + tmp[1] = NULL; + hwfmt = chn_fmtchain(c, tmp); + } else { + hwfmt = chn_fmtchain(c, chn_getcaps(c)->fmtlist); } - DEB(printf("built fmtchain from %x\n", c->feeder->desc->out)); } + if (hwfmt == 0) + return EINVAL; + + sndbuf_setfmt(c->bufhard, hwfmt); return 0; } |