Mercurial > hg > svcore
comparison data/model/SparseOneDimensionalModel.h @ 855:42bbc538d983 tonioni_multi_transform
Merge from tonioni branch
author | Chris Cannam |
---|---|
date | Wed, 04 Dec 2013 18:29:15 +0000 |
parents | d6bd5751b8f6 |
children | 6d07bcc844a1 |
comparison
equal
deleted
inserted
replaced
849:418cd2064769 | 855:42bbc538d983 |
---|---|
15 | 15 |
16 #ifndef _SPARSE_ONE_DIMENSIONAL_MODEL_H_ | 16 #ifndef _SPARSE_ONE_DIMENSIONAL_MODEL_H_ |
17 #define _SPARSE_ONE_DIMENSIONAL_MODEL_H_ | 17 #define _SPARSE_ONE_DIMENSIONAL_MODEL_H_ |
18 | 18 |
19 #include "SparseModel.h" | 19 #include "SparseModel.h" |
20 #include "NoteData.h" | |
20 #include "base/PlayParameterRepository.h" | 21 #include "base/PlayParameterRepository.h" |
21 #include "base/RealTime.h" | 22 #include "base/RealTime.h" |
22 | 23 |
23 #include <QStringList> | 24 #include <QStringList> |
24 | 25 |
67 } | 68 } |
68 }; | 69 }; |
69 }; | 70 }; |
70 | 71 |
71 | 72 |
72 class SparseOneDimensionalModel : public SparseModel<OneDimensionalPoint> | 73 class SparseOneDimensionalModel : public SparseModel<OneDimensionalPoint>, |
74 public NoteExportable | |
73 { | 75 { |
74 Q_OBJECT | 76 Q_OBJECT |
75 | 77 |
76 public: | 78 public: |
77 SparseOneDimensionalModel(size_t sampleRate, size_t resolution, | 79 SparseOneDimensionalModel(size_t sampleRate, size_t resolution, |
179 virtual SortType getSortType(int column) const | 181 virtual SortType getSortType(int column) const |
180 { | 182 { |
181 if (column == 2) return SortAlphabetical; | 183 if (column == 2) return SortAlphabetical; |
182 return SortNumeric; | 184 return SortNumeric; |
183 } | 185 } |
186 | |
187 /** | |
188 * NoteExportable methods. | |
189 */ | |
190 | |
191 NoteList getNotes() const { | |
192 return getNotes(getStartFrame(), getEndFrame()); | |
193 } | |
194 | |
195 NoteList getNotes(size_t startFrame, size_t endFrame) const { | |
196 | |
197 PointList points = getPoints(startFrame, endFrame); | |
198 NoteList notes; | |
199 | |
200 for (PointList::iterator pli = | |
201 points.begin(); pli != points.end(); ++pli) { | |
202 | |
203 notes.push_back | |
204 (NoteData(pli->frame, | |
205 getSampleRate() / 6, // arbitrary short duration | |
206 64, // default pitch | |
207 100)); // default velocity | |
208 } | |
209 | |
210 return notes; | |
211 } | |
184 }; | 212 }; |
185 | 213 |
186 #endif | 214 #endif |
187 | 215 |
188 | 216 |