mixer.h revision 193640
1147883Sscottl/*-
2147883Sscottl * Copyright (c) 2005-2009 Ariff Abdullah <ariff@FreeBSD.org>
3147883Sscottl * Copyright (c) 1999 Cameron Grant <cg@FreeBSD.org>
4147883Sscottl * All rights reserved.
5147883Sscottl *
6147883Sscottl * Redistribution and use in source and binary forms, with or without
7147883Sscottl * modification, are permitted provided that the following conditions
8147883Sscottl * are met:
9147883Sscottl * 1. Redistributions of source code must retain the above copyright
10147883Sscottl *    notice, this list of conditions and the following disclaimer.
11147883Sscottl * 2. Redistributions in binary form must reproduce the above copyright
12147883Sscottl *    notice, this list of conditions and the following disclaimer in the
13147883Sscottl *    documentation and/or other materials provided with the distribution.
14147883Sscottl *
15147883Sscottl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16147883Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17147883Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18147883Sscottl * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19147883Sscottl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20147883Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21147883Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22147883Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23147883Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24147883Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25147883Sscottl * SUCH DAMAGE.
26147883Sscottl *
27156000Smjacob * $FreeBSD: head/sys/dev/sound/pcm/mixer.h 193640 2009-06-07 19:12:08Z ariff $
28156000Smjacob */
29156000Smjacob
30156000Smjacobstruct snd_mixer *mixer_create(device_t dev, kobj_class_t cls, void *devinfo,
31156000Smjacob    const char *desc);
32156000Smjacobint mixer_delete(struct snd_mixer *m);
33156000Smjacobint mixer_init(device_t dev, kobj_class_t cls, void *devinfo);
34156000Smjacobint mixer_uninit(device_t dev);
35156000Smjacobint mixer_reinit(device_t dev);
36156000Smjacobint mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td, int from);
37156000Smjacobint mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi);
38156000Smjacob
39156000Smjacobint mixer_hwvol_init(device_t dev);
40156000Smjacobvoid mixer_hwvol_mute(device_t dev);
41156000Smjacobvoid mixer_hwvol_step(device_t dev, int left_step, int right_step);
42156000Smjacob
43156000Smjacobint mixer_busy(struct snd_mixer *m);
44156000Smjacob
45156000Smjacobint mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right);
46156000Smjacobint mix_get(struct snd_mixer *m, u_int dev);
47156000Smjacobint mix_setrecsrc(struct snd_mixer *m, u_int32_t src);
48156000Smjacobu_int32_t mix_getrecsrc(struct snd_mixer *m);
49156000Smjacobint mix_get_type(struct snd_mixer *m);
50156000Smjacob
51156000Smjacobvoid mix_setdevs(struct snd_mixer *m, u_int32_t v);
52156000Smjacobvoid mix_setrecdevs(struct snd_mixer *m, u_int32_t v);
53156000Smjacobu_int32_t mix_getdevs(struct snd_mixer *m);
54156000Smjacobu_int32_t mix_getrecdevs(struct snd_mixer *m);
55156000Smjacobvoid mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs);
56156000Smjacobvoid mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev);
57147883Sscottlu_int32_t mix_getparent(struct snd_mixer *m, u_int32_t dev);
58156000Smjacobu_int32_t mix_getchild(struct snd_mixer *m, u_int32_t dev);
59156000Smjacobvoid *mix_getdevinfo(struct snd_mixer *m);
60159052Smjacobstruct mtx *mixer_get_lock(struct snd_mixer *m);
61159052Smjacob
62159052Smjacobextern int mixer_count;
63147883Sscottl
64147883Sscottl#define MIXER_CMD_DIRECT	0	/* send command within driver   */
65147883Sscottl#define MIXER_CMD_CDEV		1	/* send command from cdev/ioctl */
66147883Sscottl
67147883Sscottl#define MIXER_TYPE_PRIMARY	0	/* mixer_init()   */
68147883Sscottl#define MIXER_TYPE_SECONDARY	1	/* mixer_create() */
69147883Sscottl
70147883Sscottl/*
71147883Sscottl * this is a kludge to allow hiding of the struct snd_mixer definition
72147883Sscottl * 512 should be enough for all architectures
73147883Sscottl */
74147883Sscottl#define MIXER_SIZE	(512 + sizeof(struct kobj) +		\
75147883Sscottl			    sizeof(oss_mixer_enuminfo))
76147883Sscottl
77147883Sscottl#ifdef SND_DEBUG
78147883Sscottl#define MIXER_DECLARE(mixer)						\
79147883Sscottl	static struct kobj_class mixer##_class = {			\
80148679Sgibbs		.name        = #mixer,					\
81148679Sgibbs		.methods     = mixer##_methods,				\
82148679Sgibbs		.size        = MIXER_SIZE,				\
83147883Sscottl		.baseclasses = NULL,					\
84147883Sscottl		.refs        = 0					\
85147883Sscottl	}
86147883Sscottl#else
87147883Sscottl#define MIXER_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, MIXER_SIZE)
88147883Sscottl#endif
89147883Sscottl