Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_WaveFile.h
1  /************************************************************************/
2  /* */
3  /* Centre for Speech Technology Research */
4  /* University of Edinburgh, UK */
5  /* Copyright (c) 1996,1997 */
6  /* All Rights Reserved. */
7  /* */
8  /* Permission is hereby granted, free of charge, to use and distribute */
9  /* this software and its documentation without restriction, including */
10  /* without limitation the rights to use, copy, modify, merge, publish, */
11  /* distribute, sublicense, and/or sell copies of this work, and to */
12  /* permit persons to whom this work is furnished to do so, subject to */
13  /* the following conditions: */
14  /* 1. The code must retain the above copyright notice, this list of */
15  /* conditions and the following disclaimer. */
16  /* 2. Any modifications must be clearly marked as such. */
17  /* 3. Original authors' names are not deleted. */
18  /* 4. The authors' names are not used to endorse or promote products */
19  /* derived from this software without specific prior written */
20  /* permission. */
21  /* */
22  /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23  /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24  /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25  /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26  /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27  /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28  /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29  /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30  /* THIS SOFTWARE. */
31  /* */
32  /*************************************************************************/
33  /* */
34  /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */
35  /* -------------------------------------------------------------------- */
36  /* Wave file formats known to the speech tools. */
37  /* */
38  /*************************************************************************/
39 
40 #ifndef __EST_WAVEFILE_H__
41 #define __EST_WAVEFILE_H__
42 
43 #include "EST_TNamedEnum.h"
44 #include "EST_String.h"
45 #include "EST_Token.h"
46 #include "EST_rw_status.h"
47 #include "EST_Wave.h"
48 #include "EST_wave_aux.h"
49 
50 typedef enum EST_WaveFileType{
51  wff_none,
52  wff_nist,
53  wff_esps,
54  wff_est,
55  wff_audlab,
56  wff_snd,
57  wff_aiff,
58  wff_riff,
59  wff_raw,
60  wff_ulaw
61 } EST_WaveFileType;
62 
63 class EST_WaveFile {
64 public:
65 
66  // We have to use #defines for what should be done with just
67  // typedefs because Sun CC thinks you shouldn't be allowed to
68  // declare a member function via a typedef.
69 
70 #define LoadWaveFileArgs const EST_String filename, \
71  EST_Wave &wv, \
72  int rate, EST_sample_type_t stype, \
73  int bo, int nc, \
74  int offset, int length
75 
76 #define SaveWaveFileArgs const EST_String filename, \
77  const EST_Wave &wv, \
78  EST_sample_type_t stype, int bo
79 
80 #define LoadWave_TokenStreamArgs EST_TokenStream &ts, \
81  EST_Wave &wv, \
82  int rate, EST_sample_type_t stype, \
83  int bo, int nc, \
84  int offset, int length
85 
86 #define SaveWave_TokenStreamArgs FILE *fp, \
87  const EST_Wave &wv, \
88  EST_sample_type_t stype, int bo
89 
90  typedef EST_read_status Load_TokenStream(LoadWave_TokenStreamArgs);
91 
92  typedef EST_write_status Save_TokenStream(SaveWave_TokenStreamArgs);
93 
94  typedef struct Info {
95  bool recognise;
96  Load_TokenStream *load;
97  Save_TokenStream *save;
98  const char *description;
99  } Info;
100 
101  static EST_write_status save_nist(SaveWave_TokenStreamArgs);
102  static EST_read_status load_nist(LoadWave_TokenStreamArgs);
103 
104  static EST_write_status save_est(SaveWave_TokenStreamArgs);
105  static EST_read_status load_est(LoadWave_TokenStreamArgs);
106 
107  static EST_write_status save_esps(SaveWave_TokenStreamArgs);
108  static EST_read_status load_esps(LoadWave_TokenStreamArgs);
109 
110  static EST_write_status save_audlab(SaveWave_TokenStreamArgs);
111  static EST_read_status load_audlab(LoadWave_TokenStreamArgs);
112 
113  static EST_write_status save_snd(SaveWave_TokenStreamArgs);
114  static EST_read_status load_snd(LoadWave_TokenStreamArgs);
115 
116  static EST_write_status save_aiff(SaveWave_TokenStreamArgs);
117  static EST_read_status load_aiff(LoadWave_TokenStreamArgs);
118 
119  static EST_write_status save_riff(SaveWave_TokenStreamArgs);
120  static EST_read_status load_riff(LoadWave_TokenStreamArgs);
121 
122  static EST_write_status save_raw(SaveWave_TokenStreamArgs);
123  static EST_read_status load_raw(LoadWave_TokenStreamArgs);
124 
125  static EST_write_status save_ulaw(SaveWave_TokenStreamArgs);
126  static EST_read_status load_ulaw(LoadWave_TokenStreamArgs);
127 
129 
130  static EST_String options_supported(void);
131  static EST_String options_short(void);
132 };
133 
134 #endif