Edinburgh Speech Tools 2.4-release
 
Loading...
Searching...
No Matches
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
50typedef 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 wff_alaw
62} EST_WaveFileType;
63
65public:
66
67 // We have to use #defines for what should be done with just
68 // typedefs because Sun CC thinks you shouldn't be allowed to
69 // declare a member function via a typedef.
70
71#define LoadWaveFileArgs const EST_String filename, \
72 EST_Wave &wv, \
73 int rate, EST_sample_type_t stype, \
74 int bo, int nc, \
75 int offset, int length
76
77#define SaveWaveFileArgs const EST_String filename, \
78 const EST_Wave &wv, \
79 EST_sample_type_t stype, int bo
80
81#define LoadWave_TokenStreamArgs EST_TokenStream &ts, \
82 EST_Wave &wv, \
83 int rate, EST_sample_type_t stype, \
84 int bo, int nc, \
85 int offset, int length
86
87#define SaveWave_TokenStreamArgs FILE *fp, \
88 const EST_Wave &wv, \
89 EST_sample_type_t stype, int bo
90
91 typedef EST_read_status Load_TokenStream(LoadWave_TokenStreamArgs);
92
93 typedef EST_write_status Save_TokenStream(SaveWave_TokenStreamArgs);
94
95 typedef struct Info {
96 bool recognise;
97 Load_TokenStream *load;
98 Save_TokenStream *save;
99 Save_TokenStream *save_header;
100 Save_TokenStream *save_data;
101 const char *description;
102 } Info;
103
104 static EST_write_status save_nist(SaveWave_TokenStreamArgs);
105 static EST_write_status save_nist_header(SaveWave_TokenStreamArgs);
106 static EST_write_status save_nist_data(SaveWave_TokenStreamArgs);
107 static EST_read_status load_nist(LoadWave_TokenStreamArgs);
108
109 static EST_write_status save_est(SaveWave_TokenStreamArgs);
110 static EST_write_status save_est_header(SaveWave_TokenStreamArgs);
111 static EST_write_status save_est_data(SaveWave_TokenStreamArgs);
112 static EST_read_status load_est(LoadWave_TokenStreamArgs);
113
114 static EST_write_status save_esps(SaveWave_TokenStreamArgs);
115 static EST_write_status save_esps_header(SaveWave_TokenStreamArgs);
116 static EST_write_status save_esps_data(SaveWave_TokenStreamArgs);
117 static EST_read_status load_esps(LoadWave_TokenStreamArgs);
118
119 static EST_write_status save_audlab(SaveWave_TokenStreamArgs);
120 static EST_write_status save_audlab_header(SaveWave_TokenStreamArgs);
121 static EST_write_status save_audlab_data(SaveWave_TokenStreamArgs);
122 static EST_read_status load_audlab(LoadWave_TokenStreamArgs);
123
124 static EST_write_status save_snd(SaveWave_TokenStreamArgs);
125 static EST_write_status save_snd_header(SaveWave_TokenStreamArgs);
126 static EST_write_status save_snd_data(SaveWave_TokenStreamArgs);
127 static EST_read_status load_snd(LoadWave_TokenStreamArgs);
128
129 static EST_write_status save_aiff(SaveWave_TokenStreamArgs);
130 static EST_write_status save_aiff_header(SaveWave_TokenStreamArgs);
131 static EST_write_status save_aiff_data(SaveWave_TokenStreamArgs);
132 static EST_read_status load_aiff(LoadWave_TokenStreamArgs);
133
134 static EST_write_status save_riff(SaveWave_TokenStreamArgs);
135 static EST_write_status save_riff_header(SaveWave_TokenStreamArgs);
136 static EST_write_status save_riff_data(SaveWave_TokenStreamArgs);
137 static EST_read_status load_riff(LoadWave_TokenStreamArgs);
138
139 static EST_write_status save_raw(SaveWave_TokenStreamArgs);
140 static EST_write_status save_raw_header(SaveWave_TokenStreamArgs);
141 static EST_write_status save_raw_data(SaveWave_TokenStreamArgs);
142 static EST_read_status load_raw(LoadWave_TokenStreamArgs);
143
144 static EST_write_status save_ulaw(SaveWave_TokenStreamArgs);
145 static EST_write_status save_ulaw_header(SaveWave_TokenStreamArgs);
146 static EST_write_status save_ulaw_data(SaveWave_TokenStreamArgs);
147 static EST_read_status load_ulaw(LoadWave_TokenStreamArgs);
148
149 static EST_write_status save_alaw(SaveWave_TokenStreamArgs);
150 static EST_write_status save_alaw_header(SaveWave_TokenStreamArgs);
151 static EST_write_status save_alaw_data(SaveWave_TokenStreamArgs);
152 static EST_read_status load_alaw(LoadWave_TokenStreamArgs);
153
155
156 static EST_String options_supported(void);
157 static EST_String options_short(void);
158};
159
160#endif