comparison data/model/FlexiNoteModel.h @ 1599:ce185d4dd408 bqaudiostream

Merge from default branch
author Chris Cannam
date Wed, 23 Jan 2019 14:43:43 +0000
parents ad5f892c0c4d
children 24dc8cb42755
comparison
equal deleted inserted replaced
1598:d2555df635ec 1599:ce185d4dd408
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _FLEXINOTE_MODEL_H_ 16 #ifndef SV_FLEXINOTE_MODEL_H
17 #define _FLEXINOTE_MODEL_H_ 17 #define SV_FLEXINOTE_MODEL_H
18 18
19 #include "IntervalModel.h" 19 #include "IntervalModel.h"
20 #include "NoteData.h" 20 #include "NoteData.h"
21 #include "base/RealTime.h" 21 #include "base/RealTime.h"
22 #include "base/Pitch.h" 22 #include "base/Pitch.h"
128 PlayParameterRepository::getInstance()->removePlayable(this); 128 PlayParameterRepository::getInstance()->removePlayable(this);
129 } 129 }
130 130
131 float getValueQuantization() const { return m_valueQuantization; } 131 float getValueQuantization() const { return m_valueQuantization; }
132 void setValueQuantization(float q) { m_valueQuantization = q; } 132 void setValueQuantization(float q) { m_valueQuantization = q; }
133 float getValueMinimum() const { return 33; } 133 float getValueMinimum() const override { return 33; }
134 float getValueMaximum() const { return 88; } 134 float getValueMaximum() const override { return 88; }
135 135
136 QString getTypeName() const { return tr("FlexiNote"); } 136 QString getTypeName() const override { return tr("FlexiNote"); }
137 137
138 virtual bool canPlay() const { return true; } 138 bool canPlay() const override { return true; }
139 139
140 virtual QString getDefaultPlayClipId() const 140 QString getDefaultPlayClipId() const override
141 { 141 {
142 return "elecpiano"; 142 return "elecpiano";
143 } 143 }
144 144
145 virtual void toXml(QTextStream &out, 145 void toXml(QTextStream &out,
146 QString indent = "", 146 QString indent = "",
147 QString extraAttributes = "") const 147 QString extraAttributes = "") const override
148 { 148 {
149 std::cerr << "FlexiNoteModel::toXml: extraAttributes = \"" 149 std::cerr << "FlexiNoteModel::toXml: extraAttributes = \""
150 << extraAttributes.toStdString() << std::endl; 150 << extraAttributes.toStdString() << std::endl;
151 151
152 IntervalModel<FlexiNote>::toXml 152 IntervalModel<FlexiNote>::toXml
158 158
159 /** 159 /**
160 * TabularModel methods. 160 * TabularModel methods.
161 */ 161 */
162 162
163 virtual int getColumnCount() const 163 int getColumnCount() const override
164 { 164 {
165 return 6; 165 return 6;
166 } 166 }
167 167
168 virtual QString getHeading(int column) const 168 QString getHeading(int column) const override
169 { 169 {
170 switch (column) { 170 switch (column) {
171 case 0: return tr("Time"); 171 case 0: return tr("Time");
172 case 1: return tr("Frame"); 172 case 1: return tr("Frame");
173 case 2: return tr("Pitch"); 173 case 2: return tr("Pitch");
176 case 5: return tr("Label"); 176 case 5: return tr("Label");
177 default: return tr("Unknown"); 177 default: return tr("Unknown");
178 } 178 }
179 } 179 }
180 180
181 virtual QVariant getData(int row, int column, int role) const 181 QVariant getData(int row, int column, int role) const override
182 { 182 {
183 if (column < 4) { 183 if (column < 4) {
184 return IntervalModel<FlexiNote>::getData(row, column, role); 184 return IntervalModel<FlexiNote>::getData(row, column, role);
185 } 185 }
186 186
192 case 5: return i->label; 192 case 5: return i->label;
193 default: return QVariant(); 193 default: return QVariant();
194 } 194 }
195 } 195 }
196 196
197 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) 197 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override
198 { 198 {
199 if (column < 4) { 199 if (column < 4) {
200 return IntervalModel<FlexiNote>::getSetDataCommand 200 return IntervalModel<FlexiNote>::getSetDataCommand
201 (row, column, value, role); 201 (row, column, value, role);
202 } 202 }
216 216
217 command->addPoint(point); 217 command->addPoint(point);
218 return command->finish(); 218 return command->finish();
219 } 219 }
220 220
221 virtual SortType getSortType(int column) const 221 SortType getSortType(int column) const override
222 { 222 {
223 if (column == 5) return SortAlphabetical; 223 if (column == 5) return SortAlphabetical;
224 return SortNumeric; 224 return SortNumeric;
225 } 225 }
226 226
227 /** 227 /**
228 * NoteExportable methods. 228 * NoteExportable methods.
229 */ 229 */
230 230
231 NoteList getNotes() const 231 NoteList getNotes() const
232 { 232 override {
233 return getNotesWithin(getStartFrame(), getEndFrame()); 233 return getNotesWithin(getStartFrame(), getEndFrame());
234 } 234 }
235 235
236 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const 236 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const
237 { 237 override {
238 PointList points = getPoints(startFrame, endFrame); 238 PointList points = getPoints(startFrame, endFrame);
239 NoteList notes; 239 NoteList notes;
240 for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) { 240 for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) {
241 sv_frame_t duration = pli->duration; 241 sv_frame_t duration = pli->duration;
242 if (duration == 0 || duration == 1) { 242 if (duration == 0 || duration == 1) {