diff trunk/src/Modules/Output/FileOutputHTK.cc @ 292:10d0803e37ec

-Added a module to scale output values by the channel centre frequency -Fixed file input to support loading and processing of multiple files -Updated the aimc main file to generate profiles like in the recognition experiments
author tomwalters
date Mon, 22 Feb 2010 17:51:27 +0000
parents 6cf55200a199
children aeac9e2151c6
line wrap: on
line diff
--- a/trunk/src/Modules/Output/FileOutputHTK.cc	Mon Feb 22 12:45:05 2010 +0000
+++ b/trunk/src/Modules/Output/FileOutputHTK.cc	Mon Feb 22 17:51:27 2010 +0000
@@ -69,6 +69,9 @@
   sample_count_ = 0;
   frame_period_ms_ = frame_period_ms;
   header_written_ = false;
+  if (initialized_) {
+    WriteHeader(channel_count_ * buffer_length_, frame_period_ms_);
+  }
   return true;
 }
 
@@ -79,7 +82,7 @@
     return false;
   }
   if (header_written_) {
-    LOG_ERROR(_T("A header has already been written on the output file."
+    LOG_ERROR(_T("A header has already been written on the output file. "
                  "Please call FileOutputHTK::CloseFile to close that file, "
                  "and FileOutputHTK::OpenFile to open an new one before "
                  "calling FileOutputHTK::Initialize again."));
@@ -95,6 +98,8 @@
   if (file_handle_ != NULL && !header_written_) {
     WriteHeader(channel_count_ * buffer_length_, frame_period_ms_);
   }
+  if (file_handle_ != NULL)
+    CloseFile();
 }
 
 void FileOutputHTK::WriteHeader(int num_elements, float period_ms) {
@@ -144,7 +149,7 @@
   }
 
   if (!header_written_) {
-    LOG_ERROR(_T("No header has been written on the output file yet. Please"
+    LOG_ERROR(_T("No header has been written on the output file yet. Please "
                  "call FileOutputHTK::Initialize() before calling "
                  "FileOutputHTK::Process()"));
     return;
@@ -177,6 +182,7 @@
   // And close the file
   fclose(file_handle_);
   file_handle_ = NULL;
+  header_written_ = false;
   return true;
 }