changeset 133:88df1647d1a0

- Support (hopefully) both movie writing and HTK file output.
author tomwalters
date Tue, 26 Oct 2010 00:03:29 +0000
parents 21d8502c10f8
children 5d4b269b67d2
files experiments/scripts/cnbh-syllables/feature_generation/ssi_profile_features.aimcopycfg src/Main/AIMCopy.cc src/Modules/Output/Graphics/Devices/GraphicsOutputDevice.h src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h src/Modules/Output/Graphics/GraphicsView.cc
diffstat 6 files changed, 29 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/experiments/scripts/cnbh-syllables/feature_generation/ssi_profile_features.aimcopycfg	Mon Oct 25 03:33:59 2010 +0000
+++ b/experiments/scripts/cnbh-syllables/feature_generation/ssi_profile_features.aimcopycfg	Tue Oct 26 00:03:29 2010 +0000
@@ -35,7 +35,7 @@
 module7.name = SmoothNAPOutput
 module7.id = htk_out
 module7.parameters = <<<ENDPARAMS
-htk_out.file_suffix=.smooth_nap_profile
+htk_out.file_suffix=smooth_nap_profile
 ENDPARAMS
 
 module8.name = StandardNAP
@@ -119,25 +119,25 @@
 
 module21.name = SSICutoffCycle1SliceOutput
 module21.parameters = <<<ENDPARAMS
-htk_out.file_suffix = .slice_1_cutoff
+htk_out.file_suffix = slice_1_cutoff
 ENDPARAMS
 module21.id = htk_out
 
 module22.name = SSINoCutoffCycle1SliceOutput
 module22.parameters = <<<ENDPARAMS
-htk_out.file_suffix = .slice_1_no_cutoff
+htk_out.file_suffix = slice_1_no_cutoff
 ENDPARAMS
 module22.id = htk_out
 
 module23.name = SSICutoffWholeSliceOutput
 module23.parameters = <<<ENDPARAMS
-htk_out.file_suffix = .ssi_profile_cutoff
+htk_out.file_suffix = ssi_profile_cutoff
 ENDPARAMS
 module23.id = htk_out
 
 module24.name = SSINoCutoffWholeSliceOutput
 module24.parameters = <<<ENDPARAMS
-htk_out.file_suffix = .ssi_profile_no_cutoff
+htk_out.file_suffix = ssi_profile_no_cutoff
 ENDPARAMS
 module24.id = htk_out
 
--- a/src/Main/AIMCopy.cc	Mon Oct 25 03:33:59 2010 +0000
+++ b/src/Main/AIMCopy.cc	Tue Oct 26 00:03:29 2010 +0000
@@ -159,18 +159,27 @@
   if (!initialized_) {
     return false;
   }
+  bool tree_initialized = false;
   for (unsigned int i = 0; i < script_.size(); ++i) {
     global_parameters_.SetString("input_filename", script_[i].first.c_str());
     global_parameters_.SetString("output_filename_base", script_[i].second.c_str());
-    if (!tree_.Initialize(&global_parameters_)) {
-      return false;
+    if (!tree_initialized) {
+      if (!tree_.Initialize(&global_parameters_)) {
+        return false;
+      }
+      tree_initialized = true;
+    } else {
+      tree_.Reset();
     }
     aimc::LOG_INFO(_T("%s -> %s"),
                   script_[i].first.c_str(),
                   script_[i].second.c_str());
     tree_.Process();
-    tree_.Reset();
   }
+  // A final call to Reset() is required to close any open files.
+  global_parameters_.SetString("input_filename", "");
+  global_parameters_.SetString("output_filename_base", "");
+  tree_.Reset();
   return true;
 }
 
--- a/src/Modules/Output/Graphics/Devices/GraphicsOutputDevice.h	Mon Oct 25 03:33:59 2010 +0000
+++ b/src/Modules/Output/Graphics/Devices/GraphicsOutputDevice.h	Tue Oct 26 00:03:29 2010 +0000
@@ -182,6 +182,9 @@
 
   //! \brief Called when animation stops
   virtual void Stop()  { m_bRunning = false; }
+  
+  virtual void Reset(Parameters* global_parameters) = 0;
+  
 
  protected:
   //! \brief True when animation is running
--- a/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc	Mon Oct 25 03:33:59 2010 +0000
+++ b/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc	Tue Oct 26 00:03:29 2010 +0000
@@ -133,6 +133,11 @@
   gRelease();
 }
 
+void GraphicsOutputDeviceMovie::Reset(Parameters* global_parameters) {
+  Stop();
+  Initialize(global_parameters);
+}
+
 void GraphicsOutputDeviceMovie::Stop() {
   GraphicsOutputDeviceCairo::Stop();
   CloseFile();
--- a/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h	Mon Oct 25 03:33:59 2010 +0000
+++ b/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h	Tue Oct 26 00:03:29 2010 +0000
@@ -55,6 +55,9 @@
   void Start();
   //! \brief This function now also generates the output movie.
   void Stop();
+  
+  void Reset(Parameters* global_parameters);
+  
 
  protected:
   /*! \brief Plots a summary of relevant parameters on the output
--- a/src/Modules/Output/Graphics/GraphicsView.cc	Mon Oct 25 03:33:59 2010 +0000
+++ b/src/Modules/Output/Graphics/GraphicsView.cc	Tue Oct 26 00:03:29 2010 +0000
@@ -82,7 +82,7 @@
 
 void GraphicsView::ResetInternal() {
   if (m_pDev != NULL) {
-    m_pDev->Stop();
+    m_pDev->Reset(global_parameters_);
   }
 }