diff options
Diffstat (limited to 'usr.bin/aucat/dev.h')
-rw-r--r-- | usr.bin/aucat/dev.h | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/usr.bin/aucat/dev.h b/usr.bin/aucat/dev.h index 0e0f83ca198..62ad96b074e 100644 --- a/usr.bin/aucat/dev.h +++ b/usr.bin/aucat/dev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.h,v 1.23 2010/05/08 15:35:45 ratchov Exp $ */ +/* $OpenBSD: dev.h,v 1.24 2010/06/04 06:15:28 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -21,30 +21,58 @@ struct aproc; struct aparams; struct abuf; -extern unsigned dev_reqprime; -extern unsigned dev_bufsz, dev_round, dev_rate; -extern struct aparams dev_ipar, dev_opar; -extern struct aproc *dev_mix, *dev_sub, *dev_midi, *dev_submon, *dev_mon; +struct dev { + struct dev *next; -int dev_run(void); -int dev_open(void); -void dev_close(void); -int dev_ref(void); -void dev_unref(void); -void dev_done(void); -void dev_wakeup(void); -void dev_init_thru(void); -void dev_init_loop(struct aparams *, struct aparams *, unsigned); -void dev_init_sio(char *, unsigned, - struct aparams *, struct aparams *, unsigned, unsigned); -int dev_thruadd(char *, int, int); -void dev_midiattach(struct abuf *, struct abuf *); -unsigned dev_roundof(unsigned); -int dev_getpos(void); -void dev_attach(char *, unsigned, + /* + * desired parameters + */ + unsigned reqmode; /* mode */ + struct aparams reqipar, reqopar; /* parameters */ + unsigned reqbufsz; /* buffer size */ + unsigned reqround; /* block size */ + unsigned reqrate; /* sample rate */ + unsigned prime; /* prime play buffer? */ + unsigned hold; /* hold the device open ? */ + unsigned refcnt; /* number of openers */ +#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 */ + char *path; /* sio path */ + + /* + * actual parameters and runtime state (i.e. once opened) + */ + unsigned mode; /* bitmap of MODE_xxx */ + unsigned bufsz, round, rate; + struct aparams ipar, opar; + struct aproc *mix, *sub, *submon; + struct aproc *rec, *play, *mon; + struct aproc *midi; +}; + +extern struct dev *dev_list; + +int dev_run(struct dev *); +int dev_ref(struct dev *); +void dev_unref(struct dev *); +void dev_del(struct dev *); +void dev_wakeup(struct dev *); +struct dev *dev_new_thru(void); +struct dev *dev_new_loop(struct aparams *, struct aparams *, unsigned); +struct dev *dev_new_sio(char *, unsigned, + struct aparams *, struct aparams *, unsigned, unsigned, + unsigned, unsigned); +int dev_thruadd(struct dev *, char *, int, int); +void dev_midiattach(struct dev *, struct abuf *, struct abuf *); +unsigned dev_roundof(struct dev *, unsigned); +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_setvol(struct abuf *, int); +void dev_setvol(struct dev *, struct abuf *, int); #endif /* !define(DEV_H) */ |