diff data/model/NoteData.h @ 865:9196cff56abe tonioni

SV file compatibility etc for sample stuff
author Chris Cannam
date Tue, 07 Jan 2014 15:49:39 +0000
parents 1f98e28f70c6
children 59e7fe1b1003
line wrap: on
line diff
--- a/data/model/NoteData.h	Tue Jan 07 13:09:53 2014 +0000
+++ b/data/model/NoteData.h	Tue Jan 07 15:49:39 2014 +0000
@@ -17,6 +17,8 @@
 
 #include <vector>
 
+#include "base/Pitch.h"
+
 struct NoteData
 {
     NoteData(size_t _start, size_t _dur, int _mp, int _vel) :
@@ -26,10 +28,17 @@
     size_t start;     // audio sample frame
     size_t duration;  // in audio sample frames
     int midiPitch; // 0-127
-//!!! float: -> what else would this change?
-    int frequency; // Hz, to be used if isMidiPitchQuantized false
+    float frequency; // Hz, to be used if isMidiPitchQuantized false
     bool isMidiPitchQuantized;
     int velocity;  // MIDI-style 0-127
+
+    float getFrequency() const {
+        if (isMidiPitchQuantized) {
+            return Pitch::getFrequencyForPitch(midiPitch);
+        } else {
+            return frequency;
+        }
+    }
 };
 
 typedef std::vector<NoteData> NoteList;