diff data/model/NoteModel.h @ 391:5858cc462d0a

* Fix #1628781 changes to layer visibility and mute should use a command * Also use a command for changes to layer playback pan, gain, plugin settings * Refactor PlayParameterRepository to remove dependency on audioio from base * Fix failure to save play parameters for main model in session file
author Chris Cannam
date Thu, 13 Mar 2008 14:06:03 +0000
parents 700cd3350391
children 6a96bff0bd59
line wrap: on
line diff
--- a/data/model/NoteModel.h	Thu Mar 13 12:41:20 2008 +0000
+++ b/data/model/NoteModel.h	Thu Mar 13 14:06:03 2008 +0000
@@ -17,8 +17,8 @@
 #define _NOTE_MODEL_H_
 
 #include "SparseValueModel.h"
+#include "base/RealTime.h"
 #include "base/PlayParameterRepository.h"
-#include "base/RealTime.h"
 
 /**
  * Note type for use in a SparseModel or SparseValueModel.  All we
@@ -95,7 +95,7 @@
 			       notifyOnAdd),
 	m_valueQuantization(0)
     {
-	PlayParameterRepository::getInstance()->addModel(this);
+	PlayParameterRepository::getInstance()->addPlayable(this);
     }
 
     NoteModel(size_t sampleRate, size_t resolution,
@@ -106,7 +106,12 @@
 			       notifyOnAdd),
 	m_valueQuantization(0)
     {
-	PlayParameterRepository::getInstance()->addModel(this);
+	PlayParameterRepository::getInstance()->addPlayable(this);
+    }
+
+    virtual ~NoteModel()
+    {
+        PlayParameterRepository::getInstance()->removePlayable(this);
     }
 
     float getValueQuantization() const { return m_valueQuantization; }
@@ -129,6 +134,18 @@
 
     QString getTypeName() const { return tr("Note"); }
 
+    virtual bool canPlay() const { return true; }
+
+    virtual QString getDefaultPlayPluginId() const
+    {
+        return "dssi:_builtin:sample_player";
+    }
+
+    virtual QString getDefaultPlayPluginConfiguration() const
+    {
+        return "<plugin program=\"piano\"/>";
+    }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const