Home | History | Annotate | Line # | Download | only in audiocfg
      1  1.9     isaki /* $NetBSD: audiodev.h,v 1.9 2019/08/24 07:39:42 isaki Exp $ */
      2  1.1       mrg 
      3  1.1       mrg /*
      4  1.1       mrg  * Copyright (c) 2010 Jared D. McNeill <jmcneill (at) invisible.ca>
      5  1.1       mrg  * All rights reserved.
      6  1.1       mrg  *
      7  1.1       mrg  * Redistribution and use in source and binary forms, with or without
      8  1.1       mrg  * modification, are permitted provided that the following conditions
      9  1.1       mrg  * are met:
     10  1.1       mrg  * 1. Redistributions of source code must retain the above copyright
     11  1.1       mrg  *    notice, this list of conditions and the following disclaimer.
     12  1.1       mrg  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1       mrg  *    notice, this list of conditions and the following disclaimer in the
     14  1.1       mrg  *    documentation and/or other materials provided with the distribution.
     15  1.1       mrg  *
     16  1.1       mrg  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  1.1       mrg  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  1.1       mrg  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  1.1       mrg  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  1.1       mrg  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  1.1       mrg  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  1.1       mrg  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  1.1       mrg  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  1.1       mrg  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  1.1       mrg  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1       mrg  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1       mrg  */
     28  1.1       mrg 
     29  1.1       mrg #ifndef _HAVE_AUDIODEV_H
     30  1.1       mrg #define _HAVE_AUDIODEV_H
     31  1.1       mrg 
     32  1.1       mrg #include <sys/audioio.h>
     33  1.1       mrg #include <sys/queue.h>
     34  1.1       mrg #include <sys/syslimits.h>
     35  1.1       mrg 
     36  1.1       mrg #include <stdbool.h>
     37  1.1       mrg 
     38  1.5     isaki struct audiofmt {
     39  1.5     isaki 	struct audio_format fmt;
     40  1.5     isaki 	TAILQ_ENTRY(audiofmt) next;
     41  1.5     isaki };
     42  1.5     isaki 
     43  1.1       mrg struct audiodev {
     44  1.3  jmcneill 	char pxname[16];	/* hw (parent) device */
     45  1.3  jmcneill 	char xname[16];		/* audio(4) device */
     46  1.1       mrg 	uint16_t unit;
     47  1.1       mrg 	char path[PATH_MAX+1];
     48  1.5     isaki 	char ctlpath[PATH_MAX+1];
     49  1.7     isaki 	int fd;
     50  1.6     isaki 	int ctlfd;
     51  1.1       mrg 
     52  1.1       mrg 	dev_t dev;
     53  1.1       mrg 	bool defaultdev;
     54  1.1       mrg 
     55  1.1       mrg 	audio_device_t audio_device;
     56  1.5     isaki 	TAILQ_HEAD(, audiofmt) formats;
     57  1.6     isaki 	audio_info_t hwinfo;
     58  1.1       mrg 
     59  1.1       mrg 	TAILQ_ENTRY(audiodev) next;
     60  1.1       mrg };
     61  1.1       mrg 
     62  1.1       mrg int			audiodev_refresh(void);
     63  1.9     isaki unsigned int		audiodev_count(void);
     64  1.1       mrg struct audiodev *	audiodev_get(unsigned int);
     65  1.1       mrg int			audiodev_set_default(struct audiodev *);
     66  1.5     isaki int			audiodev_set_param(struct audiodev *, int,
     67  1.5     isaki 				const char *, unsigned int, unsigned int,
     68  1.5     isaki 				unsigned int);
     69  1.7     isaki int			audiodev_test(struct audiodev *);
     70  1.1       mrg 
     71  1.5     isaki extern const char *	encoding_names[];
     72  1.5     isaki extern u_int		encoding_max;
     73  1.5     isaki 
     74  1.1       mrg #endif /* !_HAVE_AUDIODEV_H */
     75