diff data/fileio/MIDIFileWriter.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 73537d900d4b
children 2e50d95cf621
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp	Thu Nov 22 14:17:19 2007 +0000
+++ b/data/fileio/MIDIFileWriter.cpp	Fri Nov 23 16:48:23 2007 +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());