comparison 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
comparison
equal deleted inserted replaced
390:21e79997e80f 391:5858cc462d0a
15 15
16 #ifndef _NOTE_MODEL_H_ 16 #ifndef _NOTE_MODEL_H_
17 #define _NOTE_MODEL_H_ 17 #define _NOTE_MODEL_H_
18 18
19 #include "SparseValueModel.h" 19 #include "SparseValueModel.h"
20 #include "base/RealTime.h"
20 #include "base/PlayParameterRepository.h" 21 #include "base/PlayParameterRepository.h"
21 #include "base/RealTime.h"
22 22
23 /** 23 /**
24 * Note type for use in a SparseModel or SparseValueModel. All we 24 * Note type for use in a SparseModel or SparseValueModel. All we
25 * mean by a "note" is something that has an onset time, a single 25 * mean by a "note" is something that has an onset time, a single
26 * value, and a duration. Like other points, it can also have a 26 * value, and a duration. Like other points, it can also have a
93 bool notifyOnAdd = true) : 93 bool notifyOnAdd = true) :
94 SparseValueModel<Note>(sampleRate, resolution, 94 SparseValueModel<Note>(sampleRate, resolution,
95 notifyOnAdd), 95 notifyOnAdd),
96 m_valueQuantization(0) 96 m_valueQuantization(0)
97 { 97 {
98 PlayParameterRepository::getInstance()->addModel(this); 98 PlayParameterRepository::getInstance()->addPlayable(this);
99 } 99 }
100 100
101 NoteModel(size_t sampleRate, size_t resolution, 101 NoteModel(size_t sampleRate, size_t resolution,
102 float valueMinimum, float valueMaximum, 102 float valueMinimum, float valueMaximum,
103 bool notifyOnAdd = true) : 103 bool notifyOnAdd = true) :
104 SparseValueModel<Note>(sampleRate, resolution, 104 SparseValueModel<Note>(sampleRate, resolution,
105 valueMinimum, valueMaximum, 105 valueMinimum, valueMaximum,
106 notifyOnAdd), 106 notifyOnAdd),
107 m_valueQuantization(0) 107 m_valueQuantization(0)
108 { 108 {
109 PlayParameterRepository::getInstance()->addModel(this); 109 PlayParameterRepository::getInstance()->addPlayable(this);
110 }
111
112 virtual ~NoteModel()
113 {
114 PlayParameterRepository::getInstance()->removePlayable(this);
110 } 115 }
111 116
112 float getValueQuantization() const { return m_valueQuantization; } 117 float getValueQuantization() const { return m_valueQuantization; }
113 void setValueQuantization(float q) { m_valueQuantization = q; } 118 void setValueQuantization(float q) { m_valueQuantization = q; }
114 119
127 */ 132 */
128 virtual PointList getPoints(long frame) const; 133 virtual PointList getPoints(long frame) const;
129 134
130 QString getTypeName() const { return tr("Note"); } 135 QString getTypeName() const { return tr("Note"); }
131 136
137 virtual bool canPlay() const { return true; }
138
139 virtual QString getDefaultPlayPluginId() const
140 {
141 return "dssi:_builtin:sample_player";
142 }
143
144 virtual QString getDefaultPlayPluginConfiguration() const
145 {
146 return "<plugin program=\"piano\"/>";
147 }
148
132 virtual void toXml(QTextStream &out, 149 virtual void toXml(QTextStream &out,
133 QString indent = "", 150 QString indent = "",
134 QString extraAttributes = "") const 151 QString extraAttributes = "") const
135 { 152 {
136 std::cerr << "NoteModel::toXml: extraAttributes = \"" 153 std::cerr << "NoteModel::toXml: extraAttributes = \""