Lines Matching refs:mixer

127 void mixer_close(struct mixer *mixer)  in mixer_close()  argument
131 if (mixer->fd >= 0) in mixer_close()
132 close(mixer->fd); in mixer_close()
134 if (mixer->ctl) { in mixer_close()
135 for (n = 0; n < mixer->count; n++) { in mixer_close()
136 if (mixer->ctl[n].ename) { in mixer_close()
137 unsigned max = mixer->ctl[n].info->value.enumerated.items; in mixer_close()
139 free(mixer->ctl[n].ename[m]); in mixer_close()
140 free(mixer->ctl[n].ename); in mixer_close()
143 free(mixer->ctl); in mixer_close()
146 if (mixer->info) in mixer_close()
147 free(mixer->info); in mixer_close()
149 free(mixer); in mixer_close()
152 struct mixer *mixer_open(const char *device) in mixer_open()
157 struct mixer *mixer = NULL; in mixer_open() local
173 mixer = calloc(1, sizeof(*mixer)); in mixer_open()
174 if (!mixer) in mixer_open()
177 mixer->ctl = calloc(elist.count, sizeof(struct mixer_ctl)); in mixer_open()
178 mixer->info = calloc(elist.count, sizeof(struct snd_ctl_elem_info)); in mixer_open()
179 if (!mixer->ctl || !mixer->info) in mixer_open()
186 mixer->count = elist.count; in mixer_open()
187 mixer->fd = fd; in mixer_open()
188 elist.space = mixer->count; in mixer_open()
193 for (n = 0; n < mixer->count; n++) { in mixer_open()
194 struct snd_ctl_elem_info *ei = mixer->info + n; in mixer_open()
198 mixer->ctl[n].info = ei; in mixer_open()
199 mixer->ctl[n].mixer = mixer; in mixer_open()
204 mixer->ctl[n].ename = enames; in mixer_open()
219 return mixer; in mixer_open()
224 if (mixer) in mixer_open()
225 mixer_close(mixer); in mixer_open()
231 void mixer_dump(struct mixer *mixer) in mixer_dump() argument
236 for (n = 0; n < mixer->count; n++) { in mixer_dump()
238 struct snd_ctl_elem_info *ei = mixer->info + n; in mixer_dump()
273 ALOGV(" { %s=0", mixer->ctl[n].ename[0]); in mixer_dump()
275 ALOGV(", %s=%d", mixer->ctl[n].ename[m],m); in mixer_dump()
284 struct mixer_ctl *mixer_get_control(struct mixer *mixer, in mixer_get_control() argument
288 for (n = 0; n < mixer->count; n++) { in mixer_get_control()
289 if (mixer->info[n].id.index == index) { in mixer_get_control()
290 if (!strncmp(name, (char*) mixer->info[n].id.name, in mixer_get_control()
291 sizeof(mixer->info[n].id.name))) { in mixer_get_control()
292 return mixer->ctl + n; in mixer_get_control()
299 struct mixer_ctl *mixer_get_nth_control(struct mixer *mixer, unsigned n) in mixer_get_nth_control() argument
301 if (n < mixer->count) in mixer_get_nth_control()
302 return mixer->ctl + n; in mixer_get_nth_control()
329 if (ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_TLV_READ, xtlv) < 0) { in mixer_ctl_read_tlv()
416 if (ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_READ, &ev)) in mixer_ctl_get()
519 return ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, &ev); in mixer_ctl_mulvalues()
603 return ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, &ev); in mixer_ctl_set()
684 return ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, &ev); in set_volume_simple()
744 if (ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, &ev) < 0) in mixer_ctl_select()