comparison data/model/SparseOneDimensionalModel.h @ 874:862fe7b20df7 tony_integration

Merge from tonioni branch
author Chris Cannam
date Tue, 28 Jan 2014 15:01:54 +0000
parents 3a3541b357fe
children 59e7fe1b1003
comparison
equal deleted inserted replaced
862:786ee8d1f30e 874:862fe7b20df7
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,
86 PlayParameterRepository::getInstance()->removePlayable(this); 88 PlayParameterRepository::getInstance()->removePlayable(this);
87 } 89 }
88 90
89 virtual bool canPlay() const { return true; } 91 virtual bool canPlay() const { return true; }
90 92
91 virtual QString getDefaultPlayPluginId() const 93 virtual QString getDefaultPlayClipId() const
92 { 94 {
93 return "dssi:_builtin:sample_player"; 95 return "tap";
94 }
95
96 virtual QString getDefaultPlayPluginConfiguration() const
97 {
98 return "<plugin program=\"tap\"/>";
99 } 96 }
100 97
101 int getIndexOf(const Point &point) 98 int getIndexOf(const Point &point)
102 { 99 {
103 // slow 100 // slow
179 virtual SortType getSortType(int column) const 176 virtual SortType getSortType(int column) const
180 { 177 {
181 if (column == 2) return SortAlphabetical; 178 if (column == 2) return SortAlphabetical;
182 return SortNumeric; 179 return SortNumeric;
183 } 180 }
181
182 /**
183 * NoteExportable methods.
184 */
185
186 NoteList getNotes() const {
187 return getNotes(getStartFrame(), getEndFrame());
188 }
189
190 NoteList getNotes(size_t startFrame, size_t endFrame) const {
191
192 PointList points = getPoints(startFrame, endFrame);
193 NoteList notes;
194
195 for (PointList::iterator pli =
196 points.begin(); pli != points.end(); ++pli) {
197
198 notes.push_back
199 (NoteData(pli->frame,
200 getSampleRate() / 6, // arbitrary short duration
201 64, // default pitch
202 100)); // default velocity
203 }
204
205 return notes;
206 }
184 }; 207 };
185 208
186 #endif 209 #endif
187 210
188 211