changeset 623:49afde2dd704 tonioni

put the FlexiNote layer before the note layer to see what happens -- not much
author matthiasm
date Tue, 26 Mar 2013 20:14:08 +0000
parents 765bb3774c4f
children 1336439dc055
files layer/FlexiNoteLayer.cpp layer/LayerFactory.cpp
diffstat 2 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp	Tue Mar 26 17:00:45 2013 +0000
+++ b/layer/FlexiNoteLayer.cpp	Tue Mar 26 20:14:08 2013 +0000
@@ -45,11 +45,10 @@
     m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")),
     m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")),
     m_editingCommand(0),
-    m_verticalScale(AutoAlignScale),
-    m_scaleMinimum(0),
-    m_scaleMaximum(0)
+    m_verticalScale(MIDIRangeScale),
+    m_scaleMinimum(34),
+    m_scaleMaximum(77)
 {
-    
 }
 
 void
@@ -213,11 +212,14 @@
 bool
 FlexiNoteLayer::getDisplayExtents(float &min, float &max) const
 {
-    if (!m_model || shouldAutoAlign()) return false;
+    if (!m_model || shouldAutoAlign()) {
+		std::cerr << "No model or shouldAutoAlign()" << std::endl;
+		return false;
+	}
 
     if (m_verticalScale == MIDIRangeScale) {
         min = Pitch::getFrequencyForPitch(0);
-        max = Pitch::getFrequencyForPitch(127);
+        max = Pitch::getFrequencyForPitch(70);
         return true;
     }
 
@@ -631,7 +633,7 @@
 
         if (m_verticalScale == MIDIRangeScale) {
             min = Pitch::getFrequencyForPitch(0);
-            max = Pitch::getFrequencyForPitch(127);
+            max = Pitch::getFrequencyForPitch(70);
         } else if (shouldConvertMIDIToHz()) {
             min = Pitch::getFrequencyForPitch(lrintf(min));
             max = Pitch::getFrequencyForPitch(lrintf(max + 1));
--- a/layer/LayerFactory.cpp	Tue Mar 26 17:00:45 2013 +0000
+++ b/layer/LayerFactory.cpp	Tue Mar 26 20:14:08 2013 +0000
@@ -161,11 +161,13 @@
     }
 
     if (dynamic_cast<NoteModel *>(model)) {
+	types.insert(FlexiNotes);
 	types.insert(Notes);
     }
 
     if (dynamic_cast<FlexiNoteModel *>(model)) {
 	types.insert(FlexiNotes);
+	types.insert(Notes);
     }
 
     if (dynamic_cast<RegionModel *>(model)) {
@@ -196,8 +198,8 @@
     LayerTypeSet types;
     types.insert(TimeInstants);
     types.insert(TimeValues);
+	types.insert(FlexiNotes);
     types.insert(Notes);
-    types.insert(FlexiNotes);
     types.insert(Regions);
     types.insert(Text);
     types.insert(Image);
@@ -213,8 +215,8 @@
     if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler;
     if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants;
     if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues;
+	if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes;
     if (dynamic_cast<const NoteLayer *>(layer)) return Notes;
-    if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes;
     if (dynamic_cast<const RegionLayer *>(layer)) return Regions;
     if (dynamic_cast<const TextLayer *>(layer)) return Text;
     if (dynamic_cast<const ImageLayer *>(layer)) return Image;
@@ -257,7 +259,7 @@
     case TimeInstants: return "timeinstants";
     case TimeValues: return "timevalues";
     case Notes: return "notes";
-    case FlexiNotes: return "flexible notes";
+    case FlexiNotes: return "flexinotes";
     case Regions: return "regions";
     case Text: return "text";
     case Image: return "image";
@@ -278,7 +280,7 @@
     if (name == "timeruler") return TimeRuler;
     if (name == "timeinstants") return TimeInstants;
     if (name == "timevalues") return TimeValues;
-    if (name == "flexible notes") return FlexiNotes;
+    if (name == "flexinotes") return FlexiNotes;
     if (name == "regions") return Regions;
     if (name == "text") return Text;
     if (name == "image") return Image;
@@ -347,10 +349,10 @@
 	return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1);
     } else if (layerType == TimeValues) {
 	return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true);
+	} else if (layerType == FlexiNotes) {
+	return new FlexiNoteModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == Notes) {
 	return new NoteModel(baseModel->getSampleRate(), 1, true);
-    } else if (layerType == FlexiNotes) {
-	return new NoteModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == Regions) {
 	return new RegionModel(baseModel->getSampleRate(), 1, true);
     } else if (layerType == Text) {
@@ -418,14 +420,14 @@
 	layer = new TimeValueLayer;
 	break;
 
+    case FlexiNotes:
+	layer = new FlexiNoteLayer;
+	break;
+
     case Notes:
 	layer = new NoteLayer;
 	break;
 
-    case FlexiNotes:
-	layer = new FlexiNoteLayer;
-	break;
-
     case Regions:
 	layer = new RegionLayer;
 	break;