#ifndef SNDIO_H
#define SNDIO_H
#include <sys/types.h>
#define SIO_DEVANY "default"
#define MIO_PORTANY "default"
#define SIOCTL_NAMEMAX 16
#define SIOCTL_DISPLAYMAX 32
struct sio_hdl;
struct mio_hdl;
struct sioctl_hdl;
struct sio_par {
unsigned int bits;
unsigned int bps;
unsigned int sig;
unsigned int le;
unsigned int msb;
unsigned int rchan;
unsigned int pchan;
unsigned int rate;
unsigned int bufsz;
#define SIO_IGNORE 0
#define SIO_SYNC 1
#define SIO_ERROR 2
unsigned int xrun;
unsigned int round;
unsigned int appbufsz;
int __pad[3];
unsigned int __magic;
};
struct sio_cap {
#define SIO_NENC 8
#define SIO_NCHAN 8
#define SIO_NRATE 16
#define SIO_NCONF 4
struct sio_enc {
unsigned int bits;
unsigned int bps;
unsigned int sig;
unsigned int le;
unsigned int msb;
} enc[SIO_NENC];
unsigned int rchan[SIO_NCHAN];
unsigned int pchan[SIO_NCHAN];
unsigned int rate[SIO_NRATE];
int __pad[7];
unsigned int nconf;
struct sio_conf {
unsigned int enc;
unsigned int rchan;
unsigned int pchan;
unsigned int rate;
} confs[SIO_NCONF];
};
#define SIO_XSTRINGS { "ignore", "sync", "error" }
struct sioctl_node {
char name[SIOCTL_NAMEMAX];
int unit;
};
struct sioctl_desc {
unsigned int addr;
#define SIOCTL_NONE 0
#define SIOCTL_NUM 2
#define SIOCTL_SW 3
#define SIOCTL_VEC 4
#define SIOCTL_LIST 5
#define SIOCTL_SEL 6
unsigned int type;
unsigned int maxval;
int __pad[3];
char func[SIOCTL_NAMEMAX];
char group[SIOCTL_NAMEMAX];
struct sioctl_node node0;
struct sioctl_node node1;
char display[SIOCTL_DISPLAYMAX];
};
#define SIO_PLAY 1
#define SIO_REC 2
#define MIO_OUT 4
#define MIO_IN 8
#define SIOCTL_READ 0x100
#define SIOCTL_WRITE 0x200
#define SIO_BPS(bits) (((bits) <= 8) ? 1 : (((bits) <= 16) ? 2 : 4))
#if BYTE_ORDER == LITTLE_ENDIAN
#define SIO_LE_NATIVE 1
#else
#define SIO_LE_NATIVE 0
#endif
#define SIO_MAXVOL 127
#ifdef __cplusplus
extern "C" {
#endif
struct pollfd;
void sio_initpar(struct sio_par *);
struct sio_hdl *sio_open(const char *, unsigned int, int);
void sio_close(struct sio_hdl *);
int sio_setpar(struct sio_hdl *, struct sio_par *);
int sio_getpar(struct sio_hdl *, struct sio_par *);
int sio_getcap(struct sio_hdl *, struct sio_cap *);
void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *);
void sio_onxrun(struct sio_hdl *, void (*)(void *), void *);
size_t sio_write(struct sio_hdl *, const void *, size_t);
size_t sio_read(struct sio_hdl *, void *, size_t);
int sio_start(struct sio_hdl *);
int sio_stop(struct sio_hdl *);
int sio_flush(struct sio_hdl *);
int sio_nfds(struct sio_hdl *);
int sio_pollfd(struct sio_hdl *, struct pollfd *, int);
int sio_revents(struct sio_hdl *, struct pollfd *);
int sio_eof(struct sio_hdl *);
int sio_setvol(struct sio_hdl *, unsigned int);
int sio_onvol(struct sio_hdl *, void (*)(void *, unsigned int), void *);
struct mio_hdl *mio_open(const char *, unsigned int, int);
void mio_close(struct mio_hdl *);
size_t mio_write(struct mio_hdl *, const void *, size_t);
size_t mio_read(struct mio_hdl *, void *, size_t);
int mio_nfds(struct mio_hdl *);
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
}
#endif
#endif