Mercurial > hg > aimc
comparison trunk/src/Modules/Output/FileOutputHTK.cc @ 280:e55d0c225a57
- Lots of changes to make cpplint happy. It still complains about header guards, but that's pretty much it now.
author | tomwalters |
---|---|
date | Thu, 18 Feb 2010 21:12:41 +0000 |
parents | f469d936337f |
children | 6cf55200a199 |
comparison
equal
deleted
inserted
replaced
279:f469d936337f | 280:e55d0c225a57 |
---|---|
25 * \date created 2006/10/30 | 25 * \date created 2006/10/30 |
26 * \version \$Id$ | 26 * \version \$Id$ |
27 */ | 27 */ |
28 | 28 |
29 #ifdef _WINDOWS | 29 #ifdef _WINDOWS |
30 # include <direct.h> // for _mkdir&_rmdir | 30 # include <direct.h> // for _mkdir&_rmdir |
31 #else | 31 #else |
32 # include <sys/types.h> | 32 # include <sys/types.h> |
33 # include <dirent.h> // for opendir&friends | 33 # include <dirent.h> // for opendir&friends |
34 #endif | 34 #endif |
35 #include <stdio.h> | 35 #include <stdio.h> |
36 #include <string.h> | 36 #include <string.h> |
37 #include <cmath> | 37 #include <cmath> |
38 | 38 |
61 LOG_ERROR(_T("Couldn't open output file. A file is already open.")); | 61 LOG_ERROR(_T("Couldn't open output file. A file is already open.")); |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 // Check that the output file exists and is writeable | 65 // Check that the output file exists and is writeable |
66 if ((file_handle_ = fopen(filename, "wb"))==NULL ) { | 66 if ((file_handle_ = fopen(filename, "wb")) == NULL) { |
67 LOG_ERROR(_T("Couldn't open output file '%s' for writing."), filename); | 67 LOG_ERROR(_T("Couldn't open output file '%s' for writing."), filename); |
68 return false; | 68 return false; |
69 } | 69 } |
70 strcpy(filename_, filename); | 70 strcpy(filename_, filename); |
71 sample_count_ = 0; | 71 sample_count_ = 0; |
155 | 155 |
156 for (int ch = 0; ch < input.channel_count(); ch++) { | 156 for (int ch = 0; ch < input.channel_count(); ch++) { |
157 for (int i = 0; i < input.buffer_length(); i++) { | 157 for (int i = 0; i < input.buffer_length(); i++) { |
158 s = input.sample(ch, i); | 158 s = input.sample(ch, i); |
159 s = ByteSwapFloat(s); | 159 s = ByteSwapFloat(s); |
160 fwrite(&s, sizeof(float), 1, file_handle_); | 160 fwrite(&s, sizeof(s), 1, file_handle_); |
161 } | 161 } |
162 } | 162 } |
163 sample_count_++; | 163 sample_count_++; |
164 } | 164 } |
165 | 165 |
193 dst[2] = src[1]; | 193 dst[2] = src[1]; |
194 dst[3] = src[0]; | 194 dst[3] = src[0]; |
195 | 195 |
196 return a; | 196 return a; |
197 } | 197 } |
198 } //namespace aimc | 198 } // namespace aimc |
199 | 199 |