1 #if 0 2 /*____________________________________________________________________________ 3 4 FreeAmp - The Free MP3 Player 5 6 MP3 Decoder originally Copyright (C) 1995-1997 Xing Technology 7 Corp. http://www.xingtech.com 8 9 Portions Copyright (C) 1998-1999 EMusic.com 10 11 This program is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation; either version 2 of the License, or 14 (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 25 $Id: wavep.c,v 1.3 1999/10/19 07:13:09 elrod Exp $ 26 ____________________________________________________________________________*/ 27 28 /*---- wavep.c -------------------------------------------- 29 30 WAVE FILE HEADER ROUTINES 31 with conditional pcm conversion to MS wave format 32 portable version 33 34 -----------------------------------------------------------*/ 35 #include <stdlib.h> 36 #include <stdio.h> 37 #include <float.h> 38 #include <math.h> 39 #ifdef WIN32 40 #include <io.h> 41 #else 42 #include <unistd.h> 43 #endif 44 #include "port.h" 45 46 typedef struct 47 { 48 unsigned char riff[4]; 49 unsigned char size[4]; 50 unsigned char wave[4]; 51 unsigned char fmt[4]; 52 unsigned char fmtsize[4]; 53 unsigned char tag[2]; 54 unsigned char nChannels[2]; 55 unsigned char nSamplesPerSec[4]; 56 unsigned char nAvgBytesPerSec[4]; 57 unsigned char nBlockAlign[2]; 58 unsigned char nBitsPerSample[2]; 59 unsigned char data[4]; 60 unsigned char pcm_bytes[4]; 61 } 62 BYTE_WAVE; 63 64 static const BYTE_WAVE wave = 65 { 66 "RIFF", 67 {(sizeof(BYTE_WAVE) - 8), 0, 0, 0}, 68 "WAVE", 69 "fmt ", 70 {16, 0, 0, 0}, 71 {1, 0}, 72 {1, 0}, 73 {34, 86, 0, 0}, /* 86 * 256 + 34 = 22050 */ 74 {172, 68, 0, 0}, /* 172 * 256 + 68 = 44100 */ 75 {2, 0}, 76 {16, 0}, 77 "data", 78 {0, 0, 0, 0} 79 }; 80 81 /*---------------------------------------------------------------- 82 pcm conversion to wave format 83 84 This conversion code required for big endian machine, or, 85 if sizeof(short) != 16 bits. 86 Conversion routines may be used on any machine, but if 87 not required, the do nothing macros in port.h can be used instead 88 to reduce overhead. 89 90 -----------------------------------------------------------------*/ 91 #ifndef LITTLE_SHORT16 92 #include "wcvt.c" 93 #endif 94 /*-----------------------------------------------*/ 95 #endif 96