diff src/Analyser.cpp @ 432:6e8e85edfd48

Extend models to have nominal end time matching that of the audio, so that the export-fill option continues to fill to end of audio time
author Chris Cannam
date Tue, 31 Mar 2015 12:28:17 +0100
parents 2bbec2dfe9f6
children 093c1fb2fb31
line wrap: on
line diff
--- a/src/Analyser.cpp	Tue Mar 31 12:12:31 2015 +0100
+++ b/src/Analyser.cpp	Tue Mar 31 12:28:17 2015 +0100
@@ -193,7 +193,32 @@
 Analyser::layerCompletionChanged()
 {
     if (getInitialAnalysisCompletion() == 100) {
+
         emit initialAnalysisCompleted();
+
+        if (m_layers[Audio]) {
+
+            // Extend pitch-track and note layers so as to nominally
+            // end at the same time as the audio. This affects any
+            // time-filling done on export etc.
+            
+            sv_frame_t endFrame = m_layers[Audio]->getModel()->getEndFrame();
+        
+            if (m_layers[PitchTrack]) {
+                SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *>
+                    (m_layers[PitchTrack]->getModel());
+                if (model) {
+                    model->extendEndFrame(endFrame);
+                }
+            }
+            if (m_layers[Notes]) {
+                NoteModel *model = qobject_cast<NoteModel *>
+                    (m_layers[Notes]->getModel());
+                if (model) {
+                    model->extendEndFrame(endFrame);
+                }
+            }
+        }
     }
 }