xref: /netbsd-src/usr.bin/audiocfg/audiodev.h (revision 3dbad28612dad296816d69bdfc98c25dbc330574)
1*3dbad286Sisaki /* $NetBSD: audiodev.h,v 1.9 2019/08/24 07:39:42 isaki Exp $ */
2172ca3ccSmrg 
3172ca3ccSmrg /*
4172ca3ccSmrg  * Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
5172ca3ccSmrg  * All rights reserved.
6172ca3ccSmrg  *
7172ca3ccSmrg  * Redistribution and use in source and binary forms, with or without
8172ca3ccSmrg  * modification, are permitted provided that the following conditions
9172ca3ccSmrg  * are met:
10172ca3ccSmrg  * 1. Redistributions of source code must retain the above copyright
11172ca3ccSmrg  *    notice, this list of conditions and the following disclaimer.
12172ca3ccSmrg  * 2. Redistributions in binary form must reproduce the above copyright
13172ca3ccSmrg  *    notice, this list of conditions and the following disclaimer in the
14172ca3ccSmrg  *    documentation and/or other materials provided with the distribution.
15172ca3ccSmrg  *
16172ca3ccSmrg  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17172ca3ccSmrg  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18172ca3ccSmrg  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19172ca3ccSmrg  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20172ca3ccSmrg  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21172ca3ccSmrg  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22172ca3ccSmrg  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23172ca3ccSmrg  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24172ca3ccSmrg  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25172ca3ccSmrg  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26172ca3ccSmrg  * POSSIBILITY OF SUCH DAMAGE.
27172ca3ccSmrg  */
28172ca3ccSmrg 
29172ca3ccSmrg #ifndef _HAVE_AUDIODEV_H
30172ca3ccSmrg #define _HAVE_AUDIODEV_H
31172ca3ccSmrg 
32172ca3ccSmrg #include <sys/audioio.h>
33172ca3ccSmrg #include <sys/queue.h>
34172ca3ccSmrg #include <sys/syslimits.h>
35172ca3ccSmrg 
36172ca3ccSmrg #include <stdbool.h>
37172ca3ccSmrg 
380b88ff99Sisaki struct audiofmt {
390b88ff99Sisaki 	struct audio_format fmt;
400b88ff99Sisaki 	TAILQ_ENTRY(audiofmt) next;
410b88ff99Sisaki };
420b88ff99Sisaki 
43172ca3ccSmrg struct audiodev {
44e90b0e00Sjmcneill 	char pxname[16];	/* hw (parent) device */
45e90b0e00Sjmcneill 	char xname[16];		/* audio(4) device */
46172ca3ccSmrg 	uint16_t unit;
47172ca3ccSmrg 	char path[PATH_MAX+1];
480b88ff99Sisaki 	char ctlpath[PATH_MAX+1];
49ab49aa4fSisaki 	int fd;
50923f5af2Sisaki 	int ctlfd;
51172ca3ccSmrg 
52172ca3ccSmrg 	dev_t dev;
53172ca3ccSmrg 	bool defaultdev;
54172ca3ccSmrg 
55172ca3ccSmrg 	audio_device_t audio_device;
560b88ff99Sisaki 	TAILQ_HEAD(, audiofmt) formats;
57923f5af2Sisaki 	audio_info_t hwinfo;
58172ca3ccSmrg 
59172ca3ccSmrg 	TAILQ_ENTRY(audiodev) next;
60172ca3ccSmrg };
61172ca3ccSmrg 
62172ca3ccSmrg int			audiodev_refresh(void);
63*3dbad286Sisaki unsigned int		audiodev_count(void);
64172ca3ccSmrg struct audiodev *	audiodev_get(unsigned int);
65172ca3ccSmrg int			audiodev_set_default(struct audiodev *);
660b88ff99Sisaki int			audiodev_set_param(struct audiodev *, int,
670b88ff99Sisaki 				const char *, unsigned int, unsigned int,
680b88ff99Sisaki 				unsigned int);
69ab49aa4fSisaki int			audiodev_test(struct audiodev *);
70172ca3ccSmrg 
710b88ff99Sisaki extern const char *	encoding_names[];
720b88ff99Sisaki extern u_int		encoding_max;
730b88ff99Sisaki 
74172ca3ccSmrg #endif /* !_HAVE_AUDIODEV_H */
75