Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/sound/pcm/channel.c
| Show First 20 Lines • Show All 1,138 Lines • ▼ Show 20 Lines | chn_mkname(char *buf, size_t len, struct pcm_channel *c) | ||||
| return (buf); | return (buf); | ||||
| } | } | ||||
| struct pcm_channel * | struct pcm_channel * | ||||
| chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, | chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, | ||||
| int dir, void *devinfo) | int dir, void *devinfo) | ||||
| { | { | ||||
| struct pcm_channel *c; | struct pcm_channel *c; | ||||
| struct feeder_class *fc; | |||||
| struct snd_dbuf *b, *bs; | struct snd_dbuf *b, *bs; | ||||
| char buf[CHN_NAMELEN]; | char buf[CHN_NAMELEN]; | ||||
| int err, i, direction, *vchanrate, *vchanformat; | int err, i, direction, *vchanrate, *vchanformat; | ||||
| PCM_BUSYASSERT(d); | PCM_BUSYASSERT(d); | ||||
| PCM_LOCKASSERT(d); | PCM_LOCKASSERT(d); | ||||
| switch (dir) { | switch (dir) { | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | for (i = 0; i < SND_CHN_T_MAX; i++) | ||||
| c->volume[SND_VOL_C_MASTER][i] = SND_VOL_0DB_MASTER; | c->volume[SND_VOL_C_MASTER][i] = SND_VOL_0DB_MASTER; | ||||
| c->volume[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB] = SND_VOL_0DB_MASTER; | c->volume[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB] = SND_VOL_0DB_MASTER; | ||||
| c->volume[SND_VOL_C_PCM][SND_CHN_T_VOL_0DB] = chn_vol_0db_pcm; | c->volume[SND_VOL_C_PCM][SND_CHN_T_VOL_0DB] = chn_vol_0db_pcm; | ||||
| CHN_LOCK(c); | CHN_LOCK(c); | ||||
| chn_vpc_reset(c, SND_VOL_C_PCM, 1); | chn_vpc_reset(c, SND_VOL_C_PCM, 1); | ||||
| CHN_UNLOCK(c); | CHN_UNLOCK(c); | ||||
| fc = feeder_getclass(FEEDER_ROOT); | |||||
| if (fc == NULL) { | |||||
| device_printf(d->dev, "%s(): failed to get feeder class\n", | |||||
| __func__); | |||||
| goto fail; | |||||
| } | |||||
| if (feeder_add(c, fc, NULL)) { | |||||
| device_printf(d->dev, "%s(): failed to add feeder\n", __func__); | |||||
| goto fail; | |||||
| } | |||||
| b = sndbuf_create(c, "primary"); | b = sndbuf_create(c, "primary"); | ||||
| bs = sndbuf_create(c, "secondary"); | bs = sndbuf_create(c, "secondary"); | ||||
| if (b == NULL || bs == NULL) { | if (b == NULL || bs == NULL) { | ||||
| device_printf(d->dev, "%s(): failed to create %s buffer\n", | device_printf(d->dev, "%s(): failed to create %s buffer\n", | ||||
| __func__, b == NULL ? "hardware" : "software"); | __func__, b == NULL ? "hardware" : "software"); | ||||
| goto fail; | goto fail; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,397 Lines • Show Last 20 Lines | |||||