@ -1,4 +1,4 @@
/* $OpenBSD: sndio.h,v 1.9 2015/12/20 11:29:29 ratchov Exp $ */
/* $OpenBSD: sndio.h,v 1.10 2020/02/26 13:53:58 ratchov Exp $ */
/*
* Copyright ( c ) 2008 Alexandre Ratchov < alex @ caoua . org >
*
@ -25,11 +25,17 @@
# define SIO_DEVANY "default"
# define MIO_PORTANY "default"
/*
* limits
*/
# define SIOCTL_NAMEMAX 12 /* max name length */
/*
* private ` ` handle ' ' structure
*/
struct sio_hdl ;
struct mio_hdl ;
struct sioctl_hdl ;
/*
* parameters of a full - duplex stream
@ -84,6 +90,33 @@ struct sio_cap {
# define SIO_XSTRINGS { "ignore", "sync", "error" }
/*
* controlled component of the device
*/
struct sioctl_node {
char name [ SIOCTL_NAMEMAX ] ; /* ex. "spkr" */
int unit ; /* optional number or -1 */
} ;
/*
* description of a control ( index , value ) pair
*/
struct sioctl_desc {
unsigned int addr ; /* control address */
# define SIOCTL_NONE 0 /* deleted */
# define SIOCTL_NUM 2 /* integer in the 0..127 range */
# define SIOCTL_SW 3 /* on/off switch (0 or 1) */
# define SIOCTL_VEC 4 /* number, element of vector */
# define SIOCTL_LIST 5 /* switch, element of a list */
unsigned int type ; /* one of above */
char func [ SIOCTL_NAMEMAX ] ; /* function name, ex. "level" */
char group [ SIOCTL_NAMEMAX ] ; /* group this control belongs to */
struct sioctl_node node0 ; /* affected node */
struct sioctl_node node1 ; /* dito for SIOCTL_{VEC,LIST} */
unsigned int maxval ; /* max value for SIOCTL_{NUM,VEC} */
int __pad [ 3 ] ;
} ;
/*
* mode bitmap
*/
@ -91,6 +124,8 @@ struct sio_cap {
# define SIO_REC 2
# define MIO_OUT 4
# define MIO_IN 8
# define SIOCTL_READ 0x100
# define SIOCTL_WRITE 0x200
/*
* default bytes per sample for the given bits per sample
@ -144,10 +179,24 @@ int mio_pollfd(struct mio_hdl *, struct pollfd *, int);
int mio_revents ( struct mio_hdl * , struct pollfd * ) ;
int mio_eof ( struct mio_hdl * ) ;
struct sioctl_hdl * sioctl_open ( const char * , unsigned int , int ) ;
void sioctl_close ( struct sioctl_hdl * ) ;
int sioctl_ondesc ( struct sioctl_hdl * ,
void ( * ) ( void * , struct sioctl_desc * , int ) , void * ) ;
int sioctl_onval ( struct sioctl_hdl * ,
void ( * ) ( void * , unsigned int , unsigned int ) , void * ) ;
int sioctl_setval ( struct sioctl_hdl * , unsigned int , unsigned int ) ;
int sioctl_nfds ( struct sioctl_hdl * ) ;
int sioctl_pollfd ( struct sioctl_hdl * , struct pollfd * , int ) ;
int sioctl_revents ( struct sioctl_hdl * , struct pollfd * ) ;
int sioctl_eof ( struct sioctl_hdl * ) ;
int mio_rmidi_getfd ( const char * , unsigned int , int ) ;
struct mio_hdl * mio_rmidi_fdopen ( int , unsigned int , int ) ;
int sio_sun_getfd ( const char * , unsigned int , int ) ;
struct sio_hdl * sio_sun_fdopen ( int , unsigned int , int ) ;
int sioctl_sun_getfd ( const char * , unsigned int , int ) ;
struct sioctl_hdl * sioctl_sun_fdopen ( int , unsigned int , int ) ;
# ifdef __cplusplus
}