# HG changeset patch # User tom@acousticscale.org # Date 1288111574 0 # Node ID 3b22559cd848f0f7dc6a74cb5bc17ee9c82660ef # Parent 733a11a65f3da9399add5eb10ddd4ed013df7991 - Fix bug where the fram period wasn't propagating to the output file. diff -r 733a11a65f3d -r 3b22559cd848 trunk/src/Modules/Features/ModuleGaussians.cc --- a/trunk/src/Modules/Features/ModuleGaussians.cc Tue Oct 26 04:48:56 2010 +0000 +++ b/trunk/src/Modules/Features/ModuleGaussians.cc Tue Oct 26 16:46:14 2010 +0000 @@ -96,6 +96,7 @@ LOG_ERROR(_T("Module ModuleGaussians not initialized.")); return; } + output_.set_start_time(input.start_time()); // Calculate spectral profile for (int ch = 0; ch < input.channel_count(); ++ch) { m_pSpectralProfile[ch] = 0.0f; diff -r 733a11a65f3d -r 3b22559cd848 trunk/src/Modules/Output/FileOutputHTK.cc --- a/trunk/src/Modules/Output/FileOutputHTK.cc Tue Oct 26 04:48:56 2010 +0000 +++ b/trunk/src/Modules/Output/FileOutputHTK.cc Tue Oct 26 16:46:14 2010 +0000 @@ -68,7 +68,7 @@ return false; } if (!header_written_) { - WriteHeader(channel_count_ * buffer_length_, frame_period_ms_); + WriteHeader(channel_count_ * buffer_length_); } return true; @@ -77,7 +77,7 @@ void FileOutputHTK::ResetInternal() { // Finalize and close the open file, if there is one. if (file_handle_ != NULL && !header_written_) { - WriteHeader(channel_count_ * buffer_length_, frame_period_ms_); + WriteHeader(channel_count_ * buffer_length_); } if (file_handle_ != NULL) CloseFile(); @@ -94,10 +94,10 @@ } sample_count_ = 0; header_written_ = false; - WriteHeader(channel_count_ * buffer_length_, frame_period_ms_); + WriteHeader(channel_count_ * buffer_length_); } -void FileOutputHTK::WriteHeader(int num_elements, float period_ms) { +void FileOutputHTK::WriteHeader(int num_elements) { if (header_written_) return; @@ -112,7 +112,7 @@ // To be filled in when the file is done int32_t sample_count = 0; - int32_t sample_period = floor(1e4 * period_ms); + int32_t sample_period = floor(1e4 * frame_period_ms_); int16_t sample_size = num_elements * sizeof(float); // NOLINT // User-defined coefficients with energy term @@ -170,12 +170,16 @@ // Write the first 4 bytes of the file // with how many samples there are in the file + // and the next 4 bytes with the frame period. fflush(file_handle_); rewind(file_handle_); fflush(file_handle_); int32_t samples = sample_count_; samples = ByteSwap32(samples); + int32_t sample_period = floor(1e4 * frame_period_ms_); + sample_period = ByteSwap32(sample_period); fwrite(&samples, sizeof(samples), 1, file_handle_); + fwrite(&sample_period, sizeof(sample_period), 1, file_handle_); // And close the file fclose(file_handle_); diff -r 733a11a65f3d -r 3b22559cd848 trunk/src/Modules/Output/FileOutputHTK.h --- a/trunk/src/Modules/Output/FileOutputHTK.h Tue Oct 26 04:48:56 2010 +0000 +++ b/trunk/src/Modules/Output/FileOutputHTK.h Tue Oct 26 16:46:14 2010 +0000 @@ -93,7 +93,7 @@ float ByteSwapFloat(float d); - void WriteHeader(int nelements, float sampPeriod); + void WriteHeader(int nelements); /*! \brief Whether initialization is done or not */