Annotation of src/usr.bin/aucat/dev.h, Revision 1.28
1.28 ! ratchov 1: /* $OpenBSD: dev.h,v 1.27 2010/07/06 01:12:45 ratchov Exp $ */
1.1 ratchov 2: /*
3: * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17: #ifndef DEV_H
18: #define DEV_H
19:
1.27 ratchov 20: #include "aparams.h"
21:
1.2 ratchov 22: struct aproc;
23: struct abuf;
1.1 ratchov 24:
1.24 ratchov 25: struct dev {
26: struct dev *next;
27:
28: /*
29: * desired parameters
30: */
31: unsigned reqmode; /* mode */
32: struct aparams reqipar, reqopar; /* parameters */
33: unsigned reqbufsz; /* buffer size */
34: unsigned reqround; /* block size */
35: unsigned reqrate; /* sample rate */
36: unsigned hold; /* hold the device open ? */
1.28 ! ratchov 37: unsigned autovol; /* auto adjust playvol ? */
1.24 ratchov 38: unsigned refcnt; /* number of openers */
39: #define DEV_CLOSED 0 /* closed */
40: #define DEV_INIT 1 /* stopped */
41: #define DEV_START 2 /* ready to start */
42: #define DEV_RUN 3 /* started */
43: unsigned pstate; /* on of DEV_xxx */
44: char *path; /* sio path */
45:
46: /*
47: * actual parameters and runtime state (i.e. once opened)
48: */
49: unsigned mode; /* bitmap of MODE_xxx */
50: unsigned bufsz, round, rate;
51: struct aparams ipar, opar;
52: struct aproc *mix, *sub, *submon;
53: struct aproc *rec, *play, *mon;
54: struct aproc *midi;
55: };
56:
57: extern struct dev *dev_list;
58:
59: int dev_run(struct dev *);
60: int dev_ref(struct dev *);
61: void dev_unref(struct dev *);
62: void dev_del(struct dev *);
63: void dev_wakeup(struct dev *);
1.26 ratchov 64: void dev_drain(struct dev *);
1.24 ratchov 65: struct dev *dev_new_thru(void);
66: struct dev *dev_new_loop(struct aparams *, struct aparams *, unsigned);
67: struct dev *dev_new_sio(char *, unsigned,
1.28 ! ratchov 68: struct aparams *, struct aparams *,
! 69: unsigned, unsigned, unsigned, unsigned);
1.24 ratchov 70: int dev_thruadd(struct dev *, char *, int, int);
71: void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
72: unsigned dev_roundof(struct dev *, unsigned);
73: int dev_getpos(struct dev *);
74: void dev_attach(struct dev *, char *, unsigned,
1.21 ratchov 75: struct abuf *, struct aparams *, unsigned,
76: struct abuf *, struct aparams *, unsigned,
77: unsigned, int);
1.24 ratchov 78: void dev_setvol(struct dev *, struct abuf *, int);
1.1 ratchov 79:
80: #endif /* !define(DEV_H) */