aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/channel.c
diff options
context:
space:
mode:
authorCameron Grant <cg@FreeBSD.org>2002-01-23 05:10:56 +0000
committerCameron Grant <cg@FreeBSD.org>2002-01-23 05:10:56 +0000
commit79e6a82b48335c6c357a8a2ce2a301487299683a (patch)
treef21778dd0d0ab7022262f33cab4f42bea09c5e9d /sys/dev/sound/pcm/channel.c
parentf6126456ef8ae3aadf9f39cccb9a64f7b7a1536e (diff)
downloadsrc-79e6a82b48335c6c357a8a2ce2a301487299683a.tar.gz
src-79e6a82b48335c6c357a8a2ce2a301487299683a.zip
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.
Notes
Notes: svn path=/head/; revision=89686
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r--sys/dev/sound/pcm/channel.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 4fc5f0705c97..0c73dd093410 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;
}