[BACK]Return to dev.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Annotation of src/usr.bin/aucat/dev.h, Revision 1.31

1.31    ! ratchov     1: /*     $OpenBSD: dev.h,v 1.30 2011/10/12 07:20:04 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.30      ratchov    38:        unsigned autostart;                     /* don't wait for MMC start */
1.24      ratchov    39:        unsigned refcnt;                        /* number of openers */
1.31    ! ratchov    40: #define DEV_NMAX       16                      /* max number of devices */
        !            41:        unsigned num;                           /* serial number */
1.24      ratchov    42: #define DEV_CLOSED     0                       /* closed */
                     43: #define DEV_INIT       1                       /* stopped */
                     44: #define DEV_START      2                       /* ready to start */
                     45: #define DEV_RUN                3                       /* started */
                     46:        unsigned pstate;                        /* on of DEV_xxx */
                     47:        char *path;                             /* sio path */
                     48:
                     49:        /*
                     50:         * actual parameters and runtime state (i.e. once opened)
                     51:         */
                     52:        unsigned mode;                          /* bitmap of MODE_xxx */
                     53:        unsigned bufsz, round, rate;
                     54:        struct aparams ipar, opar;
                     55:        struct aproc *mix, *sub, *submon;
                     56:        struct aproc *rec, *play, *mon;
                     57:        struct aproc *midi;
1.29      ratchov    58:        struct devctl {
                     59:                struct devctl *next;
                     60:                unsigned mode;
                     61:                char *path;
                     62:        } *ctl_list;
1.24      ratchov    63: };
                     64:
                     65: extern struct dev *dev_list;
                     66:
1.31    ! ratchov    67: void dev_dbg(struct dev *);
1.30      ratchov    68: int  dev_init(struct dev *);
1.24      ratchov    69: int  dev_run(struct dev *);
                     70: int  dev_ref(struct dev *);
                     71: void dev_unref(struct dev *);
                     72: void dev_del(struct dev *);
                     73: void dev_wakeup(struct dev *);
1.26      ratchov    74: void dev_drain(struct dev *);
1.30      ratchov    75: struct dev *dev_new(char *, unsigned, unsigned, unsigned, unsigned, unsigned);
                     76: void dev_adjpar(struct dev *, unsigned, struct aparams *, struct aparams *);
1.29      ratchov    77: int  devctl_add(struct dev *, char *, unsigned);
1.24      ratchov    78: void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
                     79: unsigned dev_roundof(struct dev *, unsigned);
                     80: int dev_getpos(struct dev *);
                     81: void dev_attach(struct dev *, char *, unsigned,
1.21      ratchov    82:     struct abuf *, struct aparams *, unsigned,
                     83:     struct abuf *, struct aparams *, unsigned,
                     84:     unsigned, int);
1.24      ratchov    85: void dev_setvol(struct dev *, struct abuf *, int);
1.1       ratchov    86:
                     87: #endif /* !define(DEV_H) */