diff data/fileio/MIDIFileWriter.cpp @ 384:6f6ab834449d spectrogram-cache-rejig

* Merge from trunk
author Chris Cannam
date Wed, 27 Feb 2008 11:59:42 +0000
parents 73537d900d4b
children 2e50d95cf621
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp	Thu Nov 15 14:03:56 2007 +0000
+++ b/data/fileio/MIDIFileWriter.cpp	Wed Feb 27 11:59:42 2008 +0000
@@ -369,8 +369,10 @@
         double quarters = (seconds * m_tempo) / 60.0;
         unsigned long midiTime = lrint(quarters * m_timingDivision);
 
-        // We don't support velocity in note models yet
         int velocity = 100;
+        if (i->level > 0.f && i->level <= 1.f) {
+            velocity = lrintf(i->level * 127.f);
+        }
 
         // Get the sounding time for the matching NOTE_OFF
         seconds = double(frame + duration) / double(m_model->getSampleRate());