Annotation of src/usr.bin/aucat/dev.h, Revision 1.27
1.27 ! ratchov 1: /* $OpenBSD: dev.h,v 1.26 2010/06/25 07:32:05 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 ? */
37: unsigned refcnt; /* number of openers */
38: #define DEV_CLOSED 0 /* closed */
39: #define DEV_INIT 1 /* stopped */
40: #define DEV_START 2 /* ready to start */
41: #define DEV_RUN 3 /* started */
42: unsigned pstate; /* on of DEV_xxx */
43: char *path; /* sio path */
44:
45: /*
46: * actual parameters and runtime state (i.e. once opened)
47: */
48: unsigned mode; /* bitmap of MODE_xxx */
49: unsigned bufsz, round, rate;
50: struct aparams ipar, opar;
51: struct aproc *mix, *sub, *submon;
52: struct aproc *rec, *play, *mon;
53: struct aproc *midi;
54: };
55:
56: extern struct dev *dev_list;
57:
58: int dev_run(struct dev *);
59: int dev_ref(struct dev *);
60: void dev_unref(struct dev *);
61: void dev_del(struct dev *);
62: void dev_wakeup(struct dev *);
1.26 ratchov 63: void dev_drain(struct dev *);
1.24 ratchov 64: struct dev *dev_new_thru(void);
65: struct dev *dev_new_loop(struct aparams *, struct aparams *, unsigned);
66: struct dev *dev_new_sio(char *, unsigned,
1.25 ratchov 67: struct aparams *, struct aparams *, unsigned, unsigned, unsigned);
1.24 ratchov 68: int dev_thruadd(struct dev *, char *, int, int);
69: void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
70: unsigned dev_roundof(struct dev *, unsigned);
71: int dev_getpos(struct dev *);
72: void dev_attach(struct dev *, char *, unsigned,
1.21 ratchov 73: struct abuf *, struct aparams *, unsigned,
74: struct abuf *, struct aparams *, unsigned,
75: unsigned, int);
1.24 ratchov 76: void dev_setvol(struct dev *, struct abuf *, int);
1.1 ratchov 77:
78: #endif /* !define(DEV_H) */