• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*----------------------------------------------------------------------------
2  *
3  * File:
4  * eas_wave.h
5  *
6  * Contents and purpose:
7  * Writes output to a .WAV file
8  *
9  * DO NOT MODIFY THIS FILE!
10  *
11  * Copyright Sonic Network Inc. 2005
12 
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  *      http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *----------------------------------------------------------------------------
25  * Revision Control:
26  *   $Revision: 82 $
27  *   $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
28  *----------------------------------------------------------------------------
29 */
30 
31 #include "eas_types.h"
32 
33 /* sentinel */
34 #ifndef _EAS_WAVE_H
35 #define _EAS_WAVE_H
36 
37 /* .WAV file format chunk */
38 typedef struct {
39     EAS_U16 wFormatTag;
40     EAS_U16 nChannels;
41     EAS_U32 nSamplesPerSec;
42     EAS_U32 nAvgBytesPerSec;
43     EAS_U16 nBlockAlign;
44     EAS_U16 wBitsPerSample;
45 } FMT_CHUNK;
46 
47 /* .WAV file header */
48 typedef struct {
49     EAS_U32 nRiffTag;
50     EAS_U32 nRiffSize;
51     EAS_U32 nWaveTag;
52     EAS_U32 nFmtTag;
53     EAS_U32 nFmtSize;
54     FMT_CHUNK fc;
55     EAS_U32 nDataTag;
56     EAS_U32 nDataSize;
57 } WAVE_HEADER;
58 
59 typedef struct {
60     WAVE_HEADER wh;
61     FILE *file;
62     EAS_BOOL write;
63     EAS_U32 dataSize;
64 } WAVE_FILE;
65 
66 WAVE_FILE *WaveFileCreate (const char *filename, EAS_I32 nChannels, EAS_I32 nSamplesPerSec, EAS_I32 wBitsPerSample);
67 EAS_I32 WaveFileWrite (WAVE_FILE *wFile, void *buffer, EAS_I32 n);
68 EAS_BOOL WaveFileClose (WAVE_FILE *wFile);
69 WAVE_FILE *WaveFileOpen (const char *filename);
70 
71 #endif /* end #ifndef _EAS_WAVE_H */
72 
73 
74 
75