1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 #ifndef BZF_WAVE 14 #define BZF_WAVE 15 16 #include <stdio.h> 17 18 /* A very simple wav file reader */ 19 20 #define WAV_FORMAT_UNKNOWN (0x0000) 21 #define WAV_FORMAT_PCM (0x0001) 22 #define WAV_FORMAT_ADPCM (0x0002) 23 #define WAV_FORMAT_ALAW (0x0006) 24 #define WAV_FORMAT_MULAW (0x0007) 25 #define WAV_FORMAT_OKI_ADPCM (0x0010) 26 #define WAV_FORMAT_DIGISTD (0x0015) 27 #define WAV_FORMAT_DIGIFIX (0x0016) 28 #define IBM_FORMAT_MULAW (0x0101) 29 #define IBM_FORMAT_ALAW (0x0102) 30 #define IBM_FORMAT_ADPCM (0x0103) 31 32 /* 33 Open the given filename as a wav file. Read the header and return the 34 parameters in the rest of the arguments. 35 Returns an open FILE if successful or NULL for error. 36 */ 37 FILE* openWavFile(const char *filename, short *format, long *speed, 38 int *numFrames, short *numChannels, short *width); 39 /* 40 Close the given wave file. 41 */ 42 void closeWavFile(FILE*); 43 44 /* 45 Read the len bytes of wave file into the allocated data area. 46 numSamples should be (*numFrames) * (*numChannels). 47 Return 0 if successful or -1 for error. 48 */ 49 int readWavData(FILE*, char *data, int numSamples, int width); 50 51 #endif 52 53 54 // Local Variables: *** 55 // mode: C++ *** 56 // tab-width: 4 *** 57 // c-basic-offset: 4 *** 58 // indent-tabs-mode: nil *** 59 // End: *** 60 // ex: shiftwidth=4 tabstop=4 61