s/unsigned/unsigned int/g, requested by deraadt

This commit is contained in:
Alexandre Ratchov 2012-04-11 09:21:29 +02:00
parent ab990cf3ef
commit 1247c187a7
40 changed files with 478 additions and 459 deletions

View File

@ -77,10 +77,10 @@ abuf_dump(struct abuf *buf)
#endif
struct abuf *
abuf_new(unsigned nfr, struct aparams *par)
abuf_new(unsigned int nfr, struct aparams *par)
{
struct abuf *buf;
unsigned len, bpf;
unsigned int len, bpf;
bpf = aparams_bpf(par);
len = nfr * bpf;
@ -164,9 +164,9 @@ abuf_clear(struct abuf *buf)
* Get a pointer to the readable block at the given offset.
*/
unsigned char *
abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
abuf_rgetblk(struct abuf *buf, unsigned int *rsize, unsigned int ofs)
{
unsigned count, start, used;
unsigned int count, start, used;
start = buf->start + ofs;
used = buf->used - ofs;
@ -192,7 +192,7 @@ abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
* Discard the block at the start postion.
*/
void
abuf_rdiscard(struct abuf *buf, unsigned count)
abuf_rdiscard(struct abuf *buf, unsigned int count)
{
#ifdef DEBUG
if (count > buf->used) {
@ -219,7 +219,7 @@ abuf_rdiscard(struct abuf *buf, unsigned count)
* Commit the data written at the end postion.
*/
void
abuf_wcommit(struct abuf *buf, unsigned count)
abuf_wcommit(struct abuf *buf, unsigned int count)
{
#ifdef DEBUG
if (count > (buf->len - buf->used)) {
@ -243,9 +243,9 @@ abuf_wcommit(struct abuf *buf, unsigned count)
* Get a pointer to the writable block at offset ofs.
*/
unsigned char *
abuf_wgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
abuf_wgetblk(struct abuf *buf, unsigned int *rsize, unsigned int ofs)
{
unsigned end, avail, count;
unsigned int end, avail, count;
end = buf->start + buf->used + ofs;

View File

@ -29,35 +29,35 @@ struct abuf {
/*
* fifo parameters
*/
unsigned bpf; /* bytes per frame */
unsigned cmin, cmax; /* channel range of this buf */
unsigned start; /* offset where data starts */
unsigned used; /* valid data */
unsigned len; /* size of the ring */
struct aproc *rproc; /* reader */
struct aproc *wproc; /* writer */
struct abuf *duplex; /* link to buffer of the other direction */
unsigned inuse; /* in abuf_{flush,fill,run}() */
unsigned tickets; /* max data to (if throttling) */
unsigned int bpf; /* bytes per frame */
unsigned int cmin, cmax; /* channel range of this buf */
unsigned int start; /* offset where data starts */
unsigned int used; /* valid data */
unsigned int len; /* size of the ring */
struct aproc *rproc; /* reader */
struct aproc *wproc; /* writer */
struct abuf *duplex; /* link to buffer of the other dir */
unsigned int inuse; /* in abuf_{flush,fill,run}() */
unsigned int tickets; /* max data to (if throttling) */
/*
* Misc reader aproc-specific per-buffer parameters.
*/
union {
struct {
int weight; /* dynamic range */
int maxweight; /* max dynamic range allowed */
unsigned vol; /* volume within the dynamic range */
unsigned done; /* frames ready */
unsigned xrun; /* underrun policy */
int drop; /* frames to drop on next read */
int weight; /* dynamic range */
int maxweight; /* max dynamic range allowed */
unsigned int vol; /* volume within the vol */
unsigned int done; /* frames ready */
unsigned int xrun; /* underrun policy */
int drop; /* to drop on next read */
} mix;
struct {
unsigned st; /* MIDI running status */
unsigned used; /* bytes used from ``msg'' */
unsigned idx; /* actual MIDI message size */
unsigned len; /* MIDI message length */
#define MIDI_MSGMAX 16 /* max size of MIDI messaage */
unsigned int st; /* MIDI running status */
unsigned int used; /* bytes used from ``msg'' */
unsigned int idx; /* actual MIDI message size */
unsigned int len; /* MIDI message length */
#define MIDI_MSGMAX 16 /* max size of MIDI msg */
unsigned char msg[MIDI_MSGMAX];
} midi;
} r;
@ -67,12 +67,12 @@ struct abuf {
*/
union {
struct {
unsigned todo; /* frames to process */
unsigned int todo; /* frames to process */
} mix;
struct {
unsigned done; /* frames copied */
unsigned xrun; /* overrun policy, one of XRUN_XXX */
int silence; /* silence to add on next write */
unsigned int done; /* frames copied */
unsigned int xrun; /* one of XRUN_XXX */
int silence; /* to add on next write */
} sub;
struct {
struct abuf *owner; /* current input stream */
@ -103,14 +103,14 @@ struct abuf {
*/
#define ABUF_HUP(b) (!ABUF_WOK(b) && (b)->rproc == NULL)
struct abuf *abuf_new(unsigned, struct aparams *);
struct abuf *abuf_new(unsigned int, struct aparams *);
void abuf_del(struct abuf *);
void abuf_dbg(struct abuf *);
void abuf_clear(struct abuf *);
unsigned char *abuf_rgetblk(struct abuf *, unsigned *, unsigned);
unsigned char *abuf_wgetblk(struct abuf *, unsigned *, unsigned);
void abuf_rdiscard(struct abuf *, unsigned);
void abuf_wcommit(struct abuf *, unsigned);
unsigned char *abuf_rgetblk(struct abuf *, unsigned int *, unsigned int);
unsigned char *abuf_wgetblk(struct abuf *, unsigned int *, unsigned int);
void abuf_rdiscard(struct abuf *, unsigned int);
void abuf_wcommit(struct abuf *, unsigned int);
int abuf_fill(struct abuf *);
int abuf_flush(struct abuf *);
void abuf_eof(struct abuf *);

View File

@ -174,7 +174,8 @@ done:
* by the machine.
*/
void
aparams_init(struct aparams *par, unsigned cmin, unsigned cmax, unsigned rate)
aparams_init(struct aparams *par, unsigned int cmin, unsigned int cmax,
unsigned int rate)
{
par->bps = sizeof(adata_t);
par->bits = ADATA_BITS;
@ -252,7 +253,7 @@ aparams_eqrate(struct aparams *p1, struct aparams *p2)
/*
* Return the number of bytes per frame with the given parameters.
*/
unsigned
unsigned int
aparams_bpf(struct aparams *par)
{
return (par->cmax - par->cmin + 1) * par->bps;

View File

@ -40,13 +40,13 @@
* Encoding specification.
*/
struct aparams {
unsigned bps; /* bytes per sample */
unsigned bits; /* actually used bits */
unsigned le; /* 1 if little endian, 0 if big endian */
unsigned sig; /* 1 if signed, 0 if unsigned */
unsigned msb; /* 1 if msb justified, 0 if lsb justified */
unsigned cmin, cmax; /* provided/consumed channels */
unsigned rate; /* frames per second */
unsigned int bps; /* bytes per sample */
unsigned int bits; /* actually used bits */
unsigned int le; /* 1 if little endian, 0 if big endian */
unsigned int sig; /* 1 if signed, 0 if unsigned */
unsigned int msb; /* 1 if msb justified, 0 if lsb justified */
unsigned int cmin, cmax; /* provided/consumed channels */
unsigned int rate; /* frames per second */
};
/*
@ -126,14 +126,14 @@ fp24_muldiv(int x, int a, int b)
extern int aparams_ctltovol[128];
extern struct aparams aparams_none;
void aparams_init(struct aparams *, unsigned, unsigned, unsigned);
void aparams_init(struct aparams *, unsigned int, unsigned int, unsigned int);
void aparams_dbg(struct aparams *);
int aparams_eqrate(struct aparams *, struct aparams *);
int aparams_eqenc(struct aparams *, struct aparams *);
int aparams_eq(struct aparams *, struct aparams *);
int aparams_subset(struct aparams *, struct aparams *);
void aparams_grow(struct aparams *, struct aparams *);
unsigned aparams_bpf(struct aparams *);
unsigned int aparams_bpf(struct aparams *);
int aparams_strtoenc(struct aparams *, char *);
int aparams_enctostr(struct aparams *, char *);
void aparams_copyenc(struct aparams *, struct aparams *);

View File

@ -289,12 +289,12 @@ aproc_depend(struct aproc *p, struct aproc *dep)
}
int
rfile_do(struct aproc *p, unsigned todo, unsigned *done)
rfile_do(struct aproc *p, unsigned int todo, unsigned int *done)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
struct file *f = p->u.io.file;
unsigned char *data;
unsigned n, count, off;
unsigned int n, count, off;
off = p->u.io.partial;
data = abuf_wgetblk(obuf, &count, 0);
@ -451,12 +451,12 @@ wfile_done(struct aproc *p)
}
int
wfile_do(struct aproc *p, unsigned todo, unsigned *done)
wfile_do(struct aproc *p, unsigned int todo, unsigned int *done)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
struct file *f = p->u.io.file;
unsigned char *data;
unsigned n, count, off;
unsigned int n, count, off;
off = p->u.io.partial;
data = abuf_rgetblk(ibuf, &count, 0);
@ -547,7 +547,7 @@ wfile_new(struct file *f)
void
mix_drop(struct abuf *buf, int extra)
{
unsigned count;
unsigned int count;
buf->r.mix.drop += extra;
while (buf->r.mix.drop > 0) {
@ -583,10 +583,10 @@ mix_drop(struct abuf *buf, int extra)
* obuf->w.mix.todo doesn't exceed the given value
*/
void
mix_bzero(struct abuf *obuf, unsigned maxtodo)
mix_bzero(struct abuf *obuf, unsigned int maxtodo)
{
adata_t *odata;
unsigned ocount, todo;
unsigned int ocount, todo;
if (obuf->w.mix.todo >= maxtodo)
return;
@ -611,13 +611,13 @@ mix_bzero(struct abuf *obuf, unsigned maxtodo)
/*
* Mix an input block over an output block.
*/
unsigned
unsigned int
mix_badd(struct abuf *ibuf, struct abuf *obuf)
{
adata_t *idata, *odata;
unsigned cmin, cmax;
unsigned i, j, cc, istart, inext, onext, ostart;
unsigned scount, icount, ocount;
unsigned int cmin, cmax;
unsigned int i, j, cc, istart, inext, onext, ostart;
unsigned int scount, icount, ocount;
int vol, s;
#ifdef DEBUG
@ -710,7 +710,7 @@ int
mix_xrun(struct aproc *p, struct abuf *i)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
unsigned fdrop, remain;
unsigned int fdrop, remain;
if (i->r.mix.done > 0)
return 1;
@ -765,9 +765,9 @@ int
mix_in(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->outs);
unsigned odone;
unsigned maxwrite;
unsigned scount;
unsigned int odone;
unsigned int maxwrite;
unsigned int scount;
#ifdef DEBUG
if (debug_level >= 4) {
@ -832,9 +832,9 @@ int
mix_out(struct aproc *p, struct abuf *obuf)
{
struct abuf *i, *inext;
unsigned odone;
unsigned maxwrite;
unsigned scount;
unsigned int odone;
unsigned int maxwrite;
unsigned int scount;
#ifdef DEBUG
if (debug_level >= 4) {
@ -919,7 +919,7 @@ void
mix_eof(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *obuf = LIST_FIRST(&p->outs);
unsigned odone;
unsigned int odone;
mix_setmaster(p);
@ -1021,8 +1021,8 @@ struct aproc_ops mix_ops = {
};
struct aproc *
mix_new(char *name, int maxlat, unsigned round,
unsigned autovol, unsigned master)
mix_new(char *name, int maxlat, unsigned int round,
unsigned int autovol, unsigned int master)
{
struct aproc *p;
@ -1043,7 +1043,7 @@ mix_new(char *name, int maxlat, unsigned round,
void
mix_setmaster(struct aproc *p)
{
unsigned n;
unsigned int n;
struct abuf *i, *j;
int weight;
@ -1113,7 +1113,7 @@ void
sub_silence(struct abuf *buf, int extra)
{
unsigned char *data;
unsigned count;
unsigned int count;
buf->w.sub.silence += extra;
if (buf->w.sub.silence > 0) {
@ -1152,9 +1152,9 @@ void
sub_bcopy(struct abuf *ibuf, struct abuf *obuf)
{
adata_t *idata, *odata;
unsigned cmin, cmax;
unsigned i, j, cc, istart, inext, onext, ostart;
unsigned icount, ocount, scount;
unsigned int cmin, cmax;
unsigned int i, j, cc, istart, inext, onext, ostart;
unsigned int icount, ocount, scount;
/*
* Drop samples for xrun correction
@ -1213,7 +1213,7 @@ int
sub_xrun(struct aproc *p, struct abuf *i)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
unsigned fdrop, remain;
unsigned int fdrop, remain;
if (i->w.sub.done > 0)
return 1;
@ -1269,7 +1269,7 @@ int
sub_in(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *inext;
unsigned idone;
unsigned int idone;
if (!ABUF_ROK(ibuf))
return 0;
@ -1315,7 +1315,7 @@ sub_out(struct aproc *p, struct abuf *obuf)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
struct abuf *i, *inext;
unsigned idone;
unsigned int idone;
if (!SUB_WOK(obuf))
return 0;
@ -1352,7 +1352,7 @@ void
sub_hup(struct aproc *p, struct abuf *obuf)
{
struct abuf *i, *ibuf = LIST_FIRST(&p->ins);
unsigned idone;
unsigned int idone;
if (!aproc_inuse(p)) {
#ifdef DEBUG
@ -1427,7 +1427,7 @@ struct aproc_ops sub_ops = {
};
struct aproc *
sub_new(char *name, int maxlat, unsigned round)
sub_new(char *name, int maxlat, unsigned int round)
{
struct aproc *p;
@ -1451,19 +1451,19 @@ sub_clear(struct aproc *p)
void
resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
unsigned inch;
unsigned int inch;
adata_t *idata;
unsigned oblksz;
unsigned ifr;
unsigned onch;
unsigned int oblksz;
unsigned int ifr;
unsigned int onch;
int s, ds, diff;
adata_t *odata;
unsigned iblksz;
unsigned ofr;
unsigned c;
unsigned int iblksz;
unsigned int ofr;
unsigned int c;
adata_t *ctxbuf, *ctx;
unsigned ctx_start;
unsigned icount, ocount;
unsigned int ctx_start;
unsigned int icount, ocount;
/*
* Calculate max frames readable at once from the input buffer.
@ -1643,10 +1643,10 @@ struct aproc_ops resamp_ops = {
};
struct aproc *
resamp_new(char *name, unsigned iblksz, unsigned oblksz)
resamp_new(char *name, unsigned int iblksz, unsigned int oblksz)
{
struct aproc *p;
unsigned i;
unsigned int i;
p = aproc_new(&resamp_ops, name);
p->u.resamp.iblksz = iblksz;
@ -1676,14 +1676,14 @@ resamp_new(char *name, unsigned iblksz, unsigned oblksz)
void
enc_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
unsigned nch, scount, icount, ocount;
unsigned f;
unsigned int nch, scount, icount, ocount;
unsigned int f;
adata_t *idata;
int s;
unsigned oshift;
unsigned int oshift;
int osigbit;
unsigned obps;
unsigned i;
unsigned int obps;
unsigned int i;
unsigned char *odata;
int obnext;
int osnext;
@ -1834,16 +1834,16 @@ enc_new(char *name, struct aparams *par)
void
dec_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
unsigned nch, scount, icount, ocount;
unsigned f;
unsigned ibps;
unsigned i;
unsigned int nch, scount, icount, ocount;
unsigned int f;
unsigned int ibps;
unsigned int i;
int s = 0xdeadbeef;
unsigned char *idata;
int ibnext;
int isnext;
int isigbit;
unsigned ishift;
unsigned int ishift;
adata_t *odata;
/*
@ -1992,13 +1992,13 @@ dec_new(char *name, struct aparams *par)
void
join_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
unsigned h, hops;
unsigned inch, inext;
unsigned int h, hops;
unsigned int inch, inext;
adata_t *idata;
unsigned onch, onext;
unsigned int onch, onext;
adata_t *odata;
int scale;
unsigned c, f, scount, icount, ocount;
unsigned int c, f, scount, icount, ocount;
/*
* Calculate max frames readable at once from the input buffer.
@ -2136,7 +2136,7 @@ void
mon_flush(struct aproc *p)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
unsigned count;
unsigned int count;
#ifdef DEBUG
if (debug_level >= 4) {
@ -2165,10 +2165,11 @@ mon_flush(struct aproc *p)
* Copy one block.
*/
void
mon_snoop(struct aproc *p, struct abuf *ibuf, unsigned pos, unsigned todo)
mon_snoop(struct aproc *p, struct abuf *ibuf,
unsigned int pos, unsigned int todo)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
unsigned scount, icount, ocount;
unsigned int scount, icount, ocount;
adata_t *idata, *odata;
#ifdef DEBUG
@ -2277,7 +2278,7 @@ struct aproc_ops mon_ops = {
};
struct aproc *
mon_new(char *name, unsigned bufsz)
mon_new(char *name, unsigned int bufsz)
{
struct aproc *p;

View File

@ -122,50 +122,50 @@ struct aproc {
struct aproc_ops *ops; /* call-backs */
LIST_HEAD(, abuf) ins; /* list of inputs */
LIST_HEAD(, abuf) outs; /* list of outputs */
unsigned refs; /* extern references */
unsigned int refs; /* extern references */
#define APROC_ZOMB 1 /* destroyed but not freed */
#define APROC_QUIT 2 /* try to terminate if unused */
#define APROC_DROP 4 /* xrun if capable */
unsigned flags;
unsigned int flags;
union { /* follow type-specific data */
struct { /* file/device io */
struct file *file; /* file to read/write */
unsigned partial; /* bytes of partial frame */
unsigned int partial; /* bytes of partial frame */
} io;
struct {
unsigned idle; /* frames since idleing */
unsigned round; /* block size, for xruns */
unsigned int idle; /* frames since idleing */
unsigned int round; /* block size, for xruns */
int lat; /* current latency */
int maxlat; /* max latency allowed */
unsigned abspos; /* frames produced */
unsigned int abspos; /* frames produced */
struct aproc *mon; /* snoop output */
unsigned autovol; /* adjust volume dynamically */
unsigned int autovol; /* adjust volume dynamically */
int master; /* master attenuation */
} mix;
struct {
unsigned idle; /* frames since idleing */
unsigned round; /* block size, for xruns */
unsigned int idle; /* frames since idleing */
unsigned int round; /* block size, for xruns */
int lat; /* current latency */
int maxlat; /* max latency allowed */
unsigned abspos; /* frames consumed */
unsigned int abspos; /* frames consumed */
} sub;
struct {
int delta; /* time position */
unsigned bufsz; /* buffer size (latency) */
unsigned pending; /* uncommited samples */
unsigned int bufsz; /* buffer size (latency) */
unsigned int pending; /* uncommited samples */
} mon;
struct {
#define RESAMP_NCTX 2
unsigned ctx_start;
unsigned int ctx_start;
adata_t ctx[NCHAN_MAX * RESAMP_NCTX];
unsigned iblksz, oblksz;
unsigned int iblksz, oblksz;
int diff;
int idelta, odelta; /* remainder of resamp_xpos */
} resamp;
struct {
int bfirst; /* bytes to skip at startup */
unsigned bps; /* bytes per sample */
unsigned shift; /* shift to get 32bit MSB */
unsigned int bps; /* bytes per sample */
unsigned int shift; /* shift to get 32bit MSB */
int sigbit; /* sign bits to XOR */
int bnext; /* to reach the next byte */
int snext; /* to reach the next sample */
@ -173,16 +173,16 @@ struct aproc {
struct {
struct dev *dev; /* controlled device */
struct timo timo; /* timout for throtteling */
unsigned fps; /* MTC frames per second */
unsigned int fps; /* MTC frames per second */
#define MTC_FPS_24 0
#define MTC_FPS_25 1
#define MTC_FPS_30 3
unsigned fps_id; /* one of above */
unsigned hr; /* MTC hours */
unsigned min; /* MTC minutes */
unsigned sec; /* MTC seconds */
unsigned fr; /* MTC frames */
unsigned qfr; /* MTC quarter frames */
unsigned int fps_id; /* one of above */
unsigned int hr; /* MTC hours */
unsigned int min; /* MTC minutes */
unsigned int sec; /* MTC seconds */
unsigned int fr; /* MTC frames */
unsigned int qfr; /* MTC quarter frames */
int delta; /* rel. to the last MTC tick */
} midi;
} u;
@ -212,27 +212,27 @@ void aproc_opos(struct aproc *, struct abuf *, int);
struct aproc *rfile_new(struct file *);
struct aproc *wfile_new(struct file *);
struct aproc *mix_new(char *, int, unsigned, unsigned, unsigned);
struct aproc *sub_new(char *, int, unsigned);
struct aproc *resamp_new(char *, unsigned, unsigned);
struct aproc *mix_new(char *, int, unsigned int, unsigned int, unsigned int);
struct aproc *sub_new(char *, int, unsigned int);
struct aproc *resamp_new(char *, unsigned int, unsigned int);
struct aproc *enc_new(char *, struct aparams *);
struct aproc *dec_new(char *, struct aparams *);
struct aproc *join_new(char *);
struct aproc *mon_new(char *, unsigned);
struct aproc *mon_new(char *, unsigned int);
int rfile_in(struct aproc *, struct abuf *);
int rfile_out(struct aproc *, struct abuf *);
void rfile_eof(struct aproc *, struct abuf *);
void rfile_hup(struct aproc *, struct abuf *);
void rfile_done(struct aproc *);
int rfile_do(struct aproc *, unsigned, unsigned *);
int rfile_do(struct aproc *, unsigned int, unsigned int *);
int wfile_in(struct aproc *, struct abuf *);
int wfile_out(struct aproc *, struct abuf *);
void wfile_eof(struct aproc *, struct abuf *);
void wfile_hup(struct aproc *, struct abuf *);
void wfile_done(struct aproc *);
int wfile_do(struct aproc *, unsigned, unsigned *);
int wfile_do(struct aproc *, unsigned int, unsigned int *);
void mix_setmaster(struct aproc *);
void mix_clear(struct aproc *);
@ -241,7 +241,7 @@ void mix_quit(struct aproc *);
void mix_drop(struct abuf *, int);
void sub_silence(struct abuf *, int);
void sub_clear(struct aproc *);
void mon_snoop(struct aproc *, struct abuf *, unsigned, unsigned);
void mon_snoop(struct aproc *, struct abuf *, unsigned int, unsigned int);
void mon_clear(struct aproc *);
#endif /* !defined(APROC_H) */

View File

@ -215,10 +215,10 @@ opt_xrun(void)
errx(1, "%s: bad underrun/overrun policy", optarg);
}
unsigned
unsigned int
opt_mode(void)
{
unsigned mode = 0;
unsigned int mode = 0;
char *p = optarg;
size_t len;
@ -390,8 +390,8 @@ main(int argc, char **argv)
char *prog, *optstr, *usagestr;
int c, background, unit, active;
char base[PATH_MAX], path[PATH_MAX];
unsigned mode, hdr, xrun, rate, join, mmc, vol;
unsigned hold, autovol, bufsz, round;
unsigned int mode, hdr, xrun, rate, join, mmc, vol;
unsigned int hold, autovol, bufsz, round;
const char *str;
struct aparams ppar, rpar;
struct dev *d, *dnext;

View File

@ -39,8 +39,8 @@
} while (0)
char dbg_buf[DBG_BUFSZ]; /* buffer where traces are stored */
unsigned dbg_used = 0; /* bytes used in the buffer */
unsigned dbg_sync = 1; /* if true, flush after each '\n' */
unsigned int dbg_used = 0; /* bytes used in the buffer */
unsigned int dbg_sync = 1; /* if true, flush after each '\n' */
/*
* write debug info buffer on stderr
@ -77,7 +77,7 @@ void
dbg_putx(unsigned long num)
{
char dig[sizeof(num) * 2], *p = dig, c;
unsigned ndig;
unsigned int ndig;
if (num != 0) {
for (ndig = 0; num != 0; ndig++) {
@ -100,7 +100,7 @@ void
dbg_putu(unsigned long num)
{
char dig[sizeof(num) * 3], *p = dig;
unsigned ndig;
unsigned int ndig;
if (num != 0) {
for (ndig = 0; num != 0; ndig++) {

View File

@ -25,7 +25,7 @@ void dbg_puti(long);
void dbg_panic(void);
void dbg_flush(void);
extern unsigned dbg_sync;
extern unsigned int dbg_sync;
#endif /* MIDISH_DBG_H */
#endif /* DEBUG */

View File

@ -89,7 +89,7 @@ void dev_onmove(void *, int);
int devctl_open(struct dev *, struct devctl *);
struct dev *dev_list = NULL;
unsigned dev_sndnum = 0, dev_thrnum = 0;
unsigned int dev_sndnum = 0, dev_thrnum = 0;
#ifdef DEBUG
void
@ -109,11 +109,11 @@ dev_dbg(struct dev *d)
* Create a sndio device
*/
struct dev *
dev_new(char *path, unsigned mode,
unsigned bufsz, unsigned round, unsigned hold, unsigned autovol)
dev_new(char *path, unsigned int mode, unsigned int bufsz, unsigned int round,
unsigned int hold, unsigned int autovol)
{
struct dev *d;
unsigned *pnum, i;
unsigned int *pnum, i;
pnum = (mode & MODE_THRU) ? &dev_thrnum : &dev_sndnum;
if (*pnum == DEV_NMAX) {
@ -164,7 +164,7 @@ dev_new(char *path, unsigned mode,
* adjust device parameters and mode
*/
void
dev_adjpar(struct dev *d, unsigned mode,
dev_adjpar(struct dev *d, unsigned int mode,
struct aparams *ipar, struct aparams *opar)
{
d->reqmode |= (mode | MODE_MIDIMASK);
@ -198,7 +198,7 @@ dev_init(struct dev *d)
* Add a MIDI port to the device
*/
int
devctl_add(struct dev *d, char *path, unsigned mode)
devctl_add(struct dev *d, char *path, unsigned int mode)
{
struct devctl *c;
@ -255,7 +255,7 @@ dev_open(struct dev *d)
struct aparams par;
struct aproc *conv;
struct abuf *buf;
unsigned siomode, cmin, cmax, rate;
unsigned int siomode, cmin, cmax, rate;
d->mode = d->reqmode;
d->round = d->reqround;
@ -666,7 +666,7 @@ dev_close(struct dev *d)
void
dev_drain(struct dev *d)
{
unsigned i;
unsigned int i;
struct ctl_slot *s;
for (i = 0, s = d->slot; i < CTL_NSLOT; i++, s++) {
@ -715,8 +715,8 @@ dev_midiattach(struct dev *d, struct abuf *ibuf, struct abuf *obuf)
}
}
unsigned
dev_roundof(struct dev *d, unsigned newrate)
unsigned int
dev_roundof(struct dev *d, unsigned int newrate)
{
return (d->round * newrate + d->rate / 2) / d->rate;
}
@ -902,7 +902,7 @@ dev_wakeup(struct dev *d)
*/
int
dev_getep(struct dev *d,
unsigned mode, struct abuf **sibuf, struct abuf **sobuf)
unsigned int mode, struct abuf **sibuf, struct abuf **sobuf)
{
struct abuf *ibuf, *obuf;
@ -974,7 +974,8 @@ dev_getep(struct dev *d,
* them underruns/overruns).
*/
void
dev_sync(struct dev *d, unsigned mode, struct abuf *ibuf, struct abuf *obuf)
dev_sync(struct dev *d, unsigned int mode,
struct abuf *ibuf, struct abuf *obuf)
{
int delta, offs;
struct abuf *mbuf = NULL;
@ -1026,7 +1027,7 @@ dev_sync(struct dev *d, unsigned mode, struct abuf *ibuf, struct abuf *obuf)
* return the current latency (in frames), ie the latency that
* a stream would have if dev_attach() is called on it.
*
* XXX: return a "unsigned", since result is always positive, isn't it?
* XXX: return a "unsigned int", since result is always positive, isn't it?
*/
int
dev_getpos(struct dev *d)
@ -1047,14 +1048,14 @@ dev_getpos(struct dev *d)
* and rec.
*/
void
dev_attach(struct dev *d, char *name, unsigned mode,
struct abuf *ibuf, struct aparams *sipar, unsigned inch,
struct abuf *obuf, struct aparams *sopar, unsigned onch,
unsigned xrun, int vol)
dev_attach(struct dev *d, char *name, unsigned int mode,
struct abuf *ibuf, struct aparams *sipar, unsigned int inch,
struct abuf *obuf, struct aparams *sopar, unsigned int onch,
unsigned int xrun, int vol)
{
struct aparams ipar, opar;
struct aproc *conv;
unsigned round, nblk, nch;
unsigned int round, nblk, nch;
#ifdef DEBUG
if ((!APROC_OK(d->mix) && (mode & MODE_PLAY)) ||
@ -1324,8 +1325,8 @@ dev_mkslot(struct dev *d, char *who)
char *s;
struct ctl_slot *slot;
char name[CTL_NAMEMAX];
unsigned i, unit, umap = 0;
unsigned ser, bestser, bestidx;
unsigned int i, unit, umap = 0;
unsigned int ser, bestser, bestidx;
/*
* create a ``valid'' control name (lowcase, remove [^a-z], trucate)
@ -1483,7 +1484,7 @@ dev_slotdel(struct dev *d, int slot)
* can work because all streams have a slot
*/
void
dev_slotvol(struct dev *d, int slot, unsigned vol)
dev_slotvol(struct dev *d, int slot, unsigned int vol)
{
#ifdef DEBUG
if (debug_level >= 3) {
@ -1507,7 +1508,7 @@ dev_slotvol(struct dev *d, int slot, unsigned vol)
int
dev_try(struct dev *d, int slot)
{
unsigned i;
unsigned int i;
struct ctl_slot *s;
if (d->tstate != CTL_START) {
@ -1624,7 +1625,7 @@ dev_mmcstart(struct dev *d)
void
dev_mmcstop(struct dev *d)
{
unsigned i;
unsigned int i;
struct ctl_slot *s;
switch (d->tstate) {
@ -1662,9 +1663,9 @@ dev_mmcstop(struct dev *d)
* relocate all slots simultaneously
*/
void
dev_loc(struct dev *d, unsigned origin)
dev_loc(struct dev *d, unsigned int origin)
{
unsigned i;
unsigned int i;
struct ctl_slot *s;
#ifdef DEBUG
@ -1707,7 +1708,7 @@ dev_onmove(void *arg, int delta)
}
void
dev_master(struct dev *d, unsigned master)
dev_master(struct dev *d, unsigned int master)
{
#ifdef DEBUG
if (debug_level >= 3) {

View File

@ -28,64 +28,64 @@ struct dev {
/*
* desired parameters
*/
unsigned reqmode; /* mode */
unsigned int reqmode; /* mode */
struct aparams reqipar, reqopar; /* parameters */
unsigned reqbufsz; /* buffer size */
unsigned reqround; /* block size */
unsigned hold; /* hold the device open ? */
unsigned autovol; /* auto adjust playvol ? */
unsigned autostart; /* don't wait for MMC start */
unsigned refcnt; /* number of openers */
unsigned int reqbufsz; /* buffer size */
unsigned int reqround; /* block size */
unsigned int hold; /* hold the device open ? */
unsigned int autovol; /* auto adjust playvol ? */
unsigned int autostart; /* don't wait for MMC start */
unsigned int refcnt; /* number of openers */
#define DEV_NMAX 16 /* max number of devices */
unsigned num; /* serial number */
unsigned int num; /* serial number */
#define DEV_CLOSED 0 /* closed */
#define DEV_INIT 1 /* stopped */
#define DEV_START 2 /* ready to start */
#define DEV_RUN 3 /* started */
unsigned pstate; /* on of DEV_xxx */
unsigned int pstate; /* on of DEV_xxx */
char *path; /* sio path */
/*
* actual parameters and runtime state (i.e. once opened)
*/
unsigned mode; /* bitmap of MODE_xxx */
unsigned bufsz, round, rate;
unsigned int mode; /* bitmap of MODE_xxx */
unsigned int bufsz, round, rate;
struct aparams ipar, opar;
struct aproc *mix, *sub, *submon;
struct aproc *rec, *play, *mon;
struct aproc *midi;
struct devctl {
struct devctl *next;
unsigned mode;
unsigned int mode;
char *path;
} *ctl_list;
/* volume control and MMC/MTC */
#define CTL_NSLOT 8
#define CTL_NAMEMAX 8
unsigned serial;
unsigned int serial;
struct ctl_slot {
struct ctl_ops {
void (*vol)(void *, unsigned);
void (*vol)(void *, unsigned int);
void (*start)(void *);
void (*stop)(void *);
void (*loc)(void *, unsigned);
void (*loc)(void *, unsigned int);
void (*quit)(void *);
} *ops;
void *arg;
unsigned unit;
unsigned int unit;
char name[CTL_NAMEMAX];
unsigned serial;
unsigned vol;
unsigned tstate;
unsigned int serial;
unsigned int vol;
unsigned int tstate;
} slot[CTL_NSLOT];
#define CTL_OFF 0 /* ignore MMC messages */
#define CTL_STOP 1 /* stopped, can't start */
#define CTL_START 2 /* attempting to start */
#define CTL_RUN 3 /* started */
unsigned tstate; /* one of above */
unsigned origin; /* MTC start time */
unsigned master; /* master volume controller */
unsigned int tstate; /* one of above */
unsigned int origin; /* MTC start time */
unsigned int master; /* master volume controller */
};
extern struct dev *dev_list;
@ -98,28 +98,30 @@ void dev_unref(struct dev *);
void dev_del(struct dev *);
void dev_wakeup(struct dev *);
void dev_drain(struct dev *);
struct dev *dev_new(char *, unsigned, unsigned, unsigned, unsigned, unsigned);
void dev_adjpar(struct dev *, unsigned, struct aparams *, struct aparams *);
int devctl_add(struct dev *, char *, unsigned);
struct dev *dev_new(char *, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int);
void dev_adjpar(struct dev *, unsigned int,
struct aparams *, struct aparams *);
int devctl_add(struct dev *, char *, unsigned int);
void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
unsigned dev_roundof(struct dev *, unsigned);
unsigned int dev_roundof(struct dev *, unsigned int);
int dev_getpos(struct dev *);
void dev_attach(struct dev *, char *, unsigned,
struct abuf *, struct aparams *, unsigned,
struct abuf *, struct aparams *, unsigned,
unsigned, int);
void dev_attach(struct dev *, char *, unsigned int,
struct abuf *, struct aparams *, unsigned int,
struct abuf *, struct aparams *, unsigned int,
unsigned int, int);
void dev_setvol(struct dev *, struct abuf *, int);
void dev_slotdbg(struct dev *, int);
int dev_slotnew(struct dev *, char *, struct ctl_ops *, void *, int);
void dev_slotdel(struct dev *, int);
void dev_slotvol(struct dev *, int, unsigned);
void dev_slotvol(struct dev *, int, unsigned int);
int dev_slotstart(struct dev *, int);
void dev_slotstop(struct dev *, int);
void dev_mmcstart(struct dev *);
void dev_mmcstop(struct dev *);
void dev_loc(struct dev *, unsigned);
void dev_master(struct dev *, unsigned);
void dev_loc(struct dev *, unsigned int);
void dev_master(struct dev *, unsigned int);
#endif /* !define(DEV_H) */

View File

@ -72,7 +72,7 @@
struct timespec file_ts;
struct filelist file_list;
struct timo *timo_queue;
unsigned timo_abstime;
unsigned int timo_abstime;
int file_slowaccept = 0;
#ifdef DEBUG
long long file_wtime, file_utime;
@ -95,10 +95,10 @@ timo_set(struct timo *o, void (*cb)(void *), void *arg)
* must not be already scheduled
*/
void
timo_add(struct timo *o, unsigned delta)
timo_add(struct timo *o, unsigned int delta)
{
struct timo **i;
unsigned val;
unsigned int val;
int diff;
#ifdef DEBUG
@ -151,7 +151,7 @@ timo_del(struct timo *o)
* calls expired timeouts
*/
void
timo_update(unsigned delta)
timo_update(unsigned int delta)
{
struct timo *to;
int diff;
@ -232,7 +232,7 @@ file_dbg(struct file *f)
#endif
struct file *
file_new(struct fileops *ops, char *name, unsigned nfds)
file_new(struct fileops *ops, char *name, unsigned int nfds)
{
struct file *f;
@ -591,10 +591,10 @@ filelist_done(void)
timo_done();
}
unsigned
file_read(struct file *f, unsigned char *data, unsigned count)
unsigned int
file_read(struct file *f, unsigned char *data, unsigned int count)
{
unsigned n;
unsigned int n;
#ifdef DEBUG
struct timespec ts0, ts1;
long us;
@ -625,10 +625,10 @@ file_read(struct file *f, unsigned char *data, unsigned count)
return n;
}
unsigned
file_write(struct file *f, unsigned char *data, unsigned count)
unsigned int
file_write(struct file *f, unsigned char *data, unsigned int count)
{
unsigned n;
unsigned int n;
#ifdef DEBUG
struct timespec ts0, ts1;
long us;

View File

@ -26,8 +26,8 @@ struct pollfd;
struct timo {
struct timo *next;
unsigned val; /* time to wait before the callback */
unsigned set; /* true if the timeout is set */
unsigned int val; /* time to wait before the callback */
unsigned int set; /* true if the timeout is set */
void (*cb)(void *arg); /* routine to call on expiration */
void *arg; /* argument to give to 'cb' */
};
@ -36,8 +36,8 @@ struct fileops {
char *name;
size_t size;
void (*close)(struct file *);
unsigned (*read)(struct file *, unsigned char *, unsigned);
unsigned (*write)(struct file *, unsigned char *, unsigned);
unsigned int (*read)(struct file *, unsigned char *, unsigned int);
unsigned int (*write)(struct file *, unsigned char *, unsigned int);
void (*start)(struct file *, void (*)(void *, int), void *);
void (*stop)(struct file *);
int (*nfds)(struct file *);
@ -55,10 +55,10 @@ struct file {
#define FILE_ZOMB 0x10 /* closed, but struct not freed */
#define FILE_RINUSE 0x20 /* inside rproc->ops->in() */
#define FILE_WINUSE 0x40 /* inside wproc->ops->out() */
unsigned state; /* one of above */
unsigned int state; /* one of above */
#ifdef DEBUG
#define FILE_MAXCYCLES 20
unsigned cycles; /* number of POLLIN/POLLOUT events */
unsigned int cycles; /* number of POLLIN/POLLOUT events */
#endif
char *name; /* for debug purposes */
struct aproc *rproc, *wproc; /* reader and/or writer */
@ -75,20 +75,20 @@ extern long long file_wtime, file_utime;
#endif
void timo_set(struct timo *, void (*)(void *), void *);
void timo_add(struct timo *, unsigned);
void timo_add(struct timo *, unsigned int);
void timo_del(struct timo *);
void filelist_init(void);
void filelist_done(void);
void filelist_unlisten(void);
struct file *file_new(struct fileops *, char *, unsigned);
struct file *file_new(struct fileops *, char *, unsigned int);
void file_del(struct file *);
void file_dbg(struct file *);
void file_attach(struct file *, struct aproc *, struct aproc *);
unsigned file_read(struct file *, unsigned char *, unsigned);
unsigned file_write(struct file *, unsigned char *, unsigned);
unsigned int file_read(struct file *, unsigned char *, unsigned int);
unsigned int file_write(struct file *, unsigned char *, unsigned int);
int file_poll(void);
void file_eof(struct file *);
void file_hup(struct file *);

View File

@ -77,10 +77,10 @@ char wav_guid[14] = {
};
int
wav_readfmt(int fd, unsigned csize, struct aparams *par, short **map)
wav_readfmt(int fd, unsigned int csize, struct aparams *par, short **map)
{
struct wavfmt fmt;
unsigned nch, cmax, rate, bits, bps, enc;
unsigned int nch, cmax, rate, bits, bps, enc;
if (csize < WAV_FMT_SIZE) {
warnx("%u: bugus format chunk size", csize);
@ -171,7 +171,7 @@ wav_readhdr(int fd, struct aparams *par, off_t *startpos, off_t *datasz, short *
{
struct wavriff riff;
struct wavchunk chunk;
unsigned csize, rsize, pos = 0;
unsigned int csize, rsize, pos = 0;
int fmt_done = 0;
if (lseek(fd, 0, SEEK_SET) < 0) {
@ -235,7 +235,7 @@ wav_readhdr(int fd, struct aparams *par, off_t *startpos, off_t *datasz, short *
int
wav_writehdr(int fd, struct aparams *par, off_t *startpos, off_t datasz)
{
unsigned nch = par->cmax - par->cmin + 1;
unsigned int nch = par->cmax - par->cmin + 1;
struct {
struct wavriff riff;
struct wavchunk fmt_hdr;

View File

@ -97,9 +97,9 @@ listen_new_un(char *path)
}
void
listen_new_tcp(char *addr, unsigned port)
listen_new_tcp(char *addr, unsigned int port)
{
char *host, serv[sizeof(unsigned) * 3 + 1];
char *host, serv[sizeof(unsigned int) * 3 + 1];
struct addrinfo *ailist, *ai, aihints;
struct listen *f;
int s, error, opt = 1, n = 0;

View File

@ -32,7 +32,7 @@ struct listen {
extern struct listen *listen_list;
void listen_new_un(char *);
void listen_new_tcp(char *, unsigned);
void listen_new_tcp(char *, unsigned int);
int listen_init(struct listen *);
int listen_nfds(struct file *);
int listen_pollfd(struct file *, struct pollfd *, int);

View File

@ -69,8 +69,8 @@
/*
* length of voice and common messages (status byte included)
*/
unsigned voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
unsigned common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
/*
* call-back invoked periodically to implement throttling; at each invocation
@ -82,7 +82,7 @@ midi_cb(void *addr)
{
struct aproc *p = (struct aproc *)addr;
struct abuf *i, *inext;
unsigned tickets;
unsigned int tickets;
timo_add(&p->u.midi.timo, MIDITHRU_TIMO);
@ -145,9 +145,10 @@ midi_msg_master(struct aproc *p, char *msg)
* send a message to the given output
*/
void
midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg, unsigned len)
midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg,
unsigned int len)
{
unsigned ocount;
unsigned int ocount;
unsigned char *odata;
if (msg[0] == SYSEX_START)
@ -207,7 +208,8 @@ midi_flush(struct aproc *p)
* ie. don't sent back the message to the sender
*/
void
midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, unsigned len)
midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg,
unsigned int len)
{
struct abuf *i, *inext;
@ -223,10 +225,10 @@ midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, unsigned len)
* send a quarter frame MTC message
*/
void
midi_send_qfr(struct aproc *p, unsigned rate, int delta)
midi_send_qfr(struct aproc *p, unsigned int rate, int delta)
{
unsigned char buf[2];
unsigned data;
unsigned int data;
int qfrlen;
p->u.midi.delta += delta * MTC_SEC;
@ -293,10 +295,11 @@ midi_send_qfr(struct aproc *p, unsigned rate, int delta)
* send a full frame MTC message
*/
void
midi_send_full(struct aproc *p, unsigned origin, unsigned rate, unsigned round, unsigned pos)
midi_send_full(struct aproc *p, unsigned int origin, unsigned int rate,
unsigned int round, unsigned int pos)
{
unsigned char buf[10];
unsigned fps;
unsigned int fps;
p->u.midi.delta = MTC_SEC * pos;
if (rate % (30 * 4 * round) == 0) {
@ -342,7 +345,7 @@ midi_send_full(struct aproc *p, unsigned origin, unsigned rate, unsigned round,
void
midi_copy_dump(struct aproc *p, struct abuf *obuf)
{
unsigned i;
unsigned int i;
unsigned char msg[sizeof(struct sysex)];
struct ctl_slot *s;
@ -369,7 +372,7 @@ midi_copy_dump(struct aproc *p, struct abuf *obuf)
* call-back.
*/
void
midi_send_vol(struct aproc *p, int slot, unsigned vol)
midi_send_vol(struct aproc *p, int slot, unsigned int vol)
{
unsigned char msg[3];
@ -402,9 +405,9 @@ void
midi_onvoice(struct aproc *p, struct abuf *ibuf)
{
struct ctl_slot *slot;
unsigned chan;
unsigned int chan;
#ifdef DEBUG
unsigned i;
unsigned int i;
if (debug_level >= 3) {
abuf_dbg(ibuf);
@ -436,9 +439,9 @@ void
midi_onsysex(struct aproc *p, struct abuf *ibuf)
{
struct sysex *x;
unsigned fps, len;
unsigned int fps, len;
#ifdef DEBUG
unsigned i;
unsigned int i;
if (debug_level >= 3) {
abuf_dbg(ibuf);
@ -531,7 +534,7 @@ int
midi_in(struct aproc *p, struct abuf *ibuf)
{
unsigned char c, *idata;
unsigned i, icount;
unsigned int i, icount;
if (!ABUF_ROK(ibuf))
return 0;

View File

@ -23,10 +23,11 @@ struct aproc *midi_new(char *, struct dev *);
void midi_ontick(struct aproc *, int);
void midi_send_slot(struct aproc *, int);
void midi_send_vol(struct aproc *, int, unsigned);
void midi_send_vol(struct aproc *, int, unsigned int);
void midi_send_master(struct aproc *);
void midi_send_full(struct aproc *, unsigned, unsigned, unsigned, unsigned);
void midi_send_qfr(struct aproc *, unsigned, int);
void midi_send_full(struct aproc *, unsigned int, unsigned int,
unsigned int, unsigned int);
void midi_send_qfr(struct aproc *, unsigned int, int);
void midi_flush(struct aproc *);
#endif /* !defined(MIDI_H) */

View File

@ -37,8 +37,8 @@ struct miofile {
};
void miofile_close(struct file *);
unsigned miofile_read(struct file *, unsigned char *, unsigned);
unsigned miofile_write(struct file *, unsigned char *, unsigned);
unsigned int miofile_read(struct file *, unsigned char *, unsigned int);
unsigned int miofile_write(struct file *, unsigned char *, unsigned int);
void miofile_start(struct file *);
void miofile_stop(struct file *);
int miofile_nfds(struct file *);
@ -62,7 +62,7 @@ struct fileops miofile_ops = {
* open the device
*/
struct miofile *
miofile_new(struct fileops *ops, char *path, unsigned mode)
miofile_new(struct fileops *ops, char *path, unsigned int mode)
{
char *siopath;
struct mio_hdl *hdl;
@ -82,11 +82,11 @@ miofile_new(struct fileops *ops, char *path, unsigned mode)
return NULL;
}
unsigned
miofile_read(struct file *file, unsigned char *data, unsigned count)
unsigned int
miofile_read(struct file *file, unsigned char *data, unsigned int count)
{
struct miofile *f = (struct miofile *)file;
unsigned n;
unsigned int n;
n = mio_read(f->hdl, data, count);
if (n == 0) {
@ -111,11 +111,11 @@ miofile_read(struct file *file, unsigned char *data, unsigned count)
}
unsigned
miofile_write(struct file *file, unsigned char *data, unsigned count)
unsigned int
miofile_write(struct file *file, unsigned char *data, unsigned int count)
{
struct miofile *f = (struct miofile *)file;
unsigned n;
unsigned int n;
n = mio_write(f->hdl, data, count);
if (n == 0) {

View File

@ -21,7 +21,7 @@ struct file;
struct fileops;
struct miofile;
struct miofile *miofile_new(struct fileops *, char *, unsigned);
struct miofile *miofile_new(struct fileops *, char *, unsigned int);
extern struct fileops miofile_ops;

View File

@ -30,10 +30,10 @@ struct opt *opt_list = NULL;
struct opt *
opt_new(char *name, struct dev *dev,
struct aparams *wpar, struct aparams *rpar,
int maxweight, int mmc, int join, unsigned mode)
int maxweight, int mmc, int join, unsigned int mode)
{
struct opt *o, **po;
unsigned len;
unsigned int len;
char c;
for (len = 0; name[len] != '\0'; len++) {
@ -115,7 +115,7 @@ opt_new(char *name, struct dev *dev,
}
struct opt *
opt_byname(char *name, unsigned num)
opt_byname(char *name, unsigned int num)
{
struct opt *o;

View File

@ -31,15 +31,15 @@ struct opt {
struct aparams rpar; /* template for clients read params */
int mmc; /* true if MMC control enabled */
int join; /* true if join/expand enabled */
unsigned mode; /* bitmap of MODE_XXX */
unsigned int mode; /* bitmap of MODE_XXX */
struct dev *dev; /* device to which we're attached */
};
extern struct opt *opt_list;
struct opt *opt_new(char *, struct dev *, struct aparams *, struct aparams *,
int, int, int, unsigned);
int, int, int, unsigned int);
int opt_bind(struct opt *);
struct opt *opt_byname(char *, unsigned);
struct opt *opt_byname(char *, unsigned int);
#endif /* !defined(OPT_H) */

View File

@ -57,8 +57,8 @@ pipe_new(struct fileops *ops, int fd, char *name)
return f;
}
unsigned
pipe_read(struct file *file, unsigned char *data, unsigned count)
unsigned int
pipe_read(struct file *file, unsigned char *data, unsigned int count)
{
struct pipe *f = (struct pipe *)file;
int n;
@ -87,8 +87,8 @@ pipe_read(struct file *file, unsigned char *data, unsigned count)
}
unsigned
pipe_write(struct file *file, unsigned char *data, unsigned count)
unsigned int
pipe_write(struct file *file, unsigned char *data, unsigned int count)
{
struct pipe *f = (struct pipe *)file;
int n;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pipe.h,v 1.5 2010/04/06 20:07:01 ratchov Exp $ */
/* $OpenBSD$ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@ -28,8 +28,8 @@ extern struct fileops pipe_ops;
struct pipe *pipe_new(struct fileops *, int, char *);
void pipe_close(struct file *);
unsigned pipe_read(struct file *, unsigned char *, unsigned);
unsigned pipe_write(struct file *, unsigned char *, unsigned);
unsigned int pipe_read(struct file *, unsigned char *, unsigned int);
unsigned int pipe_write(struct file *, unsigned char *, unsigned int);
int pipe_nfds(struct file *);
int pipe_pollfd(struct file *, struct pollfd *, int);
int pipe_revents(struct file *, struct pollfd *);

View File

@ -38,9 +38,9 @@
struct siofile {
struct file file;
struct sio_hdl *hdl;
unsigned wtickets, wbpf;
unsigned rtickets, rbpf;
unsigned bufsz;
unsigned int wtickets, wbpf;
unsigned int rtickets, rbpf;
unsigned int bufsz;
int started;
void (*onmove)(void *, int);
void *arg;
@ -50,8 +50,8 @@ struct siofile {
};
void siofile_close(struct file *);
unsigned siofile_read(struct file *, unsigned char *, unsigned);
unsigned siofile_write(struct file *, unsigned char *, unsigned);
unsigned int siofile_read(struct file *, unsigned char *, unsigned int);
unsigned int siofile_write(struct file *, unsigned char *, unsigned int);
void siofile_start(struct file *, void (*)(void *, int), void *);
void siofile_stop(struct file *);
int siofile_nfds(struct file *);
@ -205,15 +205,15 @@ siofile_cb(void *addr, int delta)
* Open the device.
*/
struct siofile *
siofile_new(struct fileops *ops, char *path, unsigned *rmode,
siofile_new(struct fileops *ops, char *path, unsigned int *rmode,
struct aparams *ipar, struct aparams *opar,
unsigned *bufsz, unsigned *round)
unsigned int *bufsz, unsigned int *round)
{
char *siopath;
struct sio_par par;
struct sio_hdl *hdl;
struct siofile *f;
unsigned mode = *rmode;
unsigned int mode = *rmode;
siopath = (strcmp(path, "default") == 0) ? NULL : path;
hdl = sio_open(siopath, mode, 1);
@ -357,11 +357,11 @@ siofile_stop(struct file *file)
#endif
}
unsigned
siofile_read(struct file *file, unsigned char *data, unsigned count)
unsigned int
siofile_read(struct file *file, unsigned char *data, unsigned int count)
{
struct siofile *f = (struct siofile *)file;
unsigned n;
unsigned int n;
#ifdef DEBUG
if (f->rtickets == 0) {
@ -405,11 +405,11 @@ siofile_read(struct file *file, unsigned char *data, unsigned count)
}
unsigned
siofile_write(struct file *file, unsigned char *data, unsigned count)
unsigned int
siofile_write(struct file *file, unsigned char *data, unsigned int count)
{
struct siofile *f = (struct siofile *)file;
unsigned n;
unsigned int n;
#ifdef DEBUG
if (f->wtickets == 0) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: siofile.h,v 1.5 2010/05/02 11:54:26 ratchov Exp $ */
/* $OpenBSD$ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@ -22,8 +22,8 @@ struct siofile;
struct aparams;
struct aproc;
struct siofile *siofile_new(struct fileops *, char *, unsigned *,
struct aparams *, struct aparams *, unsigned *, unsigned *);
struct siofile *siofile_new(struct fileops *, char *, unsigned int *,
struct aparams *, struct aparams *, unsigned int *, unsigned int *);
struct aproc *rsio_new(struct file *f);
struct aproc *wsio_new(struct file *f);

View File

@ -77,11 +77,11 @@ sock_dbg(struct sock *f)
}
#endif
void sock_setvol(void *, unsigned);
void sock_setvol(void *, unsigned int);
void sock_startreq(void *);
void sock_stopreq(void *);
void sock_quitreq(void *);
void sock_locreq(void *, unsigned);
void sock_locreq(void *, unsigned int);
struct ctl_ops ctl_sockops = {
sock_setvol,
@ -91,7 +91,7 @@ struct ctl_ops ctl_sockops = {
sock_quitreq
};
unsigned sock_sesrefs = 0; /* connections to the session */
unsigned int sock_sesrefs = 0; /* connections to the session */
uint8_t sock_sescookie[AMSG_COOKIELEN]; /* owner of the session */
void
@ -389,7 +389,7 @@ void
sock_allocbuf(struct sock *f)
{
struct abuf *rbuf = NULL, *wbuf = NULL;
unsigned bufsz;
unsigned int bufsz;
bufsz = f->bufsz + f->dev->bufsz / f->dev->round * f->round;
f->pstate = SOCK_START;
@ -435,7 +435,7 @@ sock_allocbuf(struct sock *f)
* Set volume. Callback invoked when volume is modified externally
*/
void
sock_setvol(void *arg, unsigned vol)
sock_setvol(void *arg, unsigned int vol)
{
struct sock *f = (struct sock *)arg;
struct abuf *rbuf;
@ -492,7 +492,7 @@ sock_stopreq(void *arg)
* Callback invoked by MMC relocate, ignored
*/
void
sock_locreq(void *arg, unsigned mmcpos)
sock_locreq(void *arg, unsigned int mmcpos)
{
#ifdef DEBUG
struct sock *f = (struct sock *)arg;
@ -528,7 +528,7 @@ void
sock_attach(struct sock *f, int force)
{
struct abuf *rbuf, *wbuf;
unsigned rch, wch;
unsigned int rch, wch;
rbuf = LIST_FIRST(&f->pipe.file.rproc->outs);
wbuf = LIST_FIRST(&f->pipe.file.wproc->ins);
@ -606,7 +606,7 @@ sock_reset(struct sock *f)
int
sock_rmsg(struct sock *f)
{
unsigned count;
unsigned int count;
unsigned char *data;
while (f->rtodo > 0) {
@ -643,9 +643,9 @@ sock_rmsg(struct sock *f)
* points to the f->rtodo or f->wtodo respectively.
*/
int
sock_wmsg(struct sock *f, struct amsg *m, unsigned *ptodo)
sock_wmsg(struct sock *f, struct amsg *m, unsigned int *ptodo)
{
unsigned count;
unsigned int count;
unsigned char *data;
while (*ptodo > 0) {
@ -685,7 +685,7 @@ sock_rdata(struct sock *f)
{
struct aproc *p;
struct abuf *obuf;
unsigned n;
unsigned int n;
#ifdef DEBUG
if (f->rtodo == 0) {
@ -719,7 +719,7 @@ sock_wdata(struct sock *f)
{
struct aproc *p;
struct abuf *ibuf;
unsigned n;
unsigned int n;
#ifdef DEBUG
if (f->wtodo == 0) {
@ -753,7 +753,7 @@ int
sock_setpar(struct sock *f)
{
struct amsg_par *p = &f->rmsg.u.par;
unsigned min, max, rate, pchan, rchan, appbufsz;
unsigned int min, max, rate, pchan, rchan, appbufsz;
rchan = ntohs(p->rchan);
pchan = ntohs(p->pchan);
@ -983,7 +983,7 @@ int
sock_hello(struct sock *f)
{
struct amsg_hello *p = &f->rmsg.u.hello;
unsigned mode;
unsigned int mode;
mode = ntohs(p->mode);
#ifdef DEBUG
@ -1093,7 +1093,7 @@ sock_execmsg(struct sock *f)
{
struct amsg *m = &f->rmsg;
struct abuf *obuf;
unsigned size, ctl;
unsigned int size, ctl;
switch (ntohl(m->cmd)) {
case AMSG_DATA:
@ -1421,7 +1421,7 @@ sock_buildmsg(struct sock *f)
{
struct aproc *p;
struct abuf *ibuf;
unsigned size, max;
unsigned int size, max;
/*
* Send initial position

View File

@ -30,18 +30,18 @@ struct sock {
* to decode/encode messages in the stream.
*/
struct amsg rmsg, wmsg; /* messages being sent/received */
unsigned wmax; /* max frames we're allowed to write */
unsigned rmax; /* max frames we're allowed to read */
unsigned rtodo; /* input bytes not read yet */
unsigned wtodo; /* output bytes not written yet */
unsigned int wmax; /* max frames we're allowed to write */
unsigned int rmax; /* max frames we're allowed to read */
unsigned int rtodo; /* input bytes not read yet */
unsigned int wtodo; /* output bytes not written yet */
#define SOCK_RDATA 0 /* data chunk being read */
#define SOCK_RMSG 1 /* amsg query being processed */
#define SOCK_RRET 2 /* amsg reply being returned */
unsigned rstate; /* state of the read-end FSM */
unsigned int rstate; /* state of the read-end FSM */
#define SOCK_WIDLE 0 /* nothing to do */
#define SOCK_WMSG 1 /* amsg being written */
#define SOCK_WDATA 2 /* data chunk being written */
unsigned wstate; /* state of the write-end FSM */
unsigned int wstate; /* state of the write-end FSM */
#define SOCK_AUTH 0 /* waiting for AUTH message */
#define SOCK_HELLO 1 /* waiting for HELLO message */
#define SOCK_INIT 2 /* parameter negotiation */
@ -50,18 +50,18 @@ struct sock {
#define SOCK_RUN 5 /* attached to the mix / sub */
#define SOCK_STOP 6 /* draining rec buffers */
#define SOCK_MIDI 7 /* raw byte stream (midi) */
unsigned pstate; /* one of the above */
unsigned mode; /* bitmask of MODE_XXX */
unsigned int pstate; /* one of the above */
unsigned int mode; /* bitmask of MODE_XXX */
struct aparams rpar; /* read (ie play) parameters */
struct aparams wpar; /* write (ie rec) parameters */
int delta; /* pos. change to send */
int startpos; /* initial pos. to send */
int tickpending; /* delta waiting to be transmitted */
int startpending; /* initial delta waiting to be transmitted */
unsigned walign; /* align data packets to this */
unsigned bufsz; /* total buffer size */
unsigned round; /* block size */
unsigned xrun; /* one of AMSG_IGNORE, ... */
unsigned int walign; /* align data packets to this */
unsigned int bufsz; /* total buffer size */
unsigned int round; /* block size */
unsigned int xrun; /* one of AMSG_IGNORE, ... */
int vol; /* requested volume */
int lastvol; /* last volume */
int slot; /* mixer ctl slot number */

View File

@ -137,10 +137,10 @@ void wwav_hup(struct aproc *, struct abuf *);
void wwav_done(struct aproc *);
struct aproc *wwav_new(struct file *);
void wav_setvol(void *, unsigned);
void wav_setvol(void *, unsigned int);
void wav_startreq(void *);
void wav_stopreq(void *);
void wav_locreq(void *, unsigned);
void wav_locreq(void *, unsigned int);
void wav_quitreq(void *);
struct ctl_ops ctl_wavops = {
@ -201,9 +201,9 @@ wav_dbg(struct wav *f)
* convert ``count'' samples using the given char->short map
*/
void
wav_conv(unsigned char *data, unsigned count, short *map)
wav_conv(unsigned char *data, unsigned int count, short *map)
{
unsigned i;
unsigned int i;
unsigned char *iptr;
adata_t *optr;
@ -219,11 +219,11 @@ wav_conv(unsigned char *data, unsigned count, short *map)
/*
* read method of the file structure
*/
unsigned
wav_read(struct file *file, unsigned char *data, unsigned count)
unsigned int
wav_read(struct file *file, unsigned char *data, unsigned int count)
{
struct wav *f = (struct wav *)file;
unsigned n;
unsigned int n;
if (f->map)
count /= sizeof(adata_t);
@ -256,11 +256,11 @@ wav_read(struct file *file, unsigned char *data, unsigned count)
/*
* write method of the file structure
*/
unsigned
wav_write(struct file *file, unsigned char *data, unsigned count)
unsigned int
wav_write(struct file *file, unsigned char *data, unsigned int count)
{
struct wav *f = (struct wav *)file;
unsigned n;
unsigned int n;
if (f->wbytes >= 0 && count > f->wbytes) {
count = f->wbytes; /* wbytes fits in count */
@ -383,7 +383,7 @@ wav_allocbuf(struct wav *f)
{
struct abuf *buf;
struct dev *d = f->dev;
unsigned nfr;
unsigned int nfr;
f->pstate = WAV_START;
if (f->mode & MODE_PLAY) {
@ -616,7 +616,7 @@ wav_wdata(struct wav *f)
* callback to set the volume, invoked by the MIDI control code
*/
void
wav_setvol(void *arg, unsigned vol)
wav_setvol(void *arg, unsigned int vol)
{
struct wav *f = (struct wav *)arg;
struct abuf *rbuf;
@ -692,7 +692,7 @@ wav_stopreq(void *arg)
* on a stopped stream
*/
void
wav_locreq(void *arg, unsigned mmc)
wav_locreq(void *arg, unsigned int mmc)
{
struct wav *f = (struct wav *)arg;
@ -730,7 +730,7 @@ wav_quitreq(void *arg)
* determine the header by the file name
*/
int
wav_autohdr(char *name, struct dev *dev, unsigned *hdr, unsigned *mode)
wav_autohdr(char *name, struct dev *dev, unsigned int *hdr, unsigned int *mode)
{
char *ext;
@ -769,8 +769,9 @@ wav_autohdr(char *name, struct dev *dev, unsigned *hdr, unsigned *mode)
*/
struct wav *
wav_new_in(struct fileops *ops, struct dev *dev,
unsigned mode, char *name, unsigned hdr,
struct aparams *par, unsigned xrun, unsigned volctl, int mmc, int join)
unsigned int mode, char *name, unsigned int hdr,
struct aparams *par, unsigned int xrun,
unsigned int volctl, int mmc, int join)
{
int fd;
struct wav *f;
@ -853,8 +854,8 @@ wav_new_in(struct fileops *ops, struct dev *dev,
*/
struct wav *
wav_new_out(struct fileops *ops, struct dev *dev,
unsigned mode, char *name, unsigned hdr,
struct aparams *par, unsigned xrun, int mmc, int join)
unsigned int mode, char *name, unsigned int hdr,
struct aparams *par, unsigned int xrun, int mmc, int join)
{
int fd;
struct wav *f;

View File

@ -28,8 +28,8 @@ struct wav {
#define HDR_AUTO 0 /* guess by looking at the file name */
#define HDR_RAW 1 /* no headers, ie openbsd native ;-) */
#define HDR_WAV 2 /* microsoft riff wave */
unsigned hdr; /* HDR_RAW or HDR_WAV */
unsigned xrun; /* xrun policy */
unsigned int hdr; /* HDR_RAW or HDR_WAV */
unsigned int xrun; /* xrun policy */
struct aparams hpar; /* parameters to write on the header */
off_t rbytes; /* bytes to read, -1 if no limit */
off_t wbytes; /* bytes to write, -1 if no limit */
@ -40,16 +40,16 @@ struct wav {
int slot; /* mixer ctl slot number */
int mmc; /* use MMC control */
int join; /* join/expand channels */
unsigned vol; /* current volume */
unsigned maxweight; /* dynamic range when vol == 127 */
unsigned int vol; /* current volume */
unsigned int maxweight; /* dynamic range when vol == 127 */
#define WAV_CFG 0 /* parameters read from headers */
#define WAV_INIT 1 /* not trying to do anything */
#define WAV_START 2 /* buffer allocated */
#define WAV_READY 3 /* buffer filled enough */
#define WAV_RUN 4 /* buffer attached to device */
#define WAV_MIDI 5 /* midi "syx" file */
unsigned pstate; /* one of above */
unsigned mode; /* bitmap of MODE_* */
unsigned int pstate; /* one of above */
unsigned int mode; /* bitmap of MODE_* */
struct dev *dev; /* device playing or recording */
};
@ -57,15 +57,17 @@ extern struct fileops wav_ops;
struct wav *wav_list;
struct wav *wav_new_in(struct fileops *, struct dev *,
unsigned, char *, unsigned, struct aparams *, unsigned, unsigned, int, int);
unsigned int, char *, unsigned int, struct aparams *,
unsigned int, unsigned int, int, int);
struct wav *wav_new_out(struct fileops *, struct dev *,
unsigned, char *, unsigned, struct aparams *, unsigned, int, int);
unsigned wav_read(struct file *, unsigned char *, unsigned);
unsigned wav_write(struct file *, unsigned char *, unsigned);
unsigned int, char *, unsigned int, struct aparams *,
unsigned int, int, int);
unsigned int wav_read(struct file *, unsigned char *, unsigned int);
unsigned int wav_write(struct file *, unsigned char *, unsigned int);
void wav_close(struct file *);
int wav_readhdr(int, struct aparams *, off_t *, off_t *, short **);
int wav_writehdr(int, struct aparams *, off_t *, off_t);
void wav_conv(unsigned char *, unsigned, short *);
void wav_conv(unsigned char *, unsigned int, short *);
int wav_init(struct wav *);
extern short wav_ulawmap[256];

View File

@ -191,7 +191,8 @@ aucat_rdata(struct aucat *hdl, void *buf, size_t len, int *eof)
}
size_t
aucat_wdata(struct aucat *hdl, const void *buf, size_t len, unsigned wbpf, int *eof)
aucat_wdata(struct aucat *hdl, const void *buf, size_t len,
unsigned int wbpf, int *eof)
{
ssize_t n;
size_t datasize;
@ -324,7 +325,7 @@ bad_gen:
}
int
aucat_connect_tcp(struct aucat *hdl, char *host, unsigned unit)
aucat_connect_tcp(struct aucat *hdl, char *host, unsigned int unit)
{
int s, error, opt;
struct addrinfo *ailist, *ai, aihints;
@ -371,7 +372,7 @@ aucat_connect_tcp(struct aucat *hdl, char *host, unsigned unit)
}
int
aucat_connect_un(struct aucat *hdl, unsigned unit)
aucat_connect_un(struct aucat *hdl, unsigned int unit)
{
struct sockaddr_un ca;
socklen_t len = sizeof(struct sockaddr_un);
@ -406,10 +407,10 @@ aucat_connect_un(struct aucat *hdl, unsigned unit)
}
static const char *
parsedev(const char *str, unsigned *rval)
parsedev(const char *str, unsigned int *rval)
{
const char *p = str;
unsigned val;
unsigned int val;
for (val = 0; *p >= '0' && *p <= '9'; p++) {
val = 10 * val + (*p - '0');
@ -427,7 +428,7 @@ parsedev(const char *str, unsigned *rval)
}
static const char *
parsestr(const char *str, char *rstr, unsigned max)
parsestr(const char *str, char *rstr, unsigned int max)
{
const char *p = str;
@ -447,13 +448,14 @@ parsestr(const char *str, char *rstr, unsigned max)
}
int
aucat_open(struct aucat *hdl, const char *str, unsigned mode, unsigned type)
aucat_open(struct aucat *hdl, const char *str, unsigned int mode,
unsigned int type)
{
extern char *__progname;
int eof;
char host[NI_MAXHOST], opt[AMSG_OPTMAX];
const char *p = str;
unsigned unit, devnum;
unsigned int unit, devnum;
if (*p == '@') {
p = parsestr(++p, host, NI_MAXHOST);

View File

@ -33,7 +33,7 @@
#include "bsd-compat.h"
struct mio_hdl *
mio_open(const char *str, unsigned mode, int nbio)
mio_open(const char *str, unsigned int mode, int nbio)
{
struct mio_hdl *hdl;
const char *p;
@ -63,7 +63,8 @@ mio_open(const char *str, unsigned mode, int nbio)
}
void
mio_create(struct mio_hdl *hdl, struct mio_ops *ops, unsigned mode, int nbio)
mio_create(struct mio_hdl *hdl, struct mio_ops *ops,
unsigned int mode, int nbio)
{
hdl->ops = ops;
hdl->mode = mode;

View File

@ -53,7 +53,8 @@ static struct mio_ops mio_aucat_ops = {
};
struct mio_hdl *
mio_aucat_open(const char *str, unsigned mode, int nbio, unsigned type)
mio_aucat_open(const char *str, unsigned int mode,
int nbio, unsigned int type)
{
struct mio_aucat_hdl *hdl;

View File

@ -30,7 +30,7 @@
.Sh SYNOPSIS
.Fd #include <sndio.h>
.Ft "struct mio_hdl *"
.Fn "mio_open" "const char *name" "unsigned mode" "int nbio_flag"
.Fn "mio_open" "const char *name" "unsigned int mode" "int nbio_flag"
.Ft "void"
.Fn "mio_close" "struct mio_hdl *hdl"
.Ft "size_t"

View File

@ -50,7 +50,7 @@ static struct mio_ops mio_rmidi_ops = {
};
struct mio_hdl *
mio_rmidi_open(const char *str, unsigned mode, int nbio)
mio_rmidi_open(const char *str, unsigned int mode, int nbio)
{
int fd, flags;
struct mio_rmidi_hdl *hdl;

View File

@ -42,7 +42,7 @@ sio_initpar(struct sio_par *par)
}
struct sio_hdl *
sio_open(const char *str, unsigned mode, int nbio)
sio_open(const char *str, unsigned int mode, int nbio)
{
struct sio_hdl *hdl;
const char *p;
@ -84,7 +84,8 @@ sio_open(const char *str, unsigned mode, int nbio)
}
void
sio_create(struct sio_hdl *hdl, struct sio_ops *ops, unsigned mode, int nbio)
sio_create(struct sio_hdl *hdl, struct sio_ops *ops,
unsigned int mode, int nbio)
{
hdl->ops = ops;
hdl->mode = mode;
@ -239,7 +240,7 @@ sio_psleep(struct sio_hdl *hdl, int event)
size_t
sio_read(struct sio_hdl *hdl, void *buf, size_t len)
{
unsigned n;
unsigned int n;
char *data = buf;
size_t todo = len;
@ -277,12 +278,12 @@ sio_read(struct sio_hdl *hdl, void *buf, size_t len)
size_t
sio_write(struct sio_hdl *hdl, const void *buf, size_t len)
{
unsigned n;
unsigned int n;
const unsigned char *data = buf;
size_t todo = len;
#ifdef DEBUG
struct timeval tv0, tv1, dtv;
unsigned us;
unsigned int us;
if (sndio_debug >= 2)
gettimeofday(&tv0, NULL);
@ -354,7 +355,7 @@ sio_revents(struct sio_hdl *hdl, struct pollfd *pfd)
int revents;
#ifdef DEBUG
struct timeval tv0, tv1, dtv;
unsigned us;
unsigned int us;
if (sndio_debug >= 2)
gettimeofday(&tv0, NULL);
@ -428,7 +429,7 @@ sio_onmove_cb(struct sio_hdl *hdl, int delta)
}
int
sio_setvol(struct sio_hdl *hdl, unsigned ctl)
sio_setvol(struct sio_hdl *hdl, unsigned int ctl)
{
if (hdl->eof)
return 0;
@ -441,7 +442,7 @@ sio_setvol(struct sio_hdl *hdl, unsigned ctl)
}
int
sio_onvol(struct sio_hdl *hdl, void (*cb)(void *, unsigned), void *addr)
sio_onvol(struct sio_hdl *hdl, void (*cb)(void *, unsigned int), void *addr)
{
if (hdl->started) {
DPRINTF("sio_onvol: already started\n");
@ -457,7 +458,7 @@ sio_onvol(struct sio_hdl *hdl, void (*cb)(void *, unsigned), void *addr)
}
void
sio_onvol_cb(struct sio_hdl *hdl, unsigned ctl)
sio_onvol_cb(struct sio_hdl *hdl, unsigned int ctl)
{
if (hdl->vol_cb)
hdl->vol_cb(hdl->vol_addr, ctl);

View File

@ -35,10 +35,10 @@
struct sio_aucat_hdl {
struct sio_hdl sio;
struct aucat aucat;
unsigned rbpf, wbpf; /* read and write bytes-per-frame */
unsigned int rbpf, wbpf; /* read and write bytes-per-frame */
int maxwrite; /* latency constraint */
int events; /* events the user requested */
unsigned curvol, reqvol; /* current and requested volume */
unsigned int curvol, reqvol; /* current and requested volume */
int delta; /* some of received deltas */
#define PSTATE_INIT 0
#define PSTATE_RUN 1
@ -56,7 +56,7 @@ static size_t sio_aucat_write(struct sio_hdl *, const void *, size_t);
static int sio_aucat_nfds(struct sio_hdl *);
static int sio_aucat_pollfd(struct sio_hdl *, struct pollfd *, int);
static int sio_aucat_revents(struct sio_hdl *, struct pollfd *);
static int sio_aucat_setvol(struct sio_hdl *, unsigned);
static int sio_aucat_setvol(struct sio_hdl *, unsigned int);
static void sio_aucat_getvol(struct sio_hdl *);
static struct sio_ops sio_aucat_ops = {
@ -82,7 +82,7 @@ static int
sio_aucat_runmsg(struct sio_aucat_hdl *hdl)
{
int delta;
unsigned size, ctl;
unsigned int size, ctl;
if (!aucat_rmsg(&hdl->aucat, &hdl->sio.eof))
return 0;
@ -150,7 +150,7 @@ sio_aucat_buildmsg(struct sio_aucat_hdl *hdl)
}
struct sio_hdl *
sio_aucat_open(const char *str, unsigned mode, int nbio)
sio_aucat_open(const char *str, unsigned int mode, int nbio)
{
struct sio_aucat_hdl *hdl;
@ -215,7 +215,7 @@ sio_aucat_stop(struct sio_hdl *sh)
#define ZERO_MAX 0x400
static unsigned char zero[ZERO_MAX];
struct sio_aucat_hdl *hdl = (struct sio_aucat_hdl *)sh;
unsigned n, count;
unsigned int n, count;
if (!aucat_setfl(&hdl->aucat, 0, &hdl->sio.eof))
return 0;
@ -328,8 +328,8 @@ sio_aucat_getpar(struct sio_hdl *sh, struct sio_par *par)
static int
sio_aucat_getcap(struct sio_hdl *sh, struct sio_cap *cap)
{
unsigned i, bps, le, sig, chan, rindex, rmult;
static unsigned rates[] = { 8000, 11025, 12000 };
unsigned int i, bps, le, sig, chan, rindex, rmult;
static unsigned int rates[] = { 8000, 11025, 12000 };
bps = 1;
sig = le = 0;
@ -390,7 +390,7 @@ sio_aucat_getcap(struct sio_hdl *sh, struct sio_cap *cap)
cap->rate[i] = rates[rindex] * rmult;
cap->confs[0].rate |= 1 << i;
rindex++;
if (rindex == sizeof(rates) / sizeof(unsigned)) {
if (rindex == sizeof(rates) / sizeof(unsigned int)) {
rindex = 0;
rmult *= 2;
}
@ -472,7 +472,7 @@ sio_aucat_revents(struct sio_hdl *sh, struct pollfd *pfd)
}
static int
sio_aucat_setvol(struct sio_hdl *sh, unsigned vol)
sio_aucat_setvol(struct sio_hdl *sh, unsigned int vol)
{
struct sio_aucat_hdl *hdl = (struct sio_aucat_hdl *)sh;

View File

@ -39,7 +39,7 @@
.Sh SYNOPSIS
.Fd #include <sndio.h>
.Ft "struct sio_hdl *"
.Fn "sio_open" "const char *name" "unsigned mode" "int nbio_flag"
.Fn "sio_open" "const char *name" "unsigned int mode" "int nbio_flag"
.Ft "void"
.Fn "sio_close" "struct sio_hdl *hdl"
.Ft "int"
@ -67,9 +67,9 @@
.Ft "int"
.Fn "sio_eof" "struct sio_hdl *hdl"
.Ft "int"
.Fn "sio_setvol" "struct sio_hdl *hdl" "unsigned vol"
.Fn "sio_setvol" "struct sio_hdl *hdl" "unsigned int vol"
.Ft "int"
.Fn "sio_onvol" "struct sio_hdl *hdl" "void (*cb)(void *arg, unsigned vol)" "void *arg"
.Fn "sio_onvol" "struct sio_hdl *hdl" "void (*cb)(void *arg, unsigned int vol)" "void *arg"
.Ft "void"
.Fn "sio_initpar" "struct sio_par *par"
.\"Fd #define SIO_BPS(bits)
@ -155,21 +155,21 @@ The set of parameters of the stream that can be controlled
is given by the following structure:
.Bd -literal
struct sio_par {
unsigned bits; /* bits per sample */
unsigned bps; /* bytes per sample */
unsigned sig; /* 1 = signed, 0 = unsigned */
unsigned le; /* 1 = LE, 0 = BE byte order */
unsigned msb; /* 1 = MSB, 0 = LSB aligned */
unsigned rchan; /* number channels for recording */
unsigned pchan; /* number channels for playback */
unsigned rate; /* frames per second */
unsigned appbufsz; /* minimum buffer size without xruns */
unsigned bufsz; /* end-to-end buffer size (read-only) */
unsigned round; /* optimal buffer size divisor */
unsigned int bits; /* bits per sample */
unsigned int bps; /* bytes per sample */
unsigned int sig; /* 1 = signed, 0 = unsigned int */
unsigned int le; /* 1 = LE, 0 = BE byte order */
unsigned int msb; /* 1 = MSB, 0 = LSB aligned */
unsigned int rchan; /* number channels for recording */
unsigned int pchan; /* number channels for playback */
unsigned int rate; /* frames per second */
unsigned int appbufsz; /* minimum buffer size without xruns */
unsigned int bufsz; /* end-to-end buffer size (read-only) */
unsigned int round; /* optimal buffer size divisor */
#define SIO_IGNORE 0 /* pause during xrun */
#define SIO_SYNC 1 /* resync after xrun */
#define SIO_ERROR 2 /* terminate on xrun */
unsigned xrun; /* what to do on overrun/underrun */
unsigned int xrun; /* what to do on overrun/underrun */
};
.Ed
.Pp
@ -316,21 +316,21 @@ usable together.
.Bd -literal
struct sio_cap {
struct sio_enc { /* allowed encodings */
unsigned bits;
unsigned bps;
unsigned sig;
unsigned le;
unsigned msb;
unsigned int bits;
unsigned int bps;
unsigned int sig;
unsigned int le;
unsigned int msb;
} enc[SIO_NENC];
unsigned rchan[SIO_NCHAN]; /* allowed rchans */
unsigned pchan[SIO_NCHAN]; /* allowed pchans */
unsigned rate[SIO_NRATE]; /* allowed rates */
unsigned nconf; /* num. of confs[] */
unsigned int rchan[SIO_NCHAN]; /* allowed rchans */
unsigned int pchan[SIO_NCHAN]; /* allowed pchans */
unsigned int rate[SIO_NRATE]; /* allowed rates */
unsigned int nconf; /* num. of confs[] */
struct sio_conf {
unsigned enc; /* bitmask of enc[] indexes */
unsigned rchan; /* bitmask of rchan[] indexes */
unsigned pchan; /* bitmask of pchan[] indexes */
unsigned rate; /* bitmask of rate[] indexes */
unsigned int enc; /* bitmask of enc[] indexes */
unsigned int rchan; /* bitmask of rchan[] indexes */
unsigned int pchan; /* bitmask of pchan[] indexes */
unsigned int rate; /* bitmask of rate[] indexes */
} confs[SIO_NCONF];
};
.Ed

View File

@ -49,9 +49,9 @@ struct sio_sun_hdl {
struct sio_hdl sio;
int fd;
int filling;
unsigned ibpf, obpf; /* bytes per frame */
unsigned ibytes, obytes; /* bytes the hw transferred */
unsigned ierr, oerr; /* frames the hw dropped */
unsigned int ibpf, obpf; /* bytes per frame */
unsigned int ibytes, obytes; /* bytes the hw transferred */
unsigned int ierr, oerr; /* frames the hw dropped */
int offset; /* frames play is ahead of record */
int idelta, odelta; /* position reported to client */
int mix_fd, mix_index; /* /dev/mixerN stuff */
@ -89,7 +89,8 @@ static struct sio_ops sio_sun_ops = {
* convert sun encoding to sio_par encoding
*/
static int
sio_sun_infotoenc(struct sio_sun_hdl *hdl, struct audio_prinfo *ai, struct sio_par *par)
sio_sun_infotoenc(struct sio_sun_hdl *hdl, struct audio_prinfo *ai,
struct sio_par *par)
{
par->msb = ai->msb;
par->bits = ai->precision;
@ -131,7 +132,8 @@ sio_sun_infotoenc(struct sio_sun_hdl *hdl, struct audio_prinfo *ai, struct sio_p
* convert sio_par encoding to sun encoding
*/
static void
sio_sun_enctoinfo(struct sio_sun_hdl *hdl, unsigned *renc, struct sio_par *par)
sio_sun_enctoinfo(struct sio_sun_hdl *hdl,
unsigned int *renc, struct sio_par *par)
{
if (par->le == ~0U && par->sig == ~0U) {
*renc = ~0U;
@ -154,7 +156,7 @@ sio_sun_enctoinfo(struct sio_sun_hdl *hdl, unsigned *renc, struct sio_par *par)
*/
static int
sio_sun_tryinfo(struct sio_sun_hdl *hdl, struct sio_enc *enc,
unsigned pchan, unsigned rchan, unsigned rate)
unsigned int pchan, unsigned int rchan, unsigned int rate)
{
struct audio_info aui;
struct audio_prinfo *pr;
@ -217,19 +219,19 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
{
#define NCHANS (sizeof(chans) / sizeof(chans[0]))
#define NRATES (sizeof(rates) / sizeof(rates[0]))
static unsigned chans[] = {
static unsigned int chans[] = {
1, 2, 4, 6, 8, 10, 12
};
static unsigned rates[] = {
static unsigned int rates[] = {
8000, 11025, 12000, 16000, 22050, 24000,
32000, 44100, 48000, 64000, 88200, 96000
};
struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh;
struct sio_par savepar;
struct audio_encoding ae;
unsigned nenc = 0, nconf = 0;
unsigned enc_map = 0, rchan_map = 0, pchan_map = 0, rate_map;
unsigned i, j, conf;
unsigned int nenc = 0, nconf = 0;
unsigned int enc_map = 0, rchan_map = 0, pchan_map = 0, rate_map;
unsigned int i, j, conf;
if (!sio_sun_getpar(&hdl->sio, &savepar))
return 0;
@ -284,14 +286,14 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
* use the current encoding and try various channels.
*/
if (hdl->sio.mode & SIO_PLAY) {
memcpy(&cap->pchan, chans, NCHANS * sizeof(unsigned));
memcpy(&cap->pchan, chans, NCHANS * sizeof(unsigned int));
for (i = 0; i < NCHANS; i++) {
if (sio_sun_tryinfo(hdl, NULL, chans[i], 0, 0))
pchan_map |= (1 << i);
}
}
if (hdl->sio.mode & SIO_REC) {
memcpy(&cap->rchan, chans, NCHANS * sizeof(unsigned));
memcpy(&cap->rchan, chans, NCHANS * sizeof(unsigned int));
for (i = 0; i < NCHANS; i++) {
if (sio_sun_tryinfo(hdl, NULL, 0, chans[i], 0))
rchan_map |= (1 << i);
@ -305,7 +307,7 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
* uaudio devices), so certain rates may not be allowed with
* certain encodings. We have to check rates for all encodings
*/
memcpy(&cap->rate, rates, NRATES * sizeof(unsigned));
memcpy(&cap->rate, rates, NRATES * sizeof(unsigned int));
for (j = 0; j < nenc; j++) {
rate_map = 0;
for (i = 0; i < NRATES; i++) {
@ -337,7 +339,7 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
}
struct sio_hdl *
sio_sun_open(const char *str, unsigned mode, int nbio)
sio_sun_open(const char *str, unsigned int mode, int nbio)
{
int fd, flags, fullduplex;
struct audio_info aui;
@ -523,9 +525,9 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
#define NRETRIES 8
struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh;
struct audio_info aui;
unsigned i, infr, ibpf, onfr, obpf;
unsigned bufsz, round;
unsigned rate, req_rate, prec, enc;
unsigned int i, infr, ibpf, onfr, obpf;
unsigned int bufsz, round;
unsigned int rate, req_rate, prec, enc;
/*
* try to set parameters until the device accepts

View File

@ -29,21 +29,21 @@ struct mio_hdl;
* parameters of a full-duplex stream
*/
struct sio_par {
unsigned bits; /* bits per sample */
unsigned bps; /* bytes per sample */
unsigned sig; /* 1 = signed, 0 = unsigned */
unsigned le; /* 1 = LE, 0 = BE byte order */
unsigned msb; /* 1 = MSB, 0 = LSB aligned */
unsigned rchan; /* number channels for recording direction */
unsigned pchan; /* number channels for playback direction */
unsigned rate; /* frames per second */
unsigned bufsz; /* end-to-end buffer size */
unsigned int bits; /* bits per sample */
unsigned int bps; /* bytes per sample */
unsigned int sig; /* 1 = signed, 0 = unsigned */
unsigned int le; /* 1 = LE, 0 = BE byte order */
unsigned int msb; /* 1 = MSB, 0 = LSB aligned */
unsigned int rchan; /* number channels for recording direction */
unsigned int pchan; /* number channels for playback direction */
unsigned int rate; /* frames per second */
unsigned int bufsz; /* end-to-end buffer size */
#define SIO_IGNORE 0 /* pause during xrun */
#define SIO_SYNC 1 /* resync after xrun */
#define SIO_ERROR 2 /* terminate on xrun */
unsigned xrun; /* what to do on overruns/underruns */
unsigned round; /* optimal bufsz divisor */
unsigned appbufsz; /* minimum buffer size */
unsigned int xrun; /* what to do on overruns/underruns */
unsigned int round; /* optimal bufsz divisor */
unsigned int appbufsz; /* minimum buffer size */
int __pad[3]; /* for future use */
int __magic; /* for internal/debug purposes only */
};
@ -57,22 +57,22 @@ struct sio_cap {
#define SIO_NRATE 16
#define SIO_NCONF 4
struct sio_enc { /* allowed sample encodings */
unsigned bits;
unsigned bps;
unsigned sig;
unsigned le;
unsigned msb;
unsigned int bits;
unsigned int bps;
unsigned int sig;
unsigned int le;
unsigned int msb;
} enc[SIO_NENC];
unsigned rchan[SIO_NCHAN]; /* allowed values for rchan */
unsigned pchan[SIO_NCHAN]; /* allowed values for pchan */
unsigned rate[SIO_NRATE]; /* allowed rates */
unsigned int rchan[SIO_NCHAN]; /* allowed values for rchan */
unsigned int pchan[SIO_NCHAN]; /* allowed values for pchan */
unsigned int rate[SIO_NRATE]; /* allowed rates */
int __pad[7]; /* for future use */
unsigned nconf; /* number of elements in confs[] */
unsigned int nconf; /* number of elements in confs[] */
struct sio_conf {
unsigned enc; /* mask of enc[] indexes */
unsigned rchan; /* mask of chan[] indexes (rec) */
unsigned pchan; /* mask of chan[] indexes (play) */
unsigned rate; /* mask of rate[] indexes */
unsigned int enc; /* mask of enc[] indexes */
unsigned int rchan; /* mask of chan[] indexes (rec) */
unsigned int pchan; /* mask of chan[] indexes (play) */
unsigned int rate; /* mask of rate[] indexes */
} confs[SIO_NCONF];
};
@ -112,7 +112,7 @@ extern "C" {
struct pollfd;
void sio_initpar(struct sio_par *);
struct sio_hdl *sio_open(const char *, unsigned, int);
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 *);
@ -126,10 +126,10 @@ 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 sio_onvol(struct sio_hdl *, void (*)(void *, unsigned), void *);
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);
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);