| 1 | /* $Id: ulaw.h,v 1.3 1999/03/10 07:58:05 boyns Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (C) 1993-99 Mark R. Boyns <[email protected]> |
| 5 | * |
| 6 | * This file is part of rplay. |
| 7 | * |
| 8 | * rplay is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * rplay is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with rplay; see the file COPYING. If not, write to the |
| 20 | * Free Software Foundation, Inc., |
| 21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
| 22 | */ |
| 23 | |
| 24 | |
| 25 | |
| 26 | #ifndef _ulaw_h |
| 27 | #define _ulaw_h |
| 28 | |
| 29 | #ifdef HAVE_CONFIG_H |
| 30 | #include "config.h" |
| 31 | #endif |
| 32 | |
| 33 | /* |
| 34 | * ulaw formats |
| 35 | */ |
| 36 | #define ULAW_MULAW_8 1 /* 8-bit ISDN u-law (CCITT G.711) */ |
| 37 | #define ULAW_LINEAR_8 2 /* 8-bit linear PCM */ |
| 38 | #define ULAW_LINEAR_16 3 /* 16-bit linear PCM */ |
| 39 | #define ULAW_LINEAR_24 4 /* 24-bit linear PCM */ |
| 40 | #define ULAW_LINEAR_32 5 /* 32-bit linear PCM */ |
| 41 | #define ULAW_LINEAR_FLOAT 6 /* 32-bit IEEE floating point */ |
| 42 | #define ULAW_LINEAR_DOUBLE 7 /* 64-bit IEEE floating point */ |
| 43 | #define ULAW_G721 23 /* CCITT G.721 4-bits ADPCM */ |
| 44 | #define ULAW_G723_3 25 /* CCITT G.723 3-bits ADPCM */ |
| 45 | #define ULAW_G723_5 26 /* CCITT G.723 5-bits ADPCM */ |
| 46 | #define ULAW_MAGIC 0x2e736e64 /* ".snd" ulaw file header */ |
| 47 | #define ULAW_HDRSIZE 24 /* minimum ulaw header size */ |
| 48 | |
| 49 | extern short _ulaw2linear[]; |
| 50 | extern unsigned char *_linear2ulaw; |
| 51 | |
| 52 | #define ulaw_to_linear(ulaw8) (_ulaw2linear[(unsigned char)(ulaw8)]) |
| 53 | #define linear_to_ulaw(lin16) (_linear2ulaw[(short)(lin16) >> 3]) |
| 54 | |
| 55 | #if 0 |
| 56 | #ifdef __STDC__ |
| 57 | extern unsigned char st_linear_to_ulaw (int sample); |
| 58 | extern int st_ulaw_to_linear (unsigned char ulawbyte); |
| 59 | #else |
| 60 | extern unsigned char st_linear_to_ulaw ( /* int sample */ ); |
| 61 | extern int st_ulaw_to_linear ( /* unsigned char ulawbyte */ ); |
| 62 | #endif |
| 63 | #endif |
| 64 | |
| 65 | #endif /* _ulaw_h */ |