comparison trunk/src/Modules/Output/FileOutputHTK.h @ 402:69466da9745e

- Massive refactoring to make module tree stuff work. In theory we now support configuration files again. The graphics stuff is untested as yet.
author tomwalters
date Mon, 18 Oct 2010 04:42:28 +0000
parents 30dde71d0230
children 3b22559cd848
comparison
equal deleted inserted replaced
401:b71ec2cbe55b 402:69466da9745e
26 */ 26 */
27 27
28 #ifndef AIMC_MODULES_OUTPUT_HTK_H_ 28 #ifndef AIMC_MODULES_OUTPUT_HTK_H_
29 #define AIMC_MODULES_OUTPUT_HTK_H_ 29 #define AIMC_MODULES_OUTPUT_HTK_H_
30 30
31 #include <string>
32
31 #include "Support/Module.h" 33 #include "Support/Module.h"
32 #include "Support/SignalBank.h" 34 #include "Support/SignalBank.h"
33 35
34 // Defines taken from HTKwrite.c and The HTK Book 36 // Defines from HTKwrite.c and The HTK Book
35 #define H_WAVEFORM 0 // sampled waveform 37 #define H_WAVEFORM 0 // sampled waveform
36 #define H_LPC 1 // linear prediction filter coefficients 38 #define H_LPC 1 // linear prediction filter coefficients
37 #define H_LPREFC 2 // linear prediction reflection coefficients 39 #define H_LPREFC 2 // linear prediction reflection coefficients
38 #define H_LPCEPSTRA 3 // LPC cepstral coefficients 40 #define H_LPCEPSTRA 3 // LPC cepstral coefficients
39 #define H_LPDELCEP 4 // LPC cepstra plus delta coefficients 41 #define H_LPDELCEP 4 // LPC cepstra plus delta coefficients
67 ((((uint32_t) n) << 8) & 0x00FF0000) | \ 69 ((((uint32_t) n) << 8) & 0x00FF0000) | \
68 ((((uint32_t) n) >> 8) & 0x0000FF00) | \ 70 ((((uint32_t) n) >> 8) & 0x0000FF00) | \
69 ((((uint32_t) n) >> 24) & 0x000000FF) ) 71 ((((uint32_t) n) >> 24) & 0x000000FF) )
70 72
71 namespace aimc { 73 namespace aimc {
74 using std::string;
72 class FileOutputHTK : public Module { 75 class FileOutputHTK : public Module {
73 public: 76 public:
74 /*! \brief Create a new file output for an HTK format file. Use of this 77 /*! \brief Create a new file output for an HTK format file. Use of this
75 * class only really makes sense for the output of 1-D frames. 78 * class only really makes sense for the output of 1-D frames.
76 */ 79 */
80 /*! \brief Initialize the output to HTK. 83 /*! \brief Initialize the output to HTK.
81 * \param *filename Filename of the ouptut file to be created. 84 * \param *filename Filename of the ouptut file to be created.
82 * If the file exists it will be overwritten 85 * If the file exists it will be overwritten
83 * \return Returns true on success of initialization. 86 * \return Returns true on success of initialization.
84 */ 87 */
85 bool OpenFile(const char *filename, float frame_period_ms);
86 bool CloseFile(); 88 bool CloseFile();
87 virtual void Process(const SignalBank &input); 89 virtual void Process(const SignalBank &input);
88 private: 90 private:
89 virtual bool InitializeInternal(const SignalBank &input); 91 virtual bool InitializeInternal(const SignalBank &input);
90 virtual void ResetInternal(); 92 virtual void ResetInternal();
102 FILE *file_handle_; 104 FILE *file_handle_;
103 105
104 /*! \brief Count of the number of samples in the file, written on close 106 /*! \brief Count of the number of samples in the file, written on close
105 */ 107 */
106 int sample_count_; 108 int sample_count_;
109 string file_suffix_;
107 110
108 int channel_count_; 111 int channel_count_;
109 int buffer_length_; 112 int buffer_length_;
110 float frame_period_ms_; 113 float frame_period_ms_;
114 int previous_start_time_;
111 }; 115 };
112 } // namespace aimc 116 } // namespace aimc
113 117
114 #endif // AIMC_MODULES_OUTPUT_HTK_H_ 118 #endif // AIMC_MODULES_OUTPUT_HTK_H_
115 119