Annotation of src/usr.bin/aucat/wav.h, Revision 1.13
1.13 ! ratchov 1: /* $OpenBSD: wav.h,v 1.12 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 WAV_H
18: #define WAV_H
19:
20: #include <sys/types.h>
21:
1.4 ratchov 22: #include "aparams.h"
1.1 ratchov 23: #include "pipe.h"
24:
25: struct wav {
26: struct pipe pipe;
1.12 ratchov 27: struct wav *next;
1.1 ratchov 28: #define HDR_AUTO 0 /* guess by looking at the file name */
29: #define HDR_RAW 1 /* no headers, ie openbsd native ;-) */
30: #define HDR_WAV 2 /* microsoft riff wave */
1.13 ! ratchov 31: unsigned int hdr; /* HDR_RAW or HDR_WAV */
! 32: unsigned int xrun; /* xrun policy */
1.1 ratchov 33: struct aparams hpar; /* parameters to write on the header */
34: off_t rbytes; /* bytes to read, -1 if no limit */
35: off_t wbytes; /* bytes to write, -1 if no limit */
1.8 ratchov 36: off_t startpos; /* beginning of the data chunk */
37: off_t endpos; /* end of the data chunk */
38: off_t mmcpos; /* play/rec start point set by MMC */
1.3 ratchov 39: short *map; /* mulaw/alaw -> s16 conversion table */
1.8 ratchov 40: int slot; /* mixer ctl slot number */
1.10 ratchov 41: int mmc; /* use MMC control */
1.9 ratchov 42: int join; /* join/expand channels */
1.13 ! ratchov 43: unsigned int vol; /* current volume */
! 44: unsigned int maxweight; /* dynamic range when vol == 127 */
1.12 ratchov 45: #define WAV_CFG 0 /* parameters read from headers */
46: #define WAV_INIT 1 /* not trying to do anything */
47: #define WAV_START 2 /* buffer allocated */
48: #define WAV_READY 3 /* buffer filled enough */
49: #define WAV_RUN 4 /* buffer attached to device */
50: #define WAV_MIDI 5 /* midi "syx" file */
1.13 ! ratchov 51: unsigned int pstate; /* one of above */
! 52: unsigned int mode; /* bitmap of MODE_* */
1.10 ratchov 53: struct dev *dev; /* device playing or recording */
1.1 ratchov 54: };
55:
56: extern struct fileops wav_ops;
1.12 ratchov 57: struct wav *wav_list;
1.1 ratchov 58:
1.10 ratchov 59: struct wav *wav_new_in(struct fileops *, struct dev *,
1.13 ! ratchov 60: unsigned int, char *, unsigned int, struct aparams *,
! 61: unsigned int, unsigned int, int, int);
1.10 ratchov 62: struct wav *wav_new_out(struct fileops *, struct dev *,
1.13 ! ratchov 63: unsigned int, char *, unsigned int, struct aparams *,
! 64: unsigned int, int, int);
! 65: unsigned int wav_read(struct file *, unsigned char *, unsigned int);
! 66: unsigned int wav_write(struct file *, unsigned char *, unsigned int);
1.1 ratchov 67: void wav_close(struct file *);
1.8 ratchov 68: int wav_readhdr(int, struct aparams *, off_t *, off_t *, short **);
69: int wav_writehdr(int, struct aparams *, off_t *, off_t);
1.13 ! ratchov 70: void wav_conv(unsigned char *, unsigned int, short *);
1.12 ratchov 71: int wav_init(struct wav *);
1.3 ratchov 72:
73: extern short wav_ulawmap[256];
74: extern short wav_alawmap[256];
1.1 ratchov 75:
76: #endif /* !defined(WAV_H) */