diff plugin/transform/FeatureExtractionModelTransformer.cpp @ 340:516819f2b97b

* Add Erase tool and mode * Add icons for Normalize buttons in property boxes, and for Show Peaks * Add support for velocity in notes -- not yet reflected in display or editable in the note edit dialog, but they are imported from MIDI, played, and exported * Begin work on making pastes align pasted times (subtler than I thought)
author Chris Cannam
date Fri, 23 Nov 2007 16:48:23 +0000
parents aa8dbac62024
children 46519c04321b
line wrap: on
line diff
--- a/plugin/transform/FeatureExtractionModelTransformer.cpp	Thu Nov 22 14:17:19 2007 +0000
+++ b/plugin/transform/FeatureExtractionModelTransformer.cpp	Fri Nov 23 16:48:23 2007 +0000
@@ -495,12 +495,15 @@
         
         float velocity = 100;
         if (feature.values.size() > 2) velocity = feature.values[2];
+        if (velocity < 0) velocity = 127;
+        if (velocity > 127) velocity = 127;
 
         NoteModel *model = getOutput<NoteModel>();
         if (!model) return;
 
         model->addPoint(NoteModel::Point(frame, pitch,
                                          lrintf(duration),
+                                         velocity / 127.f,
                                          feature.label.c_str()));
 	
     } else {